yat
0.14.5pre
|
#include <yat/utility/OptionArg.h>
Public Member Functions | |
OptionArg (CommandLine &cmd, std::string name, std::string desc, bool required=false) | |
Constructor. More... | |
void | print_arg (std::string arg) |
T | value (void) const |
void | value (T v) |
set value More... | |
std::string | description (void) const |
void | description (const std::string &description) |
set description More... | |
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. More... | |
std::string | print (void) |
print help output More... | |
void | reset (void) |
sets present to false | |
char | short_name (void) const |
void | validate (void) |
Validate the Option. More... | |
Protected Member Functions | |
bool | required (void) const |
const CommandLine & | cmd (void) const |
Option with argument.
If the option is present, argument is set during parsing. Supported formats are both gnu-style "--support-gnu=value", POSIX-like "--support-posix value", as well as shorter "-s value". The argument of an parameter is retrived by the value() function. The type T
should be either a string or a type supported by function convert().
|
inline |
Constructor.
cmd | Commandline Option is associated 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 |
required | If true option must be found in commandline or exception is thrown in validation |
|
protectedinherited |
|
inherited |
|
inherited |
set description
|
inherited |
|
inherited |
Get if option was found in cmd.
|
inherited |
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:
|
inline |
arg | string to be used in help output such as '=TARGET' in '–target=TARGET'. See print3(). |
|
inlineprotected |
|
inherited |
|
inherited |
Validate the Option.
This function is called by CommandLine::parse() after all options have been detected and parsed (see Option::parse()).
|
inline |
|
inline |
set value