Go to the documentation of this file.
43 #ifndef CCXX_CMDOPTNS_H_
44 #define CCXX_CMDOPTNS_H_
46 #ifndef CCXX_STRING_H_
50 #ifdef CCXX_NAMESPACES
55 class CommandOptionParse;
156 const char * inOptionName,
157 const char * inOptionLetter,
158 const char * inDescription,
160 bool inRequired =
false,
239 const char * inOptionName,
240 const char * inOptionLetter,
241 const char * inDescription,
243 bool inRequired =
false,
271 const char * inOptionName,
272 const char * inOptionLetter,
273 const char * inDescription,
274 bool inRequired =
false,
306 const char * inOptionName,
307 const char * inOptionLetter,
308 const char * inDescription,
309 bool inRequired =
false,
336 const char * inOptionName,
337 const char * inOptionLetter,
338 const char * inDescription,
339 bool inRequired =
false,
367 const char * inOptionName,
368 const char * inOptionLetter,
369 const char * inDescription,
370 bool inRequired =
false,
438 const char * comment,
442 #ifdef CCXX_NAMESPACES
CommandOption is the base class for all command line options.
Definition: cmdoptns.h:76
virtual void performTask(CommandOptionParse *cop)
Once CommandOption objects have completed parsing and there are no errors they may have some specific...
virtual void foundOption(CommandOptionParse *cop, const char **value, int num)
const char ** values
Array of list of values collected for this option.
Definition: cmdoptns.h:220
const char * optionName
Long option name, these will be preceded with "--" on the command line.
Definition: cmdoptns.h:83
virtual ~CommandOptionWithArg()
virtual void parseDone(CommandOptionParse *cop)
Once parsing of command line options is complete, this method is called.
virtual void foundOption(CommandOptionParse *cop, const char *value=0)
foundOption is called by the CommandOptionParse object during the parsing of the command line options...
CommandOptionWithArg(const char *inOptionName, const char *inOptionLetter, const char *inDescription, OptionType inOptionType, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOptionWithArg contructor.
Common C++ generic string class.
CommandOptionArg(const char *inOptionName, const char *inOptionLetter, const char *inDescription, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOptionArg contructor.
OptionType
OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing a...
Definition: cmdoptns.h:103
CommandOptionRest(const char *inOptionName, const char *inOptionLetter, const char *inDescription, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOptionRest contructor.
virtual void registerError(const char *errMsg)=0
Register an error with this parser.
int numSet
The number of times this value has been set.
Definition: cmdoptns.h:354
int numValue
Number of values in the values array.
Definition: cmdoptns.h:225
It only makes sense to have a single one of these set and it is exclusive with CommandOptionCollect.
Definition: cmdoptns.h:292
__EXPORT CommandOptionParse * makeCommandOptionParse(int argc, char **argv, const char *comment, CommandOption *options=defaultCommandOptionList)
makeCommandOptionParse will create an implementation of a CommandOptionParse object.
@ hasArg
This option is associated with a value.
Definition: cmdoptns.h:107
CommandOption(const char *inOptionName, const char *inOptionLetter, const char *inDescription, OptionType inOptionType, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOption contructor.
It only makes sense to have a single one of these set and it is also exclusive with CommandOptionRest...
Definition: cmdoptns.h:322
virtual void performTask()=0
The method should be invoked by the main code once it has determined that the application should be s...
virtual const char * printUsage()=0
Return a string that contains the usage description of this list of paramaters.
CommandOptionNoArg(const char *inOptionName, const char *inOptionLetter, const char *inDescription, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOptionArg contructor.
const char * optionLetter
option letter, these will be preceded with "-" on the command line.
Definition: cmdoptns.h:89
#define __EXPORT
Definition: config.h:979
This is the CommandOptionParse interface class.
Definition: cmdoptns.h:390
virtual ~CommandOption()
A virtual destructor just in case.
virtual ~CommandOptionParse()=0
Virtual destructor needed so that the object may be correctly deleted.
const char * description
A short description of the option for Usage messages.
Definition: cmdoptns.h:96
Derived class of CommandOption for options that have a value associated with them.
Definition: cmdoptns.h:214
virtual const char * printErrors()=0
Return a string of text describing the list of errors encountered.
CommandOptionCollect(const char *inOptionName, const char *inOptionLetter, const char *inDescription, bool inRequired=false, CommandOption **ppNext=&defaultCommandOptionList)
CommandOptionRest contructor.
virtual ~CommandOptionArg()
virtual bool hasValue()
For fields with the required flag set, this method is used to determine if the Option has satisfied i...
bool required
True if this parameter is required.
Definition: cmdoptns.h:131
@ noArg
This option is a flag only.
Definition: cmdoptns.h:111
virtual bool argsHaveError()=0
Get the value of the error flag set if the parser encountered errors.
virtual void foundOption(CommandOptionParse *cop, const char *value=0)
CommandOptionNoArg::foundOption will evpect a nil "value" passed in.
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...
virtual void foundOption(CommandOptionParse *cop, const char *value=0)
@ trailing
Remaining of the command line arguments.
Definition: cmdoptns.h:115
CommandOption * next
This next CommandOption in this list of options or nil if no more options exist.
Definition: cmdoptns.h:137
Class for options with an argument e.g.
Definition: cmdoptns.h:257
CommandOption type for flags.
Definition: cmdoptns.h:348
__EXPORT CommandOption * defaultCommandOptionList
This defines a linked list head pointer for all the command line options that use the default list.
OptionType optionType
This command option's OptionType.
Definition: cmdoptns.h:125