tclap: TCLAP::CmdLineInterface Class Reference

tclap 1.2.5

Public Member Functions | List of all members
TCLAP::CmdLineInterface Class Referenceabstract

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

`#include <CmdLineInterface.h>`

Inheritance diagram for TCLAP::CmdLineInterface:
[legend]

## Public Member Functions
virtual | ~CmdLineInterface ()
| Destructor. More...
virtual void | add (Arg &a)=0
| Adds an argument to the list of arguments to be parsed. More...
virtual void | add (Arg *a)=0
| An alternative add. More...
virtual void | xorAdd (Arg &a, Arg &b)=0
| Add two Args that will be xor'd. More...
virtual void | xorAdd (const std::vector< Arg * > &xors)=0
| Add a list of Args that will be xor'd. More...
virtual void | parse (int argc, const char *const *argv)=0
| Parses the command line. More...
void | parse (std::vector< std::string > &args)
| Parses the command line. More...
virtual CmdLineOutput * | getOutput ()=0
| Returns the CmdLineOutput object. More...
virtual void | setOutput (CmdLineOutput *co)=0
virtual std::string & | getVersion ()=0
| Returns the version string. More...
virtual std::string & | getProgramName ()=0
| Returns the program name string. More...
virtual std::list< Arg * > & | getArgList ()=0
| Returns the argList. More...
virtual XorHandler & | getXorHandler ()=0
| Returns the XorHandler. More...
virtual char | getDelimiter ()=0
| Returns the delimiter string. More...
virtual std::string & | getMessage ()=0
| Returns the message string. More...
virtual bool | hasHelpAndVersion ()=0
| Indicates whether or not the help and version switches were created automatically. More...
virtual void | reset ()=0
| Resets the instance as if it had just been constructed so that the instance can be reused. More...

## Detailed Description

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

Definition at line 46 of file CmdLineInterface.h.

## Constructor & Destructor Documentation

## ◆ ~CmdLineInterface()

virtual TCLAP::CmdLineInterface::~CmdLineInterface | ( |  | ) |
| inlinevirtual

Destructor.

Definition at line 53 of file CmdLineInterface.h.

## Member Function Documentation

## ◆ add() [1/2]

virtual void TCLAP::CmdLineInterface::add | ( | Arg & | a | ) |
| pure virtual

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

Parameters

  a | - Argument to be added.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::MultiArg< T >::MultiArg(), TCLAP::MultiSwitchArg::MultiSwitchArg(), TCLAP::SwitchArg::SwitchArg(), TCLAP::UnlabeledMultiArg< T >::UnlabeledMultiArg(), TCLAP::UnlabeledValueArg< T >::UnlabeledValueArg(), and TCLAP::ValueArg< T >::ValueArg().

## ◆ add() [2/2]

virtual void TCLAP::CmdLineInterface::add | ( | Arg * | a | ) |
| pure virtual

An alternative add.

Functionally identical.

Parameters

  a | - Argument to be added.

Implemented in TCLAP::CmdLine.

## ◆ getArgList()

virtual std::list<Arg*>& TCLAP::CmdLineInterface::getArgList | ( |  | ) |
| pure virtual

Returns the argList.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::StdOutput::_longUsage(), TCLAP::StdOutput::_shortUsage(), TCLAP::DocBookOutput::usage(), and TCLAP::ZshCompletionOutput::usage().

## ◆ getDelimiter()

virtual char TCLAP::CmdLineInterface::getDelimiter | ( |  | ) |
| pure virtual

Returns the delimiter string.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::DocBookOutput::usage(), and TCLAP::ZshCompletionOutput::usage().

## ◆ getMessage()

virtual std::string& TCLAP::CmdLineInterface::getMessage | ( |  | ) |
| pure virtual

Returns the message string.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::StdOutput::_longUsage(), and TCLAP::DocBookOutput::usage().

## ◆ getOutput()

virtual CmdLineOutput* TCLAP::CmdLineInterface::getOutput | ( |  | ) |
| pure virtual

Returns the CmdLineOutput object.

Implemented in TCLAP::CmdLine.

## ◆ getProgramName()

virtual std::string& TCLAP::CmdLineInterface::getProgramName | ( |  | ) |
| pure virtual

Returns the program name string.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::StdOutput::_shortUsage(), TCLAP::StdOutput::failure(), TCLAP::DocBookOutput::usage(), TCLAP::ZshCompletionOutput::usage(), and TCLAP::StdOutput::version().

## ◆ getVersion()

virtual std::string& TCLAP::CmdLineInterface::getVersion | ( |  | ) |
| pure virtual

Returns the version string.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::DocBookOutput::usage(), TCLAP::ZshCompletionOutput::usage(), TCLAP::DocBookOutput::version(), TCLAP::StdOutput::version(), and TCLAP::ZshCompletionOutput::version().

## ◆ getXorHandler()

virtual XorHandler& TCLAP::CmdLineInterface::getXorHandler | ( |  | ) |
| pure virtual

Returns the XorHandler.

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::StdOutput::_longUsage(), TCLAP::StdOutput::_shortUsage(), TCLAP::ZshCompletionOutput::getMutexList(), and TCLAP::DocBookOutput::usage().

## ◆ hasHelpAndVersion()

virtual bool TCLAP::CmdLineInterface::hasHelpAndVersion | ( |  | ) |
| pure virtual

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

Implemented in TCLAP::CmdLine.

Referenced by TCLAP::StdOutput::failure().

## ◆ parse() [1/2]

virtual void TCLAP::CmdLineInterface::parse | ( | int | argc,
|  | const char *const * | argv
| ) |  |
| pure virtual

Parses the command line.

Parameters

  argc | - Number of arguments.
  argv | - Array of arguments.

Implemented in TCLAP::CmdLine.

## ◆ parse() [2/2]

void TCLAP::CmdLineInterface::parse | ( | std::vector< std::string > & | args | ) |

Parses the command line.

Parameters

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

## ◆ reset()

virtual void TCLAP::CmdLineInterface::reset | ( |  | ) |
| pure virtual

Resets the instance as if it had just been constructed so that the instance can be reused.

Implemented in TCLAP::CmdLine.

## ◆ setOutput()

virtual void TCLAP::CmdLineInterface::setOutput | ( | CmdLineOutput * | co | ) |
| pure virtual

Parameters

  co | - CmdLineOutput object that we want to use instead.

Implemented in TCLAP::CmdLine.

## ◆ xorAdd() [1/2]

virtual void TCLAP::CmdLineInterface::xorAdd | ( | Arg & | a,
|  | Arg & | b
| ) |  |
| pure 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.

Implemented in TCLAP::CmdLine.

## ◆ xorAdd() [2/2]

virtual void TCLAP::CmdLineInterface::xorAdd | ( | const std::vector< Arg * > & | xors | ) |
| pure 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.

Implemented in TCLAP::CmdLine.

The documentation for this class was generated from the following file:

- CmdLineInterface.h