class CommandOption
|
CommandOption is the base class for all command line options. More... |
|
|
Public Types
Public Methods
- virtual ~CommandOption ()
- CommandOption (
const char * in_option_name,
const char * in_option_letter,
const char * in_description,
OptionType in_option_type,
bool in_required = false,
CommandOption ** pp_next = & DefaultCommandOptionList
)
- virtual void FoundOption ( CommandOptionParse * cop, const char * value = 0 )
- virtual void FoundOption ( CommandOptionParse * cop, const char ** value, int num )
- virtual void ParseDone ( CommandOptionParse * cop )
- virtual void PerformTask ( CommandOptionParse * cop )
- virtual bool HasValue ()
Public Members
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.
const char * option_name
| option_name |
const char * option_letter
| option_letter |
const char * description
| description |
enum OptionType { HasArg,
/**
}
| OptionType |
This option is associated with a value
OptionType option_type
| option_type |
CommandOption * next
| next |
~CommandOption ()
| ~CommandOption |
[virtual]
A virtual destructor just in case.
CommandOption (
const char * in_option_name,
const char * in_option_letter,
const char * in_description,
OptionType in_option_type,
bool in_required = false,
CommandOption ** pp_next = & DefaultCommandOptionList
)
| CommandOption |
CommandOption contructor. Note the default values for required and
pp_next.
Parameters:
in_option_name | long option name
|
in_option_letter | short letter name
|
in_description | short description of the option
|
in_option_type | the type of this option
|
in_required | true if option is required
|
pp_next | the linked list header
|
void FoundOption ( CommandOptionParse * cop, const char * value = 0 )
| FoundOption |
[virtual]
FoundOption is called by the CommandOptionParse object during the parsing
of the command line options.
Parameters:
cop | pointer to the command option parser
|
value | the value of this option
|
void FoundOption ( CommandOptionParse * cop, const char ** value, int num )
| FoundOption |
[virtual]
FoundOption is called by the CommandOptionParse object during the parsing
of the command line options.
Parameters:
cop | pointer to the command option parser
|
value | an array of values of this option
|
num | number of values in the array
|
void ParseDone ( CommandOptionParse * cop )
| ParseDone |
[virtual]
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.
Parameters:
cop | pointer to the command option parser
|
void PerformTask ( CommandOptionParse * cop )
| PerformTask |
[virtual]
Once CommandOption objects have completed parsing and there are no
errors they may have some specific tasks to perform. PerformTask
must return.
Parameters:
cop | pointer to the command option parser
|
bool HasValue ()
| HasValue |
[virtual]
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.
- Author: Gianni Mariani
- Generated: dyfet on home on Thu Jan 24 11:06:29 2002, using kdoc 2.0a53.