#include <CmdLine.h>
Public Member Functions | |
| void | add (Arg *a) |
| void | add (Arg &a) |
| CmdLine (const std::string &message, const char delimiter= ' ', const std::string &version="none", bool helpAndVersion=true) | |
| std::list< Arg * > & | getArgList () |
| char | getDelimiter () |
| std::string & | getMessage () |
| CmdLineOutput * | getOutput () |
| std::string & | getProgramName () |
| std::string & | getVersion () |
| XorHandler & | getXorHandler () |
| bool | hasHelpAndVersion () |
| void | parse (int argc, char **argv) |
| void | setOutput (CmdLineOutput *co) |
| void | xorAdd (std::vector< Arg * > &xors) |
| void | xorAdd (Arg &a, Arg &b) |
| virtual | ~CmdLine () |
Protected Member Functions | |
| bool | _emptyCombined (const std::string &s) |
| void | deleteOnExit (Visitor *ptr) |
| void | deleteOnExit (Arg *ptr) |
Protected Attributes | |
| std::list< Arg * > | _argDeleteOnExitList |
| std::list< Arg * > | _argList |
| char | _delimiter |
| std::string | _message |
| int | _numRequired |
| CmdLineOutput * | _output |
| std::string | _progName |
| std::string | _version |
| std::list< Visitor * > | _visitorDeleteOnExitList |
| XorHandler | _xorHandler |
Private Member Functions | |
| void | _constructor () |
Private Attributes | |
| bool | _helpAndVersion |
| bool | _userSetOutput |
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 & | message, | |
| const char | delimiter = ' ', |
|||
| const std::string & | version = "none", |
|||
| bool | helpAndVersion = true | |||
| ) | [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. |
References _constructor().
| TCLAP::CmdLine::~CmdLine | ( | ) | [inline, virtual] |
Deletes any resources allocated by a CmdLine object.
References _argDeleteOnExitList, _output, _userSetOutput, and _visitorDeleteOnExitList.
| void TCLAP::CmdLine::_constructor | ( | ) | [inline, private] |
Encapsulates the code common to the constructors (which is all of it).
References _delimiter, _helpAndVersion, _output, add(), deleteOnExit(), TCLAP::Arg::flagStartString(), TCLAP::Arg::ignoreNameString(), and TCLAP::Arg::setDelimiter().
Referenced by CmdLine().
| 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. |
References TCLAP::Arg::blankChar(), and TCLAP::Arg::flagStartChar().
Referenced by parse().
| void TCLAP::CmdLine::add | ( | Arg * | a | ) | [inline, virtual] |
An alternative add. Functionally identical.
| a | - Argument to be added. |
Implements TCLAP::CmdLineInterface.
References _argList, _numRequired, TCLAP::Arg::addToList(), TCLAP::Arg::isRequired(), and TCLAP::Arg::longID().
| 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.
Referenced by _constructor(), main(), parseOptions(), and xorAdd().
| void TCLAP::CmdLine::deleteOnExit | ( | Visitor * | ptr | ) | [inline, protected] |
Perform a delete ptr; operation on ptr when this object is deleted.
References _visitorDeleteOnExitList.
| void TCLAP::CmdLine::deleteOnExit | ( | Arg * | ptr | ) | [inline, protected] |
Perform a delete ptr; operation on ptr when this object is deleted.
References _argDeleteOnExitList.
Referenced by _constructor().
| std::list< Arg * > & TCLAP::CmdLine::getArgList | ( | ) | [inline, virtual] |
| char TCLAP::CmdLine::getDelimiter | ( | ) | [inline, virtual] |
| std::string & TCLAP::CmdLine::getMessage | ( | ) | [inline, virtual] |
| CmdLineOutput * TCLAP::CmdLine::getOutput | ( | ) | [inline, virtual] |
| std::string & TCLAP::CmdLine::getProgramName | ( | ) | [inline, virtual] |
| std::string & TCLAP::CmdLine::getVersion | ( | ) | [inline, virtual] |
| XorHandler & TCLAP::CmdLine::getXorHandler | ( | ) | [inline, virtual] |
| bool TCLAP::CmdLine::hasHelpAndVersion | ( | ) | [inline, virtual] |
Indicates whether or not the help and version switches were created automatically.
Implements TCLAP::CmdLineInterface.
References _helpAndVersion.
Parses the command line.
| argc | - Number of arguments. | |
| argv | - Array of arguments. |
Implements TCLAP::CmdLineInterface.
References _argList, _emptyCombined(), _numRequired, _output, _progName, _xorHandler, TCLAP::XorHandler::check(), exit, TCLAP::CmdLineOutput::failure(), and TCLAP::Arg::ignoreRest().
Referenced by main(), and parseOptions().
| void TCLAP::CmdLine::setOutput | ( | CmdLineOutput * | co | ) | [inline, virtual] |
| co | - CmdLineOutput object that we want to use instead. |
Implements TCLAP::CmdLineInterface.
References _output, and _userSetOutput.
Referenced by parseOptions().
| 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.
References _xorHandler, add(), and TCLAP::XorHandler::add().
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.
Referenced by parseOptions().
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.
Referenced by deleteOnExit(), and ~CmdLine().
std::list<Arg*> TCLAP::CmdLine::_argList [protected] |
The list of arguments that will be tested against the command line.
Referenced by add(), getArgList(), and parse().
char TCLAP::CmdLine::_delimiter [protected] |
The character that is used to separate the argument flag/name from the value. Defaults to ' ' (space).
Referenced by _constructor(), and getDelimiter().
bool TCLAP::CmdLine::_helpAndVersion [private] |
Whether or not to automatically create help and version switches.
Referenced by _constructor(), and hasHelpAndVersion().
std::string TCLAP::CmdLine::_message [protected] |
A message used to describe the program. Used in the usage output.
Referenced by getMessage().
int TCLAP::CmdLine::_numRequired [protected] |
CmdLineOutput* TCLAP::CmdLine::_output [protected] |
Object that handles all output for the CmdLine.
Referenced by _constructor(), getOutput(), parse(), setOutput(), and ~CmdLine().
std::string TCLAP::CmdLine::_progName [protected] |
The name of the program. Set to argv[0].
Referenced by getProgramName(), and parse().
bool TCLAP::CmdLine::_userSetOutput [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().
std::string TCLAP::CmdLine::_version [protected] |
The version to be displayed with the --version switch.
Referenced by getVersion().
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.
Referenced by deleteOnExit(), and ~CmdLine().
XorHandler TCLAP::CmdLine::_xorHandler [protected] |
The handler that manages xoring lists of args.
Referenced by getXorHandler(), parse(), and xorAdd().
1.6.1