Computer Assisted Medical Intervention Tool Kit version 6.0
 
Loading...
Searching...
No Matches
actionstatemachine/CommandLineOptions.hxx
Go to the documentation of this file.
1// This code was generated by CLI, a command line interface
2// compiler for C++.
3//
4
5#ifndef COMMAND_LINE_OPTIONS_HXX
6#define COMMAND_LINE_OPTIONS_HXX
7
8#include <iosfwd>
9#include <string>
10#include <exception>
11
12namespace cli
13{
15 {
16 public:
17 enum value
18 {
21 fail
22 };
23
25
26 operator value () const
27 {
28 return v_;
29 }
30
31 private:
32 value v_;
33 };
34
35 // Exceptions.
36 //
37
38 class exception: public std::exception
39 {
40 public:
41 virtual void
42 print (std::ostream&) const = 0;
43 };
44
45 std::ostream&
46 operator<< (std::ostream&, const exception&);
47
49 {
50 public:
51
52 ~unknown_option () throw () override;
53
54 unknown_option (std::string option);
55
56 const std::string&
57 option () const;
58
59 void
60 print (std::ostream&) const override;
61
62 const char*
63 what () const throw () override;
64
65 private:
66 std::string option_;
67 };
68
70 {
71 public:
72
73 ~unknown_argument () throw () override;
74
75 unknown_argument (std::string argument);
76
77 const std::string&
78 argument () const;
79
80 void
81 print (std::ostream&) const override;
82
83 const char*
84 what () const throw () override;
85
86 private:
87 std::string argument_;
88 };
89
91 {
92 public:
93
94 ~missing_value () throw () override;
95
96 missing_value (std::string option);
97
98 const std::string&
99 option () const;
100
101 void
102 print (std::ostream&) const override;
103
104 const char*
105 what () const throw () override;
106
107 private:
108 std::string option_;
109 };
110
112 {
113 public:
114
115 ~invalid_value () throw () override;
116
117 invalid_value (std::string option,
118 std::string value);
119
120 const std::string&
121 option () const;
122
123 const std::string&
124 value () const;
125
126 void
127 print (std::ostream&) const override;
128
129 const char*
130 what () const throw () override;
131
132 private:
133 std::string option_;
134 std::string value_;
135 };
136
137 class eos_reached: public exception
138 {
139 public:
140 void
141 print (std::ostream&) const override;
142
143 const char*
144 what () const throw () override;
145 };
146
148 {
149 public:
150 virtual
151 ~scanner ();
152
153 virtual bool
154 more () = 0;
155
156 virtual const char*
157 peek () = 0;
158
159 virtual const char*
160 next () = 0;
161
162 virtual void
163 skip () = 0;
164 };
165
166 class argv_scanner: public scanner
167 {
168 public:
169 argv_scanner (int& argc, char** argv, bool erase = false);
170 argv_scanner (int start, int& argc, char** argv, bool erase = false);
171
172 int
173 end () const;
174
175 bool
176 more () override;
177
178 const char*
179 peek () override;
180
181 const char*
182 next () override;
183
184 void
185 skip () override;
186
187 private:
188 int i_;
189 int& argc_;
190 char** argv_;
191 bool erase_;
192 };
193}
194
195#include <string>
196
198{
199 public:
200
201 options (int& argc,
202 char** argv,
203 bool erase = false,
206
207 options (int start,
208 int& argc,
209 char** argv,
210 bool erase = false,
213
214 options (int& argc,
215 char** argv,
216 int& end,
217 bool erase = false,
220
221 options (int start,
222 int& argc,
223 char** argv,
224 int& end,
225 bool erase = false,
228
232
233 // Option accessors.
234 //
235
236 const bool&
237 help () const;
238
239 const bool&
240 version () const;
241
242 const std::string&
243 file () const;
244
245 const std::string&
246 output_dir () const;
247
248 const bool&
249 autonext () const;
250
251 // Print usage information.
252 //
253 static void
254 print_usage (::std::ostream&);
255
256 private:
257 void
258 _parse (::cli::scanner&,
259 ::cli::unknown_mode option,
260 ::cli::unknown_mode argument);
261
262 public:
263 bool help_;
265 std::string file_;
266 std::string output_dir_;
268};
269
270#include "CommandLineOptions.ixx"
271
272#endif // COMMAND_LINE_OPTIONS_HXX
Definition actionstatemachine/CommandLineOptions.hxx:167
const char * next() override
Definition actionstatemachine/CommandLineOptions.cxx:127
void skip() override
Definition actionstatemachine/CommandLineOptions.cxx:151
int end() const
Definition actionstatemachine/CommandLineOptions.ixx:106
const char * peek() override
Definition actionstatemachine/CommandLineOptions.cxx:118
bool more() override
Definition actionstatemachine/CommandLineOptions.cxx:112
Definition actionstatemachine/CommandLineOptions.hxx:138
void print(std::ostream &) const override
Definition actionstatemachine/CommandLineOptions.cxx:92
const char * what() const override
Definition actionstatemachine/CommandLineOptions.cxx:98
Definition actionstatemachine/CommandLineOptions.hxx:39
virtual void print(std::ostream &) const =0
Definition actionstatemachine/CommandLineOptions.hxx:112
void print(std::ostream &) const override
Definition actionstatemachine/CommandLineOptions.cxx:77
const char * what() const override
Definition actionstatemachine/CommandLineOptions.cxx:84
~invalid_value() override
Definition config/CommandLineOptions.cxx:76
const std::string & value() const
Definition actionstatemachine/CommandLineOptions.ixx:86
const std::string & option() const
Definition actionstatemachine/CommandLineOptions.ixx:80
Definition actionstatemachine/CommandLineOptions.hxx:91
~missing_value() override
Definition config/CommandLineOptions.cxx:57
void print(std::ostream &) const override
Definition actionstatemachine/CommandLineOptions.cxx:59
const std::string & option() const
Definition actionstatemachine/CommandLineOptions.ixx:65
const char * what() const override
Definition actionstatemachine/CommandLineOptions.cxx:65
Definition actionstatemachine/CommandLineOptions.hxx:148
virtual ~scanner()
Definition config/CommandLineOptions.cxx:110
virtual bool more()=0
virtual const char * peek()=0
virtual void skip()=0
virtual const char * next()=0
Definition actionstatemachine/CommandLineOptions.hxx:70
void print(std::ostream &) const override
Definition actionstatemachine/CommandLineOptions.cxx:41
~unknown_argument() override
Definition config/CommandLineOptions.cxx:38
const std::string & argument() const
Definition actionstatemachine/CommandLineOptions.ixx:51
const char * what() const override
Definition actionstatemachine/CommandLineOptions.cxx:47
Definition actionstatemachine/CommandLineOptions.hxx:15
value
Definition actionstatemachine/CommandLineOptions.hxx:18
@ stop
Definition actionstatemachine/CommandLineOptions.hxx:20
@ fail
Definition actionstatemachine/CommandLineOptions.hxx:21
@ skip
Definition actionstatemachine/CommandLineOptions.hxx:19
Definition actionstatemachine/CommandLineOptions.hxx:49
~unknown_option() override
Definition config/CommandLineOptions.cxx:19
const std::string & option() const
Definition actionstatemachine/CommandLineOptions.ixx:37
const char * what() const override
Definition actionstatemachine/CommandLineOptions.cxx:29
void print(std::ostream &) const override
Definition actionstatemachine/CommandLineOptions.cxx:23
Definition actionstatemachine/CommandLineOptions.hxx:198
const bool & version() const
Definition actionstatemachine/CommandLineOptions.ixx:122
std::string file_
Definition actionstatemachine/CommandLineOptions.hxx:265
std::string output_dir_
Definition actionstatemachine/CommandLineOptions.hxx:266
const bool & autonext() const
Definition actionstatemachine/CommandLineOptions.ixx:140
const bool & help() const
Definition actionstatemachine/CommandLineOptions.ixx:116
bool version_
Definition actionstatemachine/CommandLineOptions.hxx:264
const std::string & file() const
Definition actionstatemachine/CommandLineOptions.ixx:128
const std::string & output_dir() const
Definition actionstatemachine/CommandLineOptions.ixx:134
bool autonext_
Definition actionstatemachine/CommandLineOptions.hxx:267
bool help_
Definition actionstatemachine/CommandLineOptions.hxx:263
static void print_usage(::std::ostream &)
Definition actionstatemachine/CommandLineOptions.cxx:385
Definition actionstatemachine/CommandLineOptions.cxx:15
std::ostream & operator<<(std::ostream &, const exception &)
Definition actionstatemachine/CommandLineOptions.ixx:22