20 #ifndef _BASIS_MULTIARG_H 21 #define _BASIS_MULTIARG_H 24 #include "tclap/MultiArg.h" 72 const std::string& name,
73 const std::string& desc,
75 const std::string& typeDesc,
78 TCLAP::Visitor* v = NULL);
100 const std::string& name,
101 const std::string& desc,
103 const std::string& typeDesc,
104 TCLAP::CmdLineInterface& parser,
107 TCLAP::Visitor* v = NULL);
126 const std::string& name,
127 const std::string& desc,
129 TCLAP::Constraint<T>* constraint,
132 TCLAP::Visitor* v = NULL);
152 const std::string& name,
153 const std::string& desc,
155 TCLAP::Constraint<T>* constraint,
156 TCLAP::CmdLineInterface& parser,
159 TCLAP::Visitor* v = NULL);
175 virtual bool processArg(
int* i, std::vector<std::string>& args);
208 const std::string& name,
209 const std::string& desc,
211 const std::string& typeDesc,
216 TCLAP::
MultiArg<T>(flag, name, desc, req, typeDesc, v),
219 if (once) TCLAP::MultiArg<T>::_acceptsMultipleValues =
false;
225 const std::string& name,
226 const std::string& desc,
228 const std::string& typeDesc,
229 TCLAP::CmdLineInterface& parser,
234 TCLAP::
MultiArg<T>(flag, name, desc, req, typeDesc, parser, v),
237 if (once) TCLAP::MultiArg<T>::_acceptsMultipleValues =
false;
243 const std::string& name,
244 const std::string& desc,
246 TCLAP::Constraint<T>* constraint,
251 TCLAP::
MultiArg<T>(flag, name, desc, req, constraint, v),
254 if (once) TCLAP::MultiArg<T>::_acceptsMultipleValues =
false;
260 const std::string& name,
261 const std::string& desc,
263 TCLAP::Constraint<T>* constraint,
264 TCLAP::CmdLineInterface& parser,
269 TCLAP::
MultiArg<T>(flag, name, desc, req, constraint, parser, v),
272 if (once) TCLAP::MultiArg<T>::_acceptsMultipleValues =
false;
279 if (TCLAP::MultiArg<T>::_ignoreable && TCLAP::Arg::ignoreRest()) {
282 if (TCLAP::MultiArg<T>::_hasBlanks( args[*i] ))
return false;
284 std::string flag = args[*i];
285 std::string value =
"";
286 TCLAP::MultiArg<T>::trimFlag(flag, value);
287 if (!TCLAP::MultiArg<T>::argMatches(flag))
return false;
289 if (TCLAP::Arg::delimiter() !=
' ' && value ==
"") {
291 "Couldn't find delimiter for this argument!",
292 TCLAP::MultiArg<T>::toString());
297 if (TCLAP::MultiArg<T>::_alreadySet &&
298 !TCLAP::MultiArg<T>::_acceptsMultipleValues) {
300 TCLAP::MultiArg<T>::toString());
303 if (static_cast<unsigned int>(*i) < args.size()) {
304 TCLAP::MultiArg<T>::_extractValue(args[*i]);
307 "Missing a value for this argument!",
308 TCLAP::MultiArg<T>::toString());
311 TCLAP::MultiArg<T>::_extractValue(value);
316 if (static_cast<unsigned int>(*i) < args.size()) {
317 TCLAP::MultiArg<T>::_extractValue(args[*i]);
320 "Too few values for this argument!",
321 TCLAP::MultiArg<T>::toString());
324 TCLAP::MultiArg<T>::_alreadySet =
true;
325 TCLAP::MultiArg<T>::_allowMore =
false;
326 TCLAP::MultiArg<T>::_checkWithVisitor();
333 if (TCLAP::MultiArg<T>::_required) {
334 if (TCLAP::MultiArg<T>::_acceptsMultipleValues
335 && TCLAP::MultiArg<T>::_values.size() > 1) {
349 #endif // _BASIS_MULTIARG_H virtual bool isRequired() const
Whether the argument is required or not.
An argument that allows multiple values of type T to be specified.
TCLAP::ArgParseException ArgParseException
Exception thrown on command-line argument parsing error.
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
unsigned int _numberOfArguments
Number of values to process each time.
MultiArg(const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, unsigned int n=1, bool once=false, TCLAP::Visitor *v=NULL)
Constructor.
TCLAP::CmdLineParseException CmdLineParseException
Exception thrown on command-line parsing error.