Main MRPT website > C++ reference for MRPT 1.4.0
CmdLineInterface.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9
10/******************************************************************************
11 *
12 * file: CmdLineInterface.h
13 *
14 * Copyright (c) 2003, Michael E. Smoot .
15 * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
16 * All rights reverved.
17 *
18 * See the file COPYING in the top directory of this distribution for
19 * more information.
20 *
21 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 *
29 *****************************************************************************/
30
31#ifndef TCLAP_COMMANDLINE_INTERFACE_H
32#define TCLAP_COMMANDLINE_INTERFACE_H
33
34#include <string>
35#include <vector>
36#include <list>
37#include <iostream>
38#include <algorithm>
39
40
41namespace TCLAP {
42
43class Arg;
44class CmdLineOutput;
45class XorHandler;
46
47/**
48 * The base class that manages the command line definition and passes
49 * along the parsing to the appropriate Arg classes.
50 */
52{
53 public:
54
55 /**
56 * Destructor
57 */
58 virtual ~CmdLineInterface() {}
59
60 /**
61 * Adds an argument to the list of arguments to be parsed.
62 * \param a - Argument to be added.
63 */
64 virtual void add( Arg& a )=0;
65
66 /**
67 * An alternative add. Functionally identical.
68 * \param a - Argument to be added.
69 */
70 virtual void add( Arg* a )=0;
71
72 /**
73 * Add two Args that will be xor'd.
74 * If this method is used, add does
75 * not need to be called.
76 * \param a - Argument to be added and xor'd.
77 * \param b - Argument to be added and xor'd.
78 */
79 virtual void xorAdd( Arg& a, Arg& b )=0;
80
81 /**
82 * Add a list of Args that will be xor'd. If this method is used,
83 * add does not need to be called.
84 * \param xors - List of Args to be added and xor'd.
85 */
86 virtual void xorAdd( std::vector<Arg*>& xors )=0;
87
88 /**
89 * Parses the command line.
90 * \param argc - Number of arguments.
91 * \param argv - Array of arguments.
92 * \return (Added by JLBC for MRPT): Return false if the program should exit (error in args, it was --help, etc...)
93 */
94 virtual bool parse(int argc, char** argv)=0;
95
96 /**
97 * Returns the CmdLineOutput object.
98 */
100
101 /**
102 * \param co - CmdLineOutput object that we want to use instead.
103 */
104 virtual void setOutput(CmdLineOutput* co)=0;
105
106 /**
107 * Returns the version string.
108 */
109 virtual std::string& getVersion()=0;
110
111 /**
112 * Returns the program name string.
113 */
114 virtual std::string& getProgramName()=0;
115
116 /**
117 * Returns the argList.
118 */
119 virtual std::list<Arg*>& getArgList()=0;
120
121 /**
122 * Returns the XorHandler.
123 */
125
126 /**
127 * Returns the delimiter string.
128 */
129 virtual char getDelimiter()=0;
130
131 /**
132 * Returns the message string.
133 */
134 virtual std::string& getMessage()=0;
135
136 /**
137 * Indicates whether or not the help and version switches were created
138 * automatically.
139 */
140 virtual bool hasHelpAndVersion()=0;
141};
142
143} //namespace
144
145
146#endif
A virtual base class that defines the essential data for all arguments.
Definition Arg.h:52
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.
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 bool parse(int argc, char **argv)=0
Parses the command line.
virtual std::string & getProgramName()=0
Returns the program name string.
virtual void xorAdd(Arg &a, Arg &b)=0
Add two Args that will be xor'd.
virtual void xorAdd(std::vector< Arg * > &xors)=0
Add a list of Args that will be xor'd.
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 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.
This class handles lists of Arg's that are to be XOR'd on the command line.
Definition XorHandler.h:47
Definition Arg.h:44



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Wed Dec 6 15:06:50 UTC 2023