The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.
#include <mrpt/otherlibs/tclap/CmdLine.h>
Public Member Functions | |
CmdLine (const std::string &message, const char delimiter=' ', const std::string &version="none", bool helpAndVersion=true) | |
Command line constructor. More... | |
virtual | ~CmdLine () |
Deletes any resources allocated by a CmdLine object. More... | |
void | add (Arg &a) |
Adds an argument to the list of arguments to be parsed. More... | |
void | add (Arg *a) |
An alternative add. More... | |
void | xorAdd (Arg &a, Arg &b) |
Add two Args that will be xor'd. More... | |
void | xorAdd (std::vector< Arg * > &xors) |
Add a list of Args that will be xor'd. More... | |
bool | parse (int argc, char **argv) |
Parses the command line. More... | |
CmdLineOutput * | getOutput () |
Returns the CmdLineOutput object. More... | |
void | setOutput (CmdLineOutput *co) |
std::string & | getVersion () |
Returns the version string. More... | |
std::string & | getProgramName () |
Returns the program name string. More... | |
std::list< Arg * > & | getArgList () |
Returns the argList. More... | |
XorHandler & | getXorHandler () |
Returns the XorHandler. More... | |
char | getDelimiter () |
Returns the delimiter string. More... | |
std::string & | getMessage () |
Returns the message string. More... | |
bool | hasHelpAndVersion () |
Indicates whether or not the help and version switches were created automatically. More... | |
Protected Member Functions | |
bool | _emptyCombined (const std::string &s) |
Checks whether a name/flag string matches entirely matches the Arg::blankChar. More... | |
void | deleteOnExit (Arg *ptr) |
Perform a delete ptr; operation on ptr when this object is deleted. More... | |
void | deleteOnExit (Visitor *ptr) |
Perform a delete ptr; operation on ptr when this object is deleted. More... | |
Protected Attributes | |
std::list< Arg * > | _argList |
The list of arguments that will be tested against the command line. More... | |
std::string | _progName |
The name of the program. More... | |
std::string | _message |
A message used to describe the program. More... | |
std::string | _version |
The version to be displayed with the –version switch. More... | |
int | _numRequired |
The number of arguments that are required to be present on the command line. More... | |
char | _delimiter |
The character that is used to separate the argument flag/name from the value. More... | |
XorHandler | _xorHandler |
The handler that manages xoring lists of args. More... | |
std::list< Arg * > | _argDeleteOnExitList |
A list of Args to be explicitly deleted when the destructor is called. More... | |
std::list< Visitor * > | _visitorDeleteOnExitList |
A list of Visitors to be explicitly deleted when the destructor is called. More... | |
CmdLineOutput * | _output |
Object that handles all output for the CmdLine. More... | |
Private Member Functions | |
void | _constructor () |
Encapsulates the code common to the constructors (which is all of it). More... | |
Private Attributes | |
bool | _userSetOutput |
Is set to true when a user sets the output object. More... | |
bool | _helpAndVersion |
Whether or not to automatically create help and version switches. More... | |
|
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. |
helpAndVersion | - Whether or not to create the Help and Version switches. Defaults to true. |
|
inlinevirtual |
Deletes any resources allocated by a CmdLine object.
Definition at line 306 of file CmdLine.h.
References _delimiter, _helpAndVersion, _output, add(), deleteOnExit(), and TCLAP::Arg::setDelimiter().
|
inlineprivate |
|
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. |
|
inlinevirtual |
Adds an argument to the list of arguments to be parsed.
a | - Argument to be added. |
Implements TCLAP::CmdLineInterface.
Definition at line 383 of file CmdLine.h.
References _progName.
Referenced by ~CmdLine().
|
inlinevirtual |
An alternative add.
Functionally identical.
a | - Argument to be added. |
Implements TCLAP::CmdLineInterface.
Definition at line 388 of file CmdLine.h.
References _argList.
|
inlineprotected |
Perform a delete ptr; operation on ptr when this object is deleted.
Definition at line 470 of file CmdLine.h.
Referenced by ~CmdLine().
|
inlineprotected |
|
inlinevirtual |
Returns the argList.
Implements TCLAP::CmdLineInterface.
Definition at line 501 of file CmdLine.h.
References _helpAndVersion.
|
inlinevirtual |
Returns the delimiter string.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the message string.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the CmdLineOutput object.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the program name string.
Implements TCLAP::CmdLineInterface.
Definition at line 496 of file CmdLine.h.
References _message.
|
inlinevirtual |
Returns the version string.
Implements TCLAP::CmdLineInterface.
Definition at line 491 of file CmdLine.h.
References _delimiter.
|
inlinevirtual |
Returns the XorHandler.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Indicates whether or not the help and version switches were created automatically.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Parses the command line.
argc | - Number of arguments. |
argv | - Array of arguments. |
Implements TCLAP::CmdLineInterface.
Definition at line 402 of file CmdLine.h.
References _xorHandler, and TCLAP::XorHandler::check().
|
inlinevirtual |
co | - CmdLineOutput object that we want to use instead. |
Implements TCLAP::CmdLineInterface.
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 TCLAP::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 TCLAP::CmdLineInterface.
|
protected |
|
protected |
|
protected |
The character that is used to separate the argument flag/name from the value.
Defaults to ' ' (space).
Definition at line 137 of file CmdLine.h.
Referenced by getVersion(), and ~CmdLine().
|
private |
Whether or not to automatically create help and version switches.
Definition at line 198 of file CmdLine.h.
Referenced by getArgList(), and ~CmdLine().
|
protected |
A message used to describe the program.
Used in the usage output.
Definition at line 119 of file CmdLine.h.
Referenced by getProgramName().
|
protected |
|
protected |
Object that handles all output for the CmdLine.
Definition at line 161 of file CmdLine.h.
Referenced by ~CmdLine().
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Sat Jan 18 22:37:07 UTC 2020 |