tclap
1.4.0
|
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes. More...
#include <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... | |
ArgContainer & | add (Arg &a) |
Adds an argument to the list of arguments to be parsed. More... | |
ArgContainer & | add (Arg *a) |
An alternative add. More... | |
ArgContainer & | add (ArgGroup &args) |
Adds an argument group to the list of arguments to be parsed. More... | |
void | addToArgList (Arg *a) |
void | xorAdd (Arg &a, Arg &b) |
void | xorAdd (const std::vector< Arg *> &xors) |
void | parse (int argc, const char *const *argv) |
Parses the command line. More... | |
void | parse (std::vector< std::string > &args) |
Parses the command line. More... | |
void | setOutput (CmdLineOutput *co) |
std::string | getVersion () const |
Returns the version string. More... | |
std::string | getProgramName () const |
Returns the program name string. More... | |
std::list< Arg * > | getArgList () const |
std::list< ArgGroup * > | getArgGroups () |
Returns the list of ArgGroups. More... | |
char | getDelimiter () const |
Returns the delimiter string. More... | |
std::string | getMessage () const |
Returns the message string. More... | |
bool | hasHelpAndVersion () const |
Indicates whether or not the help and version switches were created automatically. More... | |
void | setExceptionHandling (const bool state) |
Disables or enables CmdLine's internal parsing exception handling. More... | |
bool | hasExceptionHandling () const |
Returns the current state of the internal exception handling. More... | |
void | reset () |
Allows the CmdLine object to be reused. More... | |
void | ignoreUnmatched (const bool ignore) |
Allows unmatched args to be ignored. More... | |
void | beginIgnoring () |
Begin ignoring arguments since the "--" argument was specified. More... | |
bool | ignoreRest () |
Whether to ignore the rest. More... | |
Public Member Functions inherited from TCLAP::CmdLineInterface | |
virtual | ~CmdLineInterface () |
Destructor. More... | |
void | parse (std::vector< std::string > &args) |
Parses the command line. More... | |
Public Member Functions inherited from TCLAP::ArgContainer | |
virtual | ~ArgContainer () |
Protected Member Functions | |
void | missingArgsException (const std::list< ArgGroup *> &missing) |
Throws an exception listing the missing args. More... | |
bool | _emptyCombined (const std::string &s) |
Checks whether a name/flag string matches entirely matches the Arg::blankChar. More... | |
Protected Attributes | |
std::list< Arg * > | _argList |
The list of arguments that will be tested against the command line. More... | |
StandaloneArgs | _standaloneArgs |
StandaloneArgs | _autoArgs |
std::list< ArgGroup * > | _argGroups |
Some args have set constraints on them (i.e., exactly or at most one must be specified. 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... | |
DeferDelete | _deleteOnExit |
Add pointers that should be deleted as part of cleanup when this object is destroyed. More... | |
StdOutput | _defaultOutput |
Default output handler if nothing is specified. More... | |
CmdLineOutput * | _output |
Object that handles all output for the CmdLine. More... | |
bool | _handleExceptions |
Should CmdLine handle parsing exceptions internally? More... | |
The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.
|
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. |
Definition at line 320 of file CmdLine.h.
References _autoArgs, _deleteOnExit, _delimiter, _output, _standaloneArgs, TCLAP::StandaloneArgs::add(), add(), addToArgList(), TCLAP::Arg::flagStartString(), TCLAP::Arg::ignoreNameString(), TCLAP::Arg::setDelimiter(), and TCLAP::ArgGroup::setParser().
|
inlinevirtual |
Deletes any resources allocated by a CmdLine object.
Definition at line 209 of file CmdLine.h.
References TCLAP::StandaloneArgs::add().
|
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. |
Definition at line 545 of file CmdLine.h.
References TCLAP::Arg::blankChar(), and TCLAP::Arg::flagStartChar().
Referenced by parse().
|
inlinevirtual |
Adds an argument to the list of arguments to be parsed.
a | - Argument to be added. |
A | reference to this so that add calls can be chained |
Implements TCLAP::CmdLineInterface.
Definition at line 405 of file CmdLine.h.
Referenced by CmdLine().
|
inlinevirtual |
An alternative add.
Functionally identical.
a | - Argument to be added. |
A | reference to this so that add calls can be chained |
Implements TCLAP::CmdLineInterface.
Definition at line 420 of file CmdLine.h.
References _standaloneArgs, TCLAP::StandaloneArgs::add(), and addToArgList().
|
inlinevirtual |
Adds an argument group to the list of arguments to be parsed.
All arguments in the group are added and the ArgGroup object will validate that the input matches its constraints.
args | - Argument group to be added. |
A | reference to this so that add calls can be chained |
Implements TCLAP::CmdLineInterface.
Definition at line 398 of file CmdLine.h.
References _argGroups, and TCLAP::ArgGroup::setParser().
|
inlinevirtual |
Implements TCLAP::CmdLineInterface.
Definition at line 409 of file CmdLine.h.
References _argList, _numRequired, TCLAP::Arg::addToList(), TCLAP::Arg::isRequired(), and TCLAP::Arg::longID().
Referenced by add(), and CmdLine().
|
inlinevirtual |
Begin ignoring arguments since the "--" argument was specified.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the list of ArgGroups.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the delimiter string.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the message string.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the program name string.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Returns the version string.
Implements TCLAP::CmdLineInterface.
|
inline |
|
inlinevirtual |
Indicates whether or not the help and version switches were created automatically.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Whether to ignore the rest.
Implements TCLAP::CmdLineInterface.
Definition at line 313 of file CmdLine.h.
Referenced by parse().
|
inline |
|
inlineprotected |
|
inlinevirtual |
Parses the command line.
argc | - Number of arguments. |
argv | - Array of arguments. |
Implements TCLAP::CmdLineInterface.
|
inline |
Parses the command line.
args | - A vector of strings representing the args. args[0] is still the program name. |
Definition at line 436 of file CmdLine.h.
References _argGroups, _argList, _emptyCombined(), _handleExceptions, _numRequired, _output, _progName, TCLAP::basename(), TCLAP::CmdLineOutput::failure(), TCLAP::ExitException::getExitStatus(), ignoreRest(), TCLAP::Arg::isIgnoreable(), TCLAP::Arg::isRequired(), TCLAP::Arg::isSet(), missingArgsException(), and TCLAP::Arg::processArg().
|
inlinevirtual |
|
inline |
Disables or enables CmdLine's internal parsing exception handling.
state | Should CmdLine handle parsing exceptions internally? |
Definition at line 589 of file CmdLine.h.
References _handleExceptions.
|
inlinevirtual |
co | - CmdLineOutput object that we want to use instead. |
Implements TCLAP::CmdLineInterface.
Definition at line 587 of file CmdLine.h.
References _output.
Implements TCLAP::CmdLineInterface.
|
inlinevirtual |
Implements TCLAP::CmdLineInterface.
Definition at line 381 of file CmdLine.h.
References _deleteOnExit, and TCLAP::ExclusiveArgGroup::add().
|
protected |
|
protected |
The list of arguments that will be tested against the command line.
Definition at line 88 of file CmdLine.h.
Referenced by addToArgList(), missingArgsException(), parse(), and reset().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Should CmdLine handle parsing exceptions internally?
Definition at line 147 of file CmdLine.h.
Referenced by parse(), and setExceptionHandling().
|
protected |
|
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.
Definition at line 119 of file CmdLine.h.
Referenced by addToArgList(), and parse().
|
protected |
|
protected |
|
protected |
|
protected |