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
36namespace TCLAP {
37
38class Arg;
39class CmdLineOutput;
40class XorHandler;
41
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
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
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
A virtual base class that defines the essential data for all arguments.
Definition: Arg.h:56
The base class that manages the command line definition and passes along the parsing to the appropria...
virtual void add(Arg &a)=0
Adds an argument to the list of arguments to be parsed.
virtual XorHandler & getXorHandler()=0
Returns the XorHandler.
void parse(std::vector< std::string > &args)
Parses the command line.
virtual CmdLineOutput * getOutput()=0
Returns the CmdLineOutput object.
virtual bool hasHelpAndVersion()=0
Indicates whether or not the help and version switches were created automatically.
virtual std::list< Arg * > & getArgList()=0
Returns the argList.
virtual std::string & getProgramName()=0
Returns the program name string.
virtual void parse(int argc, const char *const *argv)=0
Parses the command line.
virtual void xorAdd(Arg &a, Arg &b)=0
Add two Args that will be xor'd.
virtual void reset()=0
Resets the instance as if it had just been constructed so that the instance can be reused.
virtual void add(Arg *a)=0
An alternative add.
virtual char getDelimiter()=0
Returns the delimiter string.
virtual ~CmdLineInterface()
Destructor.
virtual void setOutput(CmdLineOutput *co)=0
virtual void xorAdd(const std::vector< Arg * > &xors)=0
Add a list of Args that will be xor'd.
virtual std::string & getVersion()=0
Returns the version string.
virtual std::string & getMessage()=0
Returns the message string.
The interface that any output object must implement.
Definition: CmdLineOutput.h:45
This class handles lists of Arg's that are to be XOR'd on the command line.
Definition: XorHandler.h:41
Definition: Arg.h:48