#include <yat/utility/Option.h>
Public Member Functions | |
Option (CommandLine &cmd, std::string name, std::string desc) | |
Constructor. | |
virtual | ~Option (void) |
destructor | |
std::string | description (void) const |
void | description (const std::string &description) |
set description | |
std::string | long_name (void) const |
void | parse (std::vector< std::string >::iterator &, const std::vector< std::string >::iterator &) |
parsing the commandline | |
bool | present (void) const |
Get if option was found in cmd. | |
std::string | print (void) |
print help output | |
void | reset (void) |
sets present to false | |
char | short_name (void) const |
void | validate (void) |
Validate the Option. | |
Protected Member Functions | |
const CommandLine & | cmd (void) const |
theplu::yat::utility::Option::Option | ( | CommandLine & | cmd, | |
std::string | name, | |||
std::string | desc | |||
) |
Constructor.
cmd | Commandline to be hooked up with. | |
name | string such as "help" for --help, "h" for -h or "h,help" for having both short and long option name | |
desc | string used in help display |
const CommandLine& theplu::yat::utility::Option::cmd | ( | void | ) | const [protected] |
void theplu::yat::utility::Option::description | ( | const std::string & | description | ) |
std::string theplu::yat::utility::Option::description | ( | void | ) | const |
std::string theplu::yat::utility::Option::long_name | ( | void | ) | const |
bool theplu::yat::utility::Option::present | ( | void | ) | const |
Get if option was found in cmd.
std::string theplu::yat::utility::Option::print | ( | void | ) |
print help output
This function calls the four virtual private functions print1, print2, print3, and print4. This allows an inherited class to implement one (or several) of these functions and keep the default output of the others. The default behavior is that:
char theplu::yat::utility::Option::short_name | ( | void | ) | const |
void theplu::yat::utility::Option::validate | ( | void | ) |
Validate the Option.
This function is called by CommandLine::parse() after all options have been detected and parsed (see Option::parse()).