26 #ifndef TCLAP_MULTIPLE_ARGUMENT_H 27 #define TCLAP_MULTIPLE_ARGUMENT_H 46 typedef typename container_type::iterator
iterator;
99 const std::string& name,
100 const std::string& desc,
102 const std::string& typeDesc,
124 const std::string& name,
125 const std::string& desc,
127 const std::string& typeDesc,
147 const std::string& name,
148 const std::string& desc,
170 const std::string& name,
171 const std::string& desc,
185 virtual bool processArg(
int* i, std::vector<std::string>& args);
197 const_iterator
begin()
const {
return _values.begin(); }
203 const_iterator
end()
const {
return _values.end(); }
209 virtual std::string
shortID(
const std::string& val=
"val")
const;
215 virtual std::string
longID(
const std::string& val=
"val")
const;
225 virtual void reset();
238 const std::string& name,
239 const std::string& desc,
241 const std::string& typeDesc,
243 Arg( flag, name, desc, req, true, v ),
254 const std::string& name,
255 const std::string& desc,
257 const std::string& typeDesc,
260 :
Arg( flag, name, desc, req, true, v ),
275 const std::string& name,
276 const std::string& desc,
280 :
Arg( flag, name, desc, req, true, v ),
291 const std::string& name,
292 const std::string& desc,
297 :
Arg( flag, name, desc, req, true, v ),
316 std::string flag = args[*i];
317 std::string value =
"";
325 "Couldn't find delimiter for this argument!",
332 if ( static_cast<unsigned int>(*i) < args.size() )
364 static_cast<void>(val);
374 static_cast<void>(val);
411 "' does not meet constraint: " +
virtual std::string longID(const std::string &val="val") const
Returns the a long id string.
virtual bool argMatches(const std::string &s) const
A method that tests whether a string matches this argument.
bool _alreadySet
Indicates whether the argument has been set.
bool _required
Indicating whether the argument is required.
A virtual base class that defines the essential data for all arguments.
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
Thrown from CmdLine when the arguments on the command line are not properly specified, e.g.
A value like argument value type is a value that can be set using operator>>.
const_iterator end() const
Returns the end of the values parsed from the command line.
An argument that allows multiple values of type T to be specified.
std::vector< T > _values
The list of values parsed from the CmdLine.
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.
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
static char delimiter()
The delimiter that separates an argument flag/name from the value.
const_iterator begin() const
Returns an iterator over the values parsed from the command line.
std::string _typeDesc
The description of type T to be used in the usage.
The interface that defines the interaction between the Arg and Constraint.
void _checkWithVisitor() const
Performs the special handling described by the Visitor.
virtual bool isRequired() const
Once we've matched the first value, then the arg is no longer required.
void _extractValue(const std::string &val)
Extracts the value from the string.
Constraint< T > * _constraint
A list of constraint on this Arg.
virtual bool allowMore()
Used for MultiArgs and XorHandler to determine whether args can still be set.
A base class that defines the interface for visitors.
std::vector< T > container_type
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
const std::vector< T > & getValue() const
Returns a vector of type T containing the values parsed from the command line.
bool _allowMore
Used by XorHandler to decide whether to keep parsing for this arg.
container_type::const_iterator const_iterator
The base class that manages the command line definition and passes along the parsing to the appropria...
MultiArg(const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, Visitor *v=NULL)
Constructor.
virtual std::string toString() const
Returns a simple string representation of the argument.
virtual void add(Arg &a)=0
Adds an argument to the list of arguments to be parsed.
bool _ignoreable
Whether this argument can be ignored, if desired.
container_type::iterator iterator
static bool ignoreRest()
Whether to ignore the rest.
void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl)
bool _acceptsMultipleValues
Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...
bool _hasBlanks(const std::string &s) const
Checks whether a given string has blank chars, indicating that it is a combined SwitchArg.
std::string error() const
Returns the error text.
virtual void trimFlag(std::string &flag, std::string &value) const
Trims a value off of the flag.