CLI for C++ Project Page | CLI for C++ Home Page |
#include <Option.h>
Public Types | |
enum | Args { NO_ARGS, ONE_ARG, AT_LEAST_ONE_ARG, MANY_ARGS } |
Enumeration to specify how many arguments this option can take. More... | |
Public Member Functions | |
Option () | |
Option (const Option &) | |
Option & | operator= (const Option &) |
Option (const char *const option, const bool hasArg, const char *const description) | |
Construct an option from the given parameters. | |
Option (const char *const option, const Args takesArgs, const char *const description) | |
Construct an option from the given parameters. | |
Option (const char *const option, const char *const description) | |
Construct an option from the given parameters. | |
Option (const char *const option, const char *const longOption, const bool hasArg, const char *const description) | |
Construct an option from the given parameters. | |
Option (const char *const option, const char *const longOption, const Args takesArgs, const char *const description) | |
Construct an option from the given parameters. | |
~Option () | |
std::string | getArgName () const |
Provide the display name used for the argument to this option. | |
std::string | getOpt () const |
Return a copy of the short option. | |
std::string | getLongOpt () const |
Return a copy of the long option. | |
bool | hasLongOpt () const |
Report whether the option has a long option. | |
std::string | getDescription () const |
Return the description for this option as would be presented in a help screen. | |
int | getId () const |
Returns an identifier for this option. | |
std::string | getValue () const |
Get the value for this option. | |
std::string | getValue (const char *const defaultValue) const |
Get the value for this option. | |
std::string | getValue (const unsigned index) const |
Get an argument value for this option at the given index location. | |
std::vector< std::string > | getValues () const |
bool | hasArgName () const |
Report whether the arg name value for this option was set. | |
bool | hasArg () const |
bool | hasArgs () const |
void | setArgName (const std::string &argName) |
Set the argument name used by this option as used in help screens. | |
void | setArgs (const Args takesArgs) |
Specify how many arguments this option can take. | |
void | addValue (const std::string &value) |
Add a value to this option. |
|
Enumeration to specify how many arguments this option can take. An option can have either no arguments, exactly one argument, one or more arguments, or zero or more arguments. |
|
|
|
|
|
Construct an option from the given parameters.
|
|
Construct an option from the given parameters.
|
|
Construct an option from the given parameters. This constructor assumes that the option does not take an argument.
|
|
Construct an option from the given parameters.
|
|
Construct an option from the given parameters.
|
|
|
|
Add a value to this option. This method is used during parsing or for test purposes. |
|
Provide the display name used for the argument to this option. This value is used in formatting display help. |
|
Return the description for this option as would be presented in a help screen.
|
|
Returns an identifier for this option. The value returned must differ from all other active Option instances.
|
|
Return a copy of the long option.
|
|
Return a copy of the short option.
|
|
Get an argument value for this option at the given index location.
|
|
Get the value for this option. If none was specified, return the value specified.
|
|
Get the value for this option. Typically, assumes hasArg() == true. |
|
|
|
|
|
Report whether the arg name value for this option was set.
|
|
|
|
Report whether the option has a long option.
|
|
|
|
Set the argument name used by this option as used in help screens. The default value otherwise is "arg".
|
|
Specify how many arguments this option can take.
|
|
hosts this site. |
Send comments to: John Poplett |