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