ost::CommandOption(3) | Library Functions Manual | ost::CommandOption(3) |
ost::CommandOption - CommandOption is the base class for all command line options.
#include <cmdoptns.h>
Inherited by ost::CommandOptionNoArg, and ost::CommandOptionWithArg.
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. "
virtual ~CommandOption ()
A virtual destructor just in case. CommandOption (const char
*inOptionName, const char *inOptionLetter, const char *inDescription,
OptionType inOptionType, bool inRequired=false, CommandOption
**ppNext=&defaultCommandOptionList)
CommandOption contructor. virtual void foundOption
(CommandOptionParse *cop, const char *value=0)
foundOption is called by the CommandOptionParse object during the
parsing of the command line options. 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 parseDone
(CommandOptionParse *cop)
Once parsing of command line options is complete, this method is called.
virtual void performTask (CommandOptionParse *cop)
Once CommandOption objects have completed parsing and there are no
errors they may have some specific tasks to perform. 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.
const char * optionName
Long option name, these will be preceded with '--' on the command line. const
char * optionLetter
option letter, these will be preceded with '-' on the command line. const char
* description
A short description of the option for Usage messages. OptionType
optionType
This command option's OptionType. bool required
True if this parameter is required. CommandOption * next
This next CommandOption in this list of options or nil if no more
options exist.
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.
Author:
Examples:
cmdlineopt.cpp.
OptionType is for denoting what type of option this is, with an arg, without an arg or the trailing args. Option type
Enumerator
A virtual destructor just in case.
CommandOption contructor. Note the default values for required and ppNext.
Parameters:
foundOption is called by the CommandOptionParse object during the parsing of the command line options.
Parameters:
Reimplemented in ost::CommandOptionNoArg, and ost::CommandOptionWithArg.
foundOption is called by the CommandOptionParse object during the parsing of the command line options.
Parameters:
Reimplemented in ost::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 ost::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.
Parameters:
Once CommandOption objects have completed parsing and there are no errors they may have some specific tasks to perform. PerformTask must return.
Parameters:
A short description of the option for Usage messages. e.g. Usage: mycommand : blah -f, --file <DESCRIPTION here>
This next CommandOption in this list of options or nil if no more options exist.
option letter, these will be preceded with '-' on the command line. e.g. -f foo.x
Long option name, these will be preceded with '--' on the command line. e.g. --file foo.x
This command option's OptionType.
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.
Generated automatically by Doxygen for GNU CommonC++ from the source code.
Wed Oct 31 2018 | GNU CommonC++ |