23#ifndef TCLAP_MULTIPLE_ARGUMENT_H
24#define TCLAP_MULTIPLE_ARGUMENT_H
43 typedef typename container_type::iterator
iterator;
96 const std::string& name,
97 const std::string& desc,
99 const std::string& typeDesc,
121 const std::string& name,
122 const std::string& desc,
124 const std::string& typeDesc,
144 const std::string& name,
145 const std::string& desc,
167 const std::string& name,
168 const std::string& desc,
182 virtual bool processArg(
int* i, std::vector<std::string>& args);
206 virtual std::string
shortID(
const std::string& val=
"val")
const;
212 virtual std::string
longID(
const std::string& val=
"val")
const;
222 virtual void reset();
235 const std::string& name,
236 const std::string& desc,
238 const std::string& typeDesc,
240 Arg( flag, name, desc, req, true, v ),
241 _values(std::vector<T>()),
242 _typeDesc( typeDesc ),
251 const std::string& name,
252 const std::string& desc,
254 const std::string& typeDesc,
257:
Arg( flag, name, desc, req, true, v ),
258 _values(std::vector<T>()),
259 _typeDesc( typeDesc ),
272 const std::string& name,
273 const std::string& desc,
277:
Arg( flag, name, desc, req, true, v ),
278 _values(std::vector<T>()),
279 _typeDesc( constraint->shortID() ),
280 _constraint( constraint ),
288 const std::string& name,
289 const std::string& desc,
294:
Arg( flag, name, desc, req, true, v ),
295 _values(std::vector<T>()),
296 _typeDesc( constraint->shortID() ),
297 _constraint( constraint ),
313 if ( _hasBlanks( args[*i] ) )
316 std::string flag = args[*i];
317 std::string value =
"";
319 trimFlag( flag, value );
321 if ( argMatches( flag ) )
325 "Couldn't find delimiter for this argument!",
332 if (
static_cast<unsigned int>(*i) < args.size() )
333 _extractValue( args[*i] );
339 _extractValue( value );
364 static_cast<void>(val);
374 static_cast<void>(val);
375 return Arg::longID(_typeDesc) +
" (accepted multiple times)";
387 if ( _values.size() > 1 )
403 _values.push_back(tmp);
408 if ( _constraint != NULL )
409 if ( ! _constraint->check( _values.back() ) )
411 "' does not meet constraint: " +
412 _constraint->description(),
419 bool am = _allowMore;
std::string error() const
Returns the error text.
Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...
A virtual base class that defines the essential data for all arguments.
bool _acceptsMultipleValues
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
static bool ignoreRest()
Whether to ignore the rest.
static char delimiter()
The delimiter that separates an argument flag/name from the value.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
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.
Thrown from CmdLine when the arguments on the command line are not properly specified,...
The interface that defines the interaction between the Arg and Constraint.
An argument that allows multiple values of type T to be specified.
std::string _typeDesc
The description of type T to be used in the usage.
void _extractValue(const std::string &val)
Extracts the value from the string.
container_type::iterator iterator
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
container_type::const_iterator const_iterator
const_iterator end() const
Returns the end of the values parsed from the command line.
MultiArg(const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, Visitor *v=NULL)
Constructor.
virtual bool isRequired() const
Once we've matched the first value, then the arg is no longer required.
const_iterator begin() const
Returns an iterator over the values parsed from the command line.
bool _allowMore
Used by XorHandler to decide whether to keep parsing for this arg.
std::vector< T > _values
The list of values parsed from the CmdLine.
virtual bool allowMore()
Used for MultiArgs and XorHandler to determine whether args can still be set.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
virtual std::string shortID(const std::string &val="val") const
Returns the a short id string.
std::vector< T > container_type
virtual std::string longID(const std::string &val="val") const
Returns the a long id string.
Constraint< T > * _constraint
A list of constraint on this Arg.
const std::vector< T > & getValue()
Returns a vector of type T containing the values parsed from the command line.
A base class that defines the interface for visitors.
void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl)
T::ValueCategory ValueCategory