25 #ifndef TCLAP_VALUE_ARG_H 26 #define TCLAP_VALUE_ARG_H 106 ValueArg(
const std::string &flag,
const std::string &name,
107 const std::string &desc,
bool req, T value,
108 const std::string &typeDesc,
Visitor *v = NULL);
134 ValueArg(
const std::string &flag,
const std::string &name,
135 const std::string &desc,
bool req, T value,
161 ValueArg(
const std::string &flag,
const std::string &name,
162 const std::string &desc,
bool req, T value,
187 ValueArg(
const std::string &flag,
const std::string &name,
188 const std::string &desc,
bool req, T value,
200 virtual bool processArg(
int *i, std::vector<std::string> &args);
217 virtual std::string
shortID(
const std::string &val =
"val")
const;
223 virtual std::string
longID(
const std::string &val =
"val")
const;
225 virtual void reset();
240 const std::string &desc,
bool req, T val,
241 const std::string &typeDesc,
Visitor *v)
242 :
Arg(flag, name, desc, req, true, v),
250 const std::string &desc,
bool req, T val,
253 :
Arg(flag, name, desc, req, true, v),
263 const std::string &desc,
bool req, T val,
265 :
Arg(flag, name, desc, req, true, v),
273 const std::string &desc,
bool req, T val,
276 :
Arg(flag, name, desc, req, true, v),
291 std::string flag = args[*i];
293 std::string value =
"";
303 "Couldn't find delimiter for this argument!",
toString()));
307 if (static_cast<unsigned int>(*i) < args.size())
352 +
"' does not meet constraint: " +
365 #endif // TCLAP_VALUE_ARG_H const T & getValue() const
Returns the value of the argument.
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.
void _extractValue(const std::string &val)
Extracts the value from the string.
A virtual base class that defines the essential data for all arguments.
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>>.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
The basic labeled argument that parses a value.
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
static char delimiter()
The delimiter that separates an argument flag/name from the value.
virtual std::string shortID(const std::string &val="val") const
Specialization of shortID.
T _value
The value parsed from the command line.
The interface that defines the interaction between the Arg and Constraint.
void _checkWithVisitor() const
Performs the special handling described by the Visitor.
Interface that allows adding an Arg to a "container".
Constraint< T > * _constraint
A Constraint this Arg must conform to.
A base class that defines the interface for visitors.
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
virtual std::string toString() const
Returns a simple string representation of the argument.
std::string _typeDesc
A human readable description of the type to be parsed.
void ExtractValue(T &destVal, const std::string &strVal, ValueLike vl)
Thrown from within the child Arg classes when it fails to properly parse the argument it has been pas...
T _default
Used to support the reset() method so that ValueArg can be reset to their constructed value...
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
bool _hasBlanks(const std::string &s) const
Checks whether a given string has blank chars, indicating that it is a combined SwitchArg.
virtual std::string longID(const std::string &val="val") const
Specialization of longID.
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 reset()
Clears the Arg object and allows it to be reused by new command lines.
virtual void trimFlag(std::string &flag, std::string &value) const
Trims a value off of the flag.
ValueArg(const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, const std::string &typeDesc, Visitor *v=NULL)
Labeled ValueArg constructor.