Class for switch option.
More...
#include <yat/utility/OptionSwitch.h>
List of all members.
Public Member Functions |
| OptionSwitch (CommandLine &cmd, std::string name, std::string desc, bool def=false) |
| Constructor.
|
bool | value (void) const |
| return value
|
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 |
Detailed Description
Constructor & Destructor Documentation
Constructor.
- Parameters:
-
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 |
def | default value for switch |
Member Function Documentation
set description
- Since:
- New in yat 0.7
- Returns:
- long name e.g. 'help' for --help option.
Get if option was found in cmd.
- Returns:
- true if option has been detected in parsing
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:
- Returns:
- short name e.g. 'h' for -h option.
The documentation for this class was generated from the following file: