#include <CmdLine.h>
Inherits TCLAP::CmdLineInterface.
Public Member Functions | |
CmdLine (const std::string &name, const std::string &message, const std::string &version="none") | |
CmdLine (const std::string &message, const char delimiter= ' ', const std::string &version="none") | |
virtual | ~CmdLine () |
void | add (Arg &a) |
void | add (Arg *a) |
void | xorAdd (Arg &a, Arg &b) |
void | xorAdd (std::vector< Arg * > &xors) |
void | parse (int argc, char **argv) |
CmdLineOutput * | getOutput () |
void | setOutput (CmdLineOutput *co) |
std::string & | getVersion () |
std::string & | getProgramName () |
std::list< Arg * > & | getArgList () |
XorHandler & | getXorHandler () |
char | getDelimiter () |
std::string & | getMessage () |
Protected Member Functions | |
bool | _emptyCombined (const std::string &s) |
Protected Attributes | |
std::list< Arg * > | _argList |
std::string | _progName |
std::string | _message |
std::string | _version |
int | _numRequired |
char | _delimiter |
XorHandler | _xorHandler |
std::list< Arg * > | _argDeleteOnExitList |
std::list< Visitor * > | _visitorDeleteOnExitList |
CmdLineOutput * | _output |
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.
TCLAP::CmdLine::CmdLine | ( | const std::string & | name, | |
const std::string & | message, | |||
const std::string & | version = "none" | |||
) | [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. |
TCLAP::CmdLine::CmdLine | ( | const std::string & | message, | |
const char | delimiter = ' ' , |
|||
const std::string & | version = "none" | |||
) | [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. |
TCLAP::CmdLine::~CmdLine | ( | ) | [inline, virtual] |
Deletes any resources allocated by a CmdLine object.
bool TCLAP::CmdLine::_emptyCombined | ( | const std::string & | s | ) | [inline, protected] |
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. |
void TCLAP::CmdLine::add | ( | Arg * | a | ) | [inline, virtual] |
An alternative add. Functionally identical.
a | - Argument to be added. |
Implements TCLAP::CmdLineInterface.
void TCLAP::CmdLine::add | ( | Arg & | a | ) | [inline, virtual] |
Adds an argument to the list of arguments to be parsed.
a | - Argument to be added. |
Implements TCLAP::CmdLineInterface.
std::list< Arg * > & TCLAP::CmdLine::getArgList | ( | ) | [inline, virtual] |
Returns the argList.
Implements TCLAP::CmdLineInterface.
char TCLAP::CmdLine::getDelimiter | ( | ) | [inline, virtual] |
Returns the delimiter string.
Implements TCLAP::CmdLineInterface.
std::string & TCLAP::CmdLine::getMessage | ( | ) | [inline, virtual] |
Returns the message string.
Implements TCLAP::CmdLineInterface.
CmdLineOutput * TCLAP::CmdLine::getOutput | ( | ) | [inline, virtual] |
Returns the CmdLineOutput object.
Implements TCLAP::CmdLineInterface.
std::string & TCLAP::CmdLine::getProgramName | ( | ) | [inline, virtual] |
Returns the program name string.
Implements TCLAP::CmdLineInterface.
std::string & TCLAP::CmdLine::getVersion | ( | ) | [inline, virtual] |
Returns the version string.
Implements TCLAP::CmdLineInterface.
XorHandler & TCLAP::CmdLine::getXorHandler | ( | ) | [inline, virtual] |
Returns the XorHandler.
Implements TCLAP::CmdLineInterface.
void TCLAP::CmdLine::parse | ( | int | argc, | |
char ** | argv | |||
) | [inline, virtual] |
Parses the command line.
argc | - Number of arguments. | |
argv | - Array of arguments. |
Implements TCLAP::CmdLineInterface.
void TCLAP::CmdLine::setOutput | ( | CmdLineOutput * | co | ) | [inline, virtual] |
co | - CmdLineOutput object that we want to use instead. |
Implements TCLAP::CmdLineInterface.
void TCLAP::CmdLine::xorAdd | ( | std::vector< Arg * > & | xors | ) | [inline, virtual] |
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.
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.
std::list<Arg*> TCLAP::CmdLine::_argDeleteOnExitList [protected] |
A list of Args to be explicitly deleted when the destructor is called. At the moment, this only includes the three default Args.
std::list<Arg*> TCLAP::CmdLine::_argList [protected] |
The list of arguments that will be tested against the command line.
char TCLAP::CmdLine::_delimiter [protected] |
The character that is used to separate the argument flag/name from the value. Defaults to ' ' (space).
std::string TCLAP::CmdLine::_message [protected] |
A message used to describe the program. Used in the usage output.
int TCLAP::CmdLine::_numRequired [protected] |
The number of arguments that are required to be present on the command line. This is set dynamically, based on the Args added to the CmdLine object.
CmdLineOutput* TCLAP::CmdLine::_output [protected] |
Object that handles all output for the CmdLine.
std::string TCLAP::CmdLine::_progName [protected] |
The name of the program. Set to argv[0].
std::string TCLAP::CmdLine::_version [protected] |
The version to be displayed with the --version switch.
std::list<Visitor*> TCLAP::CmdLine::_visitorDeleteOnExitList [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.
XorHandler TCLAP::CmdLine::_xorHandler [protected] |
The handler that manages xoring lists of args.