25 #ifndef TCLAP_MULTI_ARG_H 26 #define TCLAP_MULTI_ARG_H 44 typedef typename container_type::iterator
iterator;
95 MultiArg(
const std::string &flag,
const std::string &name,
96 const std::string &desc,
bool req,
const std::string &typeDesc,
117 MultiArg(
const std::string &flag,
const std::string &name,
118 const std::string &desc,
bool req,
const std::string &typeDesc,
136 MultiArg(
const std::string &flag,
const std::string &name,
137 const std::string &desc,
bool req,
Constraint<T> *constraint,
156 MultiArg(
const std::string &flag,
const std::string &name,
157 const std::string &desc,
bool req,
Constraint<T> *constraint,
168 virtual bool processArg(
int *i, std::vector<std::string> &args);
180 const_iterator
begin()
const {
return _values.begin(); }
186 const_iterator
end()
const {
return _values.end(); }
192 virtual std::string
shortID(
const std::string &val =
"val")
const;
198 virtual std::string
longID(
const std::string &val =
"val")
const;
202 virtual void reset();
214 const std::string &desc,
bool req,
215 const std::string &typeDesc,
Visitor *v)
216 :
Arg(flag, name, desc, req, true, v),
226 const std::string &desc,
bool req,
229 :
Arg(flag, name, desc, req, true, v),
243 const std::string &desc,
bool req,
245 :
Arg(flag, name, desc, req, true, v),
255 const std::string &desc,
bool req,
258 :
Arg(flag, name, desc, req, true, v),
271 std::string flag = args[*i];
272 std::string value =
"";
279 "Couldn't find delimiter for this argument!",
toString()));
284 if (static_cast<unsigned int>(*i) < args.size())
308 static_cast<void>(val);
317 static_cast<void>(val);
335 "' does not meet constraint: " +
_constraint->description(),
354 #endif // TCLAP_MULTI_ARG_H 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.
virtual ArgContainer & add(Arg &a)=0
Adds an argument.
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.
void _extractValue(const std::string &val)
Extracts the value from the string.
Interface that allows adding an Arg to a "container".
Constraint< T > * _constraint
A list of constraint on this Arg.
virtual bool allowMore()
Used for MultiArgs 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 MultiArg to decide whether to keep parsing for this arg.
container_type::const_iterator const_iterator
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.
container_type::iterator iterator
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.
std::string _setBy
Indicates the value specified to set this flag (like -a or –all).
virtual void trimFlag(std::string &flag, std::string &value) const
Trims a value off of the flag.