![]() |
VR-Link API Documentation for HLA 1.3
|
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes. More...
Inheritance diagram for DtCmdLine::CmdLine:
Collaboration diagram for DtCmdLine::CmdLine:Public Member Functions | |
| CmdLine (const std::string &name, const std::string &message, const std::string &version="none", bool pressAnyKey=false) | |
| Command line constructor. | |
| CmdLine (const std::string &message, const char delimiter= ' ', const std::string &version="none", bool pressAnyKey=false) | |
| Command line constructor. | |
| virtual | ~CmdLine () |
| Deletes any resources allocated by a CmdLine object. | |
| void | add (Arg &a) |
| Adds an argument to the list of arguments to be parsed. | |
| void | add (Arg *a) |
| An alternative add. | |
| void | xorAdd (Arg &a, Arg &b) |
| Add two Args that will be xor'd. | |
| void | xorAdd (std::vector< Arg * > &xors) |
| Add a list of Args that will be xor'd. | |
| void | parse (int argc, char **argv) |
| Parses the command line. | |
| CmdLineOutput * | getOutput () |
| Returns the CmdLineOutput object. | |
| void | setOutput (CmdLineOutput *co) |
| std::string & | getVersion () |
| Returns the version string. | |
| std::string & | getProgramName () |
| Returns the program name string. | |
| std::list< Arg * > & | getArgList () |
| Returns the argList. | |
| XorHandler & | getXorHandler () |
| Returns the XorHandler. | |
| char | getDelimiter () |
| Returns the delimiter string. | |
| std::string & | getMessage () |
| Returns the message string. | |
Public Member Functions inherited from DtCmdLine::CmdLineInterface | |
| virtual | ~CmdLineInterface () |
| Destructor. | |
Protected Member Functions | |
| bool | _emptyCombined (const std::string &s) |
| Checks whether a name/flag string matches entirely matches the Arg::blankChar. | |
Protected Attributes | |
| std::list< Arg * > | _argList |
| The list of arguments that will be tested against the command line. | |
| std::string | _progName |
| The name of the program. | |
| std::string | _message |
| A message used to describe the program. | |
| std::string | _version |
| The version to be displayed with the –version switch. | |
| int | _numRequired |
| The number of arguments that are required to be present on the command line. | |
| char | _delimiter |
| The character that is used to separate the argument flag/name from the value. | |
| XorHandler | _xorHandler |
| The handler that manages xoring lists of args. | |
| std::list< Arg * > | _argDeleteOnExitList |
| A list of Args to be explicitly deleted when the destructor is called. | |
| std::list< Visitor * > | _visitorDeleteOnExitList |
| A list of Visitors to be explicitly deleted when the destructor is called. | |
| CmdLineOutput * | _output |
| Object that handles all output for the CmdLine. | |
| bool | myPressAnyKey |
Private Member Functions | |
| void | _constructor () |
| Encapsulates the code common to the constructors (which is all of it). | |
| void | deleteOnExit (Arg *ptr) |
| Perform a delete ptr; operation on ptr when this object is deleted. | |
| void | deleteOnExit (Visitor *ptr) |
| Perform a delete ptr; operation on ptr when this object is deleted. | |
Private Attributes | |
| bool | _userSetOutput |
| Is set to true when a user sets the output object. | |
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.
|
inline |
Command line constructor.
DEPRECATED!!! This is here to maintain backwards compatibility with earlier releases. Note that the program name will be overwritten with argv[0]. The delimiter used is ' ' (as before).
| name | - The program name - will be overwritten with argv[0]. |
| message | - The message to be used in the usage output. |
| version | - The version number to be used in the –version switch. |
References _constructor().
|
inline |
Command line constructor.
Defines how the arguments will be parsed.
| message | - The message to be used in the usage output. |
| delimiter | - The character that is used to separate the argument flag/name from the value. Defaults to ' ' (space). |
| version | - The version number to be used in the –version switch. |
References _constructor().
|
inlinevirtual |
Deletes any resources allocated by a CmdLine object.
References _argDeleteOnExitList, _output, _userSetOutput, and _visitorDeleteOnExitList.
|
inlineprivate |
Encapsulates the code common to the constructors (which is all of it).
References _delimiter, _output, add(), deleteOnExit(), DtCmdLine::Arg::flagStartString(), DtCmdLine::Arg::ignoreNameString(), myPressAnyKey, and DtCmdLine::Arg::setDelimiter().
Referenced by CmdLine().
|
inlineprotected |
Checks whether a name/flag string matches entirely matches the Arg::blankChar.
Used when multiple switches are combined into a single argument.
| s | - The message to be used in the usage. |
References DtCmdLine::Arg::blankChar(), and DtCmdLine::Arg::flagStartChar().
Referenced by parse().
|
inlinevirtual |
Adds an argument to the list of arguments to be parsed.
| a | - Argument to be added. |
Implements DtCmdLine::CmdLineInterface.
Referenced by _constructor(), and xorAdd().
|
inlinevirtual |
An alternative add.
Functionally identical.
| a | - Argument to be added. |
Implements DtCmdLine::CmdLineInterface.
References _argList, _numRequired, DtCmdLine::Arg::addToList(), DtCmdLine::Arg::isRequired(), and DtCmdLine::Arg::longID().
|
inlineprivate |
Perform a delete ptr; operation on ptr when this object is deleted.
References _argDeleteOnExitList.
Referenced by _constructor().
|
inlineprivate |
Perform a delete ptr; operation on ptr when this object is deleted.
References _visitorDeleteOnExitList.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Parses the command line.
| argc | - Number of arguments. |
| argv | - Array of arguments. |
Implements DtCmdLine::CmdLineInterface.
References _argList, _emptyCombined(), _numRequired, _output, _progName, _xorHandler, DtCmdLine::XorHandler::check(), DtInfo, DtNotifyLevel, DtPollBlockingInputChar(), DtSleep(), DtCmdLine::CmdLineOutput::failure(), DtCmdLine::Arg::ignoreRest(), and myPressAnyKey.
|
inlinevirtual |
| co | - CmdLineOutput object that we want to use instead. |
Implements DtCmdLine::CmdLineInterface.
References _output, and _userSetOutput.
Add two Args that will be xor'd.
If this method is used, add does not need to be called.
| a | - Argument to be added and xor'd. |
| b | - Argument to be added and xor'd. |
Implements DtCmdLine::CmdLineInterface.
|
inlinevirtual |
Add a list of Args that will be xor'd.
If this method is used, add does not need to be called.
| xors | - List of Args to be added and xor'd. |
Implements DtCmdLine::CmdLineInterface.
References _xorHandler, DtCmdLine::XorHandler::add(), and add().
|
protected |
A list of Args to be explicitly deleted when the destructor is called.
At the moment, this only includes the three default Args.
Referenced by deleteOnExit(), and ~CmdLine().
|
protected |
The list of arguments that will be tested against the command line.
Referenced by add(), getArgList(), and parse().
|
protected |
The character that is used to separate the argument flag/name from the value.
Defaults to ' ' (space).
Referenced by _constructor(), and getDelimiter().
|
protected |
|
protected |
|
protected |
Object that handles all output for the CmdLine.
Referenced by _constructor(), getOutput(), parse(), setOutput(), and ~CmdLine().
|
protected |
|
private |
Is set to true when a user sets the output object.
We use this so that we don't delete objects that are created outside of this lib.
Referenced by setOutput(), and ~CmdLine().
|
protected |
The version to be displayed with the –version switch.
Referenced by getVersion().
|
protected |
A list of Visitors to be explicitly deleted when the destructor is called.
At the moment, these are the Vistors created for the default Args.
Referenced by deleteOnExit(), and ~CmdLine().
|
protected |
The handler that manages xoring lists of args.
Referenced by getXorHandler(), parse(), and xorAdd().
|
protected |
Referenced by _constructor(), and parse().