CommandOption is the base class for all command line options. More...
#include <cmdoptns.h>
CommandOption is the base class for all command line options.
Command line options can be defined statically and used when constructing a command line parser onject using makeCommandOptionParse. This serves only as a base class to CommandOptionWithArg, CommandOptionRest or CommandOptionNoArg which can also be used to derive more complex classes or even entire applications.
Definition at line 76 of file cmdoptns.h.
OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args.
Option type
Enumerator | |
---|---|
hasArg |
This option is associated with a value. |
noArg |
This option is a flag only. |
trailing |
Remaining of the command line arguments. |
collect |
Collect values that are not a value to an option. |
Definition at line 103 of file cmdoptns.h.
A virtual destructor just in case.
false
,
&defaultCommandOptionList
CommandOption contructor.
Note the default values for required and ppNext.
0
foundOption is called by the CommandOptionParse object during the parsing of the command line options.
Reimplemented in CommandOptionNoArg, and CommandOptionWithArg.
foundOption is called by the CommandOptionParse object during the parsing of the command line options.
Reimplemented in CommandOptionWithArg.
For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status.
The default methods simply returns true if any values have been found. This could be specialized to return true based on some other criteria.
Reimplemented in CommandOptionWithArg.
Once parsing of command line options is complete, this method is called.
This can be used to perform last minute checks on the options collected.
Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform.
PerformTask must return.
A short description of the option for Usage messages.
e.g. Usage: mycommand : blah -f, –file <DESCRIPTION here>
Definition at line 96 of file cmdoptns.h.
This next CommandOption in this list of options or nil if no more options exist.
Definition at line 137 of file cmdoptns.h.
option letter, these will be preceded with "-" on the command line.
e.g. -f foo.x
Definition at line 89 of file cmdoptns.h.
Long option name, these will be preceded with "--" on the command line.
e.g. –file foo.x
Definition at line 83 of file cmdoptns.h.
This command option's OptionType.
Definition at line 125 of file cmdoptns.h.
True if this parameter is required.
If the parameter is not supplied and required is true, an error will be flagged in the option processor.
Definition at line 131 of file cmdoptns.h.