Bayonne2 / Common C++ 2 Framework
|
CommandOption type for flags. More...
#include <cmdoptns.h>
Public Types | |
enum | OptionType { hasArg, noArg, trailing, collect } |
OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args. More... | |
Public Member Functions | |
CommandOptionNoArg (const char *inOptionName, const char *inOptionLetter, const char *inDescription, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList) | |
CommandOptionArg contructor. More... | |
virtual void | foundOption (CommandOptionParse *cop, const char *value=0) |
CommandOptionNoArg::foundOption will evpect a nil "value" passed in. More... | |
virtual void | foundOption (CommandOptionParse *cop, const char **value, int num) |
foundOption is called by the CommandOptionParse object during the parsing of the command line options. More... | |
virtual void | parseDone (CommandOptionParse *cop) |
Once parsing of command line options is complete, this method is called. More... | |
virtual void | performTask (CommandOptionParse *cop) |
Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform. More... | |
virtual bool | hasValue () |
For fields with the required flag set, this method is used to determine if the Option has satisfied it's required status. More... | |
Data Fields | |
int | numSet |
The number of times this value has been set. More... | |
const char * | optionName |
Long option name, these will be preceded with "--" on the command line. More... | |
const char * | optionLetter |
option letter, these will be preceded with "-" on the command line. More... | |
const char * | description |
A short description of the option for Usage messages. More... | |
OptionType | optionType |
This command option's OptionType. More... | |
bool | required |
True if this parameter is required. More... | |
CommandOption * | next |
This next CommandOption in this list of options or nil if no more options exist. More... | |
CommandOption type for flags.
Definition at line 348 of file cmdoptns.h.
|
inherited |
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.
CommandOptionNoArg::CommandOptionNoArg | ( | const char * | inOptionName, |
const char * | inOptionLetter, | ||
const char * | inDescription, | ||
bool | inRequired = false , |
||
CommandOption ** | ppNext = &defaultCommandOptionList |
||
) |
CommandOptionArg contructor.
This sets the optionType for this object to NoArg.
inOptionName | long option name |
inOptionLetter | short letter name |
inDescription | short description of the option |
inRequired | true if option is required |
ppNext | the linked list header |
|
virtualinherited |
foundOption is called by the CommandOptionParse object during the parsing of the command line options.
cop | pointer to the command option parser |
value | an array of values of this option |
num | number of values in the array |
Reimplemented in CommandOptionWithArg.
|
virtual |
CommandOptionNoArg::foundOption will evpect a nil "value" passed in.
Reimplemented from CommandOption.
|
virtualinherited |
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.
|
virtualinherited |
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.
cop | pointer to the command option parser |
|
virtualinherited |
Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform.
PerformTask must return.
cop | pointer to the command option parser |
|
inherited |
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.
|
inherited |
This next CommandOption in this list of options or nil if no more options exist.
Definition at line 137 of file cmdoptns.h.
int CommandOptionNoArg::numSet |
The number of times this value has been set.
Definition at line 354 of file cmdoptns.h.
|
inherited |
option letter, these will be preceded with "-" on the command line.
e.g. -f foo.x
Definition at line 89 of file cmdoptns.h.
|
inherited |
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.
|
inherited |
This command option's OptionType.
Definition at line 125 of file cmdoptns.h.
|
inherited |
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.