UniversalIndentGUI 1.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
TCLAP::CmdLine Class Reference

#include <CmdLine.h>

Inheritance diagram for TCLAP::CmdLine:
Inheritance graph
[legend]

List of all members.

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 ()
bool getExceptionHandling () const
std::string & getMessage ()
CmdLineOutputgetOutput ()
std::string & getProgramName ()
std::string & getVersion ()
XorHandlergetXorHandler ()
bool hasHelpAndVersion ()
void parse (std::vector< std::string > &args)
void parse (int argc, const char *const *argv)
void reset ()
void setExceptionHandling (const bool state)
void setOutput (CmdLineOutput *co)
void xorAdd (Arg &a, Arg &b)
void xorAdd (std::vector< Arg * > &xors)
virtual ~CmdLine ()

Protected Member Functions

bool _emptyCombined (const std::string &s)
void deleteOnExit (Visitor *ptr)
void deleteOnExit (Arg *ptr)
void missingArgsException ()

Protected Attributes

std::list< Arg * > _argDeleteOnExitList
std::list< Arg * > _argList
char _delimiter
bool _handleExceptions
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

Detailed Description

The base class that manages the command line definition and passes along the parsing to the appropriate Arg classes.

Definition at line 70 of file CmdLine.h.


Constructor & Destructor Documentation

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.

Parameters:
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 317 of file CmdLine.h.

References _constructor().

Here is the call graph for this function:

TCLAP::CmdLine::~CmdLine ( ) [inline, virtual]

Deletes any resources allocated by a CmdLine object.

Definition at line 333 of file CmdLine.h.

References _argDeleteOnExitList, _output, _userSetOutput, _visitorDeleteOnExitList, and TCLAP::ClearContainer().

Here is the call graph for this function:


Member Function Documentation

void TCLAP::CmdLine::_constructor ( ) [inline, private]

Encapsulates the code common to the constructors (which is all of it).

Definition at line 344 of file CmdLine.h.

References _delimiter, _helpAndVersion, _output, add(), deleteOnExit(), TCLAP::Arg::flagStartString(), TCLAP::Arg::ignoreNameString(), and TCLAP::Arg::setDelimiter().

Referenced by CmdLine().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
s- The message to be used in the usage.

Definition at line 499 of file CmdLine.h.

References TCLAP::Arg::blankChar(), and TCLAP::Arg::flagStartChar().

Referenced by parse().

Here is the call graph for this function:

Here is the caller graph for this function:

void TCLAP::CmdLine::add ( Arg a) [inline, virtual]

Adds an argument to the list of arguments to be parsed.

Parameters:
a- Argument to be added.

Implements TCLAP::CmdLineInterface.

Definition at line 402 of file CmdLine.h.

Referenced by _constructor(), main(), and xorAdd().

Here is the caller graph for this function:

void TCLAP::CmdLine::add ( Arg a) [inline, virtual]

An alternative add. Functionally identical.

Parameters:
a- Argument to be added.

Implements TCLAP::CmdLineInterface.

Definition at line 407 of file CmdLine.h.

References _argList, _numRequired, TCLAP::Arg::addToList(), TCLAP::Arg::isRequired(), and TCLAP::Arg::longID().

Here is the call graph for this function:

void TCLAP::CmdLine::deleteOnExit ( Visitor ptr) [inline, protected]

Perform a delete ptr; operation on ptr when this object is deleted.

Definition at line 543 of file CmdLine.h.

References _visitorDeleteOnExitList.

void TCLAP::CmdLine::deleteOnExit ( Arg ptr) [inline, protected]

Perform a delete ptr; operation on ptr when this object is deleted.

Definition at line 538 of file CmdLine.h.

References _argDeleteOnExitList.

Referenced by _constructor().

Here is the caller graph for this function:

std::list< Arg * > & TCLAP::CmdLine::getArgList ( ) [inline, virtual]

Returns the argList.

Implements TCLAP::CmdLineInterface.

Definition at line 569 of file CmdLine.h.

References _argList.

char TCLAP::CmdLine::getDelimiter ( ) [inline, virtual]

Returns the delimiter string.

Implements TCLAP::CmdLineInterface.

Definition at line 579 of file CmdLine.h.

References _delimiter.

bool TCLAP::CmdLine::getExceptionHandling ( ) const [inline]

Returns the current state of the internal exception handling.

Return values:
trueParsing exceptions are handled internally.
falseParsing exceptions are propagated to the caller.

Definition at line 599 of file CmdLine.h.

References _handleExceptions.

std::string & TCLAP::CmdLine::getMessage ( ) [inline, virtual]

Returns the message string.

Implements TCLAP::CmdLineInterface.

Definition at line 584 of file CmdLine.h.

References _message.

CmdLineOutput * TCLAP::CmdLine::getOutput ( ) [inline, virtual]

Returns the CmdLineOutput object.

Implements TCLAP::CmdLineInterface.

Definition at line 548 of file CmdLine.h.

References _output.

std::string & TCLAP::CmdLine::getProgramName ( ) [inline, virtual]

Returns the program name string.

Implements TCLAP::CmdLineInterface.

Definition at line 564 of file CmdLine.h.

References _progName.

std::string & TCLAP::CmdLine::getVersion ( ) [inline, virtual]

Returns the version string.

Implements TCLAP::CmdLineInterface.

Definition at line 559 of file CmdLine.h.

References _version.

XorHandler & TCLAP::CmdLine::getXorHandler ( ) [inline, virtual]

Returns the XorHandler.

Implements TCLAP::CmdLineInterface.

Definition at line 574 of file CmdLine.h.

References _xorHandler.

bool TCLAP::CmdLine::hasHelpAndVersion ( ) [inline, virtual]

Indicates whether or not the help and version switches were created automatically.

Implements TCLAP::CmdLineInterface.

Definition at line 589 of file CmdLine.h.

References _helpAndVersion.

void TCLAP::CmdLine::missingArgsException ( ) [inline, protected]

Throws an exception listing the missing args.

Definition at line 511 of file CmdLine.h.

References _argList.

Referenced by parse().

Here is the caller graph for this function:

void TCLAP::CmdLine::parse ( std::vector< std::string > &  args) [inline]

Parses the command line.

Parameters:
args- A vector of strings representing the args. args[0] is still the program name.

Reimplemented from TCLAP::CmdLineInterface.

Definition at line 433 of file CmdLine.h.

References _argList, _emptyCombined(), _handleExceptions, _numRequired, _output, _progName, _xorHandler, TCLAP::XorHandler::check(), TCLAP::CmdLineOutput::failure(), TCLAP::ExitException::getExitStatus(), TCLAP::Arg::ignoreRest(), and missingArgsException().

Here is the call graph for this function:

void TCLAP::CmdLine::parse ( int  argc,
const char *const *  argv 
) [inline, virtual]

Parses the command line.

Parameters:
argc- Number of arguments.
argv- Array of arguments.

Implements TCLAP::CmdLineInterface.

Definition at line 422 of file CmdLine.h.

Referenced by main().

Here is the caller graph for this function:

void TCLAP::CmdLine::reset ( ) [inline, virtual]

Allows the CmdLine object to be reused.

Implements TCLAP::CmdLineInterface.

Definition at line 604 of file CmdLine.h.

References _argList, and _progName.

void TCLAP::CmdLine::setExceptionHandling ( const bool  state) [inline]

Disables or enables CmdLine's internal parsing exception handling.

Parameters:
stateShould CmdLine handle parsing exceptions internally?

Definition at line 594 of file CmdLine.h.

References _handleExceptions.

Referenced by main().

Here is the caller graph for this function:

void TCLAP::CmdLine::setOutput ( CmdLineOutput co) [inline, virtual]
Parameters:
co- CmdLineOutput object that we want to use instead.

Implements TCLAP::CmdLineInterface.

Definition at line 553 of file CmdLine.h.

References _output, and _userSetOutput.

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.

Parameters:
xors- List of Args to be added and xor'd.

Implements TCLAP::CmdLineInterface.

Definition at line 381 of file CmdLine.h.

References _xorHandler, add(), and TCLAP::XorHandler::add().

Here is the call graph for this function:

void TCLAP::CmdLine::xorAdd ( Arg a,
Arg b 
) [inline, virtual]

Add two Args that will be xor'd. If this method is used, add does not need to be called.

Parameters:
a- Argument to be added and xor'd.
b- Argument to be added and xor'd.

Implements TCLAP::CmdLineInterface.

Definition at line 394 of file CmdLine.h.


Member Data Documentation

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.

Definition at line 118 of file CmdLine.h.

Referenced by deleteOnExit(), and ~CmdLine().

std::list<Arg*> TCLAP::CmdLine::_argList [protected]

The list of arguments that will be tested against the command line.

Definition at line 78 of file CmdLine.h.

Referenced by add(), getArgList(), missingArgsException(), parse(), and reset().

char TCLAP::CmdLine::_delimiter [protected]

The character that is used to separate the argument flag/name from the value. Defaults to ' ' (space).

Definition at line 106 of file CmdLine.h.

Referenced by _constructor(), and getDelimiter().

Should CmdLine handle parsing exceptions internally?

Definition at line 135 of file CmdLine.h.

Referenced by getExceptionHandling(), parse(), and setExceptionHandling().

Whether or not to automatically create help and version switches.

Definition at line 178 of file CmdLine.h.

Referenced by _constructor(), and hasHelpAndVersion().

std::string TCLAP::CmdLine::_message [protected]

A message used to describe the program. Used in the usage output.

Definition at line 88 of file CmdLine.h.

Referenced by getMessage().

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 100 of file CmdLine.h.

Referenced by add(), and parse().

Object that handles all output for the CmdLine.

Definition at line 130 of file CmdLine.h.

Referenced by _constructor(), getOutput(), parse(), setOutput(), and ~CmdLine().

std::string TCLAP::CmdLine::_progName [protected]

The name of the program. Set to argv[0].

Definition at line 83 of file CmdLine.h.

Referenced by getProgramName(), parse(), and reset().

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.

Definition at line 173 of file CmdLine.h.

Referenced by setOutput(), and ~CmdLine().

std::string TCLAP::CmdLine::_version [protected]

The version to be displayed with the --version switch.

Definition at line 93 of file CmdLine.h.

Referenced by getVersion().

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.

Definition at line 125 of file CmdLine.h.

Referenced by deleteOnExit(), and ~CmdLine().

The handler that manages xoring lists of args.

Definition at line 111 of file CmdLine.h.

Referenced by getXorHandler(), parse(), and xorAdd().


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines