tclap: CmdLineInterface.h Source File

tclap 1.2.5

CmdLineInterface.h
Go to the documentation of this file.
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2
3
4 /******************************************************************************
5 *
6 * file: CmdLineInterface.h
7 *
8 * Copyright (c) 2003, Michael E. Smoot .
9 * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
10 * Copyright (c) 2017, Google LLC
11 * All rights reserved.
12 *
13 * See the file COPYING in the top directory of this distribution for
14 * more information.
15 *
16 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *
24 *****************************************************************************/
25
26 #ifndef TCLAP_COMMANDLINE_INTERFACE_H
27 #define TCLAP_COMMANDLINE_INTERFACE_H
28
29 #include <string>
30 #include <vector>
31 #include <list>
32 #include <iostream>
33 #include <algorithm>
34
35
36 namespace TCLAP {
37
38 class Arg;
39 class CmdLineOutput;
40 class XorHandler;
41
46 class CmdLineInterface
47 {
48 public:
49
53 virtual ~CmdLineInterface() {}
54
59 virtual void add( Arg& a )=0;
60
65 virtual void add( Arg* a )=0;
66
74 virtual void xorAdd( Arg& a, Arg& b )=0;
75
81 virtual void xorAdd( const std::vector<Arg*>& xors )=0;
82
88 virtual void parse(int argc, const char * const * argv)=0;
89
95 void parse(std::vector<std::string>& args);
96
100 virtual CmdLineOutput* getOutput()=0;
101
105 virtual void setOutput(CmdLineOutput* co)=0;
106
110 virtual std::string& getVersion()=0;
111
115 virtual std::string& getProgramName()=0;
116
120 virtual std::list<Arg*>& getArgList()=0;
121
125 virtual XorHandler& getXorHandler()=0;
126
130 virtual char getDelimiter()=0;
131
135 virtual std::string& getMessage()=0;
136
141 virtual bool hasHelpAndVersion()=0;
142
147 virtual void reset()=0;
148 };
149
150 } //namespace
151
152
153 #endif
TCLAP::Arg
A virtual base class that defines the essential data for all arguments.
Definition: Arg.h:56
TCLAP::CmdLineInterface
The base class that manages the command line definition and passes along the parsing to the appropria...
Definition: CmdLineInterface.h:47
TCLAP::CmdLineInterface::getVersion
virtual std::string & getVersion()=0
Returns the version string.
TCLAP::CmdLineInterface::getXorHandler
virtual XorHandler & getXorHandler()=0
Returns the XorHandler.
TCLAP::CmdLineInterface::add
virtual void add(Arg &a)=0
Adds an argument to the list of arguments to be parsed.
TCLAP::CmdLineInterface::getProgramName
virtual std::string & getProgramName()=0
Returns the program name string.
TCLAP::CmdLineInterface::parse
void parse(std::vector< std::string > &args)
Parses the command line.
TCLAP::CmdLineInterface::getMessage
virtual std::string & getMessage()=0
Returns the message string.
TCLAP::CmdLineInterface::hasHelpAndVersion
virtual bool hasHelpAndVersion()=0
Indicates whether or not the help and version switches were created automatically.
TCLAP::CmdLineInterface::getArgList
virtual std::list< Arg * > & getArgList()=0
Returns the argList.
TCLAP::CmdLineInterface::parse
virtual void parse(int argc, const char *const *argv)=0
Parses the command line.
TCLAP::CmdLineInterface::xorAdd
virtual void xorAdd(Arg &a, Arg &b)=0
Add two Args that will be xor'd.
TCLAP::CmdLineInterface::reset
virtual void reset()=0
Resets the instance as if it had just been constructed so that the instance can be reused.
TCLAP::CmdLineInterface::add
virtual void add(Arg *a)=0
An alternative add.
TCLAP::CmdLineInterface::getDelimiter
virtual char getDelimiter()=0
Returns the delimiter string.
TCLAP::CmdLineInterface::~CmdLineInterface
virtual ~CmdLineInterface()
Destructor.
Definition: CmdLineInterface.h:53
TCLAP::CmdLineInterface::setOutput
virtual void setOutput(CmdLineOutput *co)=0
TCLAP::CmdLineInterface::xorAdd
virtual void xorAdd(const std::vector< Arg * > &xors)=0
Add a list of Args that will be xor'd.
TCLAP::CmdLineInterface::getOutput
virtual CmdLineOutput * getOutput()=0
Returns the CmdLineOutput object.
TCLAP::CmdLineOutput
The interface that any output object must implement.
Definition: CmdLineOutput.h:45
TCLAP::XorHandler
This class handles lists of Arg's that are to be XOR'd on the command line.
Definition: XorHandler.h:41
TCLAP
Definition: Arg.h:48