![]() |
VR-Forces 5.0.3 Developer's Guide
|
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.
This version of CmdLine patches an invalid array access. See cmdLine/cmdLine.h in VR-Link for the original.

Public Member Functions | |
| CmdLine (const std::string &name, const std::string &message, const std::string &version="none", bool pressAnyKey=false) | |
| CmdLine (const std::string &message, const char delimiter= ' ', const std::string &version="none", bool pressAnyKey=false) | |
| virtual | ~CmdLine () |
| void | add (DtCmdLine::Arg &a) |
| void | add (DtCmdLine::Arg *a) |
| void | xorAdd (DtCmdLine::Arg &a, DtCmdLine::Arg &b) |
| void | xorAdd (std::vector< DtCmdLine::Arg * > &xors) |
| void | parse (int argc, char **argv, bool printOnError=true) |
| DtCmdLine::CmdLineOutput * | getOutput () |
| void | setOutput (DtCmdLine::CmdLineOutput *co) |
| std::string & | getVersion () |
| std::string & | getProgramName () |
| std::list< DtCmdLine::Arg * > & | getArgList () |
| DtCmdLine::XorHandler & | getXorHandler () |
| char | getDelimiter () |
| std::string & | getMessage () |
Protected Member Functions | |
| bool | _emptyCombined (const std::string &s) |
Protected Attributes | |
| std::list< DtCmdLine::Arg * > | _argList |
| std::string | _progName |
| std::string | _message |
| std::string | _version |
| int | _numRequired |
| char | _delimiter |
| DtCmdLine::XorHandler | _xorHandler |
| std::list< DtCmdLine::Arg * > | _argDeleteOnExitList |
| std::list< DtCmdLine::Visitor * > | _visitorDeleteOnExitList |
| DtCmdLine::CmdLineOutput * | _output |
| bool | myPressAnyKey |
Private Member Functions | |
| void | _constructor () |
| void | deleteOnExit (DtCmdLine::Arg *ptr) |
| void | deleteOnExit (DtCmdLine::Visitor *ptr) |
Private Attributes | |
| bool | _userSetOutput |
|
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.
|
inlineprotected |
|
inlineprivate |
Encapsulates the code common to the constructors (which is all of it).
References _delimiter, _output, add(), deleteOnExit(), and myPressAnyKey.
Referenced by CmdLine().
|
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.
|
inline |
Adds an argument to the list of arguments to be parsed.
| a | - Argument to be added. |
Referenced by _constructor(), and xorAdd().
|
inline |
An alternative add.
Functionally identical.
| a | - Argument to be added. |
References _argList, and _numRequired.
|
inline |
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. |
|
inline |
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. |
References _xorHandler, and add().
Parses the command line.
| argc | - Number of arguments. |
| argv | - Array of arguments. |
References _argList, _emptyCombined(), _numRequired, _output, _progName, _xorHandler, int(), and myPressAnyKey.
|
inline |
References _output.
|
inline |
References _output, and _userSetOutput.
|
inline |
References _version.
|
inline |
References _progName.
|
inline |
References _argList.
|
inline |
References _xorHandler.
|
inline |
References _delimiter.
|
inline |
References _message.
|
protected |
The list of arguments that will be tested against the command line.
Referenced by add(), getArgList(), and parse().
|
protected |
|
protected |
|
protected |
The version to be displayed with the –version switch.
Referenced by getVersion().
|
protected |
|
protected |
The character that is used to separate the argument flag/name from the value.
Defaults to ' ' (space).
Referenced by _constructor(), and getDelimiter().
|
protected |
The handler that manages xoring lists of args.
Referenced by getXorHandler(), parse(), and xorAdd().
|
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 |
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 |
Object that handles all output for the CmdLine.
Referenced by _constructor(), getOutput(), parse(), setOutput(), and ~CmdLine().
|
protected |
Referenced by _constructor(), and parse().
|
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().