Debian Codegraph @

podofo/3rdparty/tclap/CmdLineInterface.h

raw symbols SCIP
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2
3 /******************************************************************************
4 *
5 * file: CmdLineInterface.h
6 *
7 * Copyright (c) 2003, Michael E. Smoot .
8 * Copyright (c) 2004, Michael E. Smoot, Daniel Aarno.
9 * Copyright (c) 2017, Google LLC
10 * All rights reserved.
11 *
12 * See the file COPYING in the top directory of this distribution for
13 * more information.
14 *
15 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
16 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 *
23 *****************************************************************************/
24
25 #ifndef TCLAP_CMD_LINE_INTERFACE_H
26 #define TCLAP_CMD_LINE_INTERFACE_H
27
28 #include <tclap/ArgContainer.h>
29
30 #include <algorithm>
31 #include <iostream>
32 #include <list>
33 #include <string>
34 #include <vector>
35
36 namespace TCLAP {
37
38 class Arg;
39 class ArgGroup;
40 class CmdLineOutput;
41
42 /**
43 * The base class that manages the command line definition and passes
44 * along the parsing to the appropriate Arg classes.
45 */
46 class CmdLineInterface : public ArgContainer {
47 public:
48 /**
49 * Destructor
50 */
51 virtual ~CmdLineInterface() {}
52
53 /**
54 * Adds an argument. Ownership is not transfered.
55 * @param a - Argument to be added.
56 * @retval A reference to this so that add calls can be chained
57 */
58 virtual ArgContainer &add(Arg &a) = 0;
59
60 /**
61 * Adds an argument. Ownership is not transfered.
62 * @param a - Argument to be added.
63 * @retval A reference to this so that add calls can be chained
64 */
65 virtual ArgContainer &add(Arg *a) = 0;
66
67 // TODO: Rename this to something smarter or refactor this logic so
68 // it's not needed.
69 // Internal - do not use
70 virtual void addToArgList(Arg *a) = 0;
71
72 /**
73 * Adds an argument group to the list of arguments to be parsed.
74 *
75 * All arguments in the group are added and the ArgGroup
76 * object will validate that the input matches its
77 * constraints.
78 *
79 * @param args - Argument group to be added.
80 * @retval A reference to this so that add calls can be chained
81 */
82 virtual ArgContainer &add(ArgGroup &args) = 0;
83
84 /**
85 * \deprecated Use OneOf instead.
86 */
87 virtual void xorAdd(Arg &a, Arg &b) = 0;
88
89 /**
90 * \deprecated Use OneOf instead.
91 */
92 virtual void xorAdd(const std::vector<Arg *> &xors) = 0;
93
94 /**
95 * Parses the command line.
96 * \param argc - Number of arguments.
97 * \param argv - Array of arguments.
98 */
99 virtual void parse(int argc, const char *const *argv) = 0;
100
101 /**
102 * Parses the command line.
103 * \param args - A vector of strings representing the args.
104 * args[0] is still the program name.
105 */
106 void parse(std::vector<std::string> &args);
107
108 /**
109 * \param co - CmdLineOutput object that we want to use instead.
110 */
111 virtual void setOutput(CmdLineOutput *co) = 0;
112
113 /**
114 * Returns the version string.
115 */
116 virtual std::string getVersion() const = 0;
117
118 /**
119 * Returns the program name string.
120 */
121 virtual std::string getProgramName() const = 0;
122
123 /**
124 * Returns the list of ArgGroups.
125 */
126 virtual std::list<ArgGroup *> getArgGroups() = 0;
127 virtual std::list<Arg *> getArgList() const = 0; // TODO: get rid of this
128
129 /**
130 * Returns the delimiter string.
131 */
132 virtual char getDelimiter() const = 0;
133
134 /**
135 * Returns the message string.
136 */
137 virtual std::string getMessage() const = 0;
138
139 /**
140 * Indicates whether or not the help and version switches were created
141 * automatically.
142 */
143 virtual bool hasHelpAndVersion() const = 0;
144
145 /**
146 * Resets the instance as if it had just been constructed so that the
147 * instance can be reused.
148 */
149 virtual void reset() = 0;
150
151 /**
152 * Begin ignoring arguments since the "--" argument was specified.
153 * \internal
154 */
155 virtual void beginIgnoring() = 0;
156
157 /**
158 * Whether to ignore the rest.
159 * \internal
160 */
161 virtual bool ignoreRest() = 0;
162 };
163
164 } // namespace TCLAP
165
166 #endif // TCLAP_CMD_LINE_INTERFACE_H