#include <CmdLine.h>
Inheritance diagram for TCLAP::CmdLine:


Public Member Functions | |
| CmdLine (const std::string &name, const std::string &message, const std::string &version="none") | |
| Command line constructor. | |
| CmdLine (const std::string &message, const char delimiter= ' ', const std::string &version="none") | |
| Command line constructor. | |
| virtual | ~CmdLine () |
| Deletes any resources allocated by a CmdLine object. | |
| void | add (Arg &a) |
| Adds an argument to the list of arguments to be parsed. | |
| void | add (Arg *a) |
| An alternative add. | |
| void | xorAdd (Arg &a, Arg &b) |
| Add two Args that will be xor'd. | |
| void | xorAdd (std::vector< Arg * > &xors) |
| Add a list of Args that will be xor'd. | |
| virtual void | usage (int exitVal=0) |
| Prints the usage to stdout and exits. | |
| virtual void | version (int exitVal=0) |
| Prints the version to stdout and exits. | |
| virtual void | failure (const ArgException &e) |
| Prints (to stderr) an error message, short usage and exits with a value of 1. | |
| void | parse (int argc, char **argv) |
| Parses the command line. | |
Protected Member Functions | |
| bool | _emptyCombined (const std::string &s) |
| Checks whether a name/flag string matches entirely matches the Arg::blankChar. | |
| void | _shortUsage (std::ostream &os) |
| Writes a brief usage message with short args. | |
| void | _longUsage (std::ostream &os) |
| Writes a longer usage message with long and short args, provides descriptions and prints message. | |
Protected Attributes | |
| std::list< Arg * > | _argList |
| The list of arguments that will be tested against the command line. | |
| std::string | _progName |
| The name of the program. | |
| std::string | _message |
| A message used to describe the program. | |
| std::string | _version |
| The version to be displayed with the --version switch. | |
| int | _numRequired |
| The number of arguments that are required to be present on the command line. | |
| char | _delimiter |
| The character that is used to separate the argument flag/name from the value. | |
| XorHandler | _xorHandler |
| The handler that manages xoring lists of args. | |
| std::list< Arg * > | _argDeleteOnExitList |
| A list of Args to be explicitly deleted when the destructor is called. | |
| std::list< Visitor * > | _visitorDeleteOnExitList |
| A list of Visitors to be explicitly deleted when the destructor is called. | |
Private Member Functions | |
| void | _constructor () |
| Encapsulates the code common to the constructors (which is all of it). | |
| void | deleteOnExit (Arg *ptr) |
| Perform a delete ptr; operation on ptr when this object is deleted. | |
| void | deleteOnExit (Visitor *ptr) |
| Perform a delete ptr; operation on ptr when this object is deleted. | |
| 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.
| void TCLAP::CmdLine::_constructor | ( | ) | [inline, private] |
Encapsulates the code common to the constructors (which is all of it).
| 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::_longUsage | ( | std::ostream & | os | ) | [inline, protected] |
Writes a longer usage message with long and short args, provides descriptions and prints message.
| os | - The stream to write the message to. |
| void TCLAP::CmdLine::_shortUsage | ( | std::ostream & | os | ) | [inline, protected] |
Writes a brief usage message with short args.
| os | - The stream to write the message to. |
| 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.
| void TCLAP::CmdLine::deleteOnExit | ( | Visitor * | ptr | ) | [inline, private] |
Perform a delete ptr; operation on ptr when this object is deleted.
| void TCLAP::CmdLine::deleteOnExit | ( | Arg * | ptr | ) | [inline, private] |
Perform a delete ptr; operation on ptr when this object is deleted.
| void TCLAP::CmdLine::failure | ( | const ArgException & | e | ) | [inline, virtual] |
Prints (to stderr) an error message, short usage and exits with a value of 1.
Can be overridden to produce alternative behavior.
| e | - The ArgException that caused the failure. |
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::usage | ( | int | exitVal = 0 |
) | [inline, virtual] |
Prints the usage to stdout and exits.
Can be overridden to produce alternative behavior.
| exitVal | - Value to exit with. |
Implements TCLAP::CmdLineInterface.
| void TCLAP::CmdLine::version | ( | int | exitVal = 0 |
) | [inline, virtual] |
Prints the version to stdout and exits.
Can be overridden to produce alternative behavior.
| exitVal | - Value to exit with. |
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.
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.
1.4.7