26#ifndef TCLAP_MULTI_SWITCH_ARG_H
27#define TCLAP_MULTI_SWITCH_ARG_H
68 const std::string &desc,
int init = 0,
Visitor *v = NULL);
85 const std::string &desc,
ArgContainer &parser,
int init = 0,
96 virtual bool processArg(
int *i, std::vector<std::string> &args);
104 operator bool()
const {
return _value != 0; }
109 std::string
shortID(
const std::string &val)
const;
114 std::string
longID(
const std::string &val)
const;
120 const std::string &name,
121 const std::string &desc,
int init,
123 :
SwitchArg(flag, name, desc, false, v), _value(init), _default(init) {}
126 const std::string &name,
127 const std::string &desc,
130 :
SwitchArg(flag, name, desc, false, v), _value(init), _default(init) {
169 return Arg::longID(val) +
" (accepted multiple times)";
Interface that allows adding an Arg to a "container".
virtual ArgContainer & add(Arg &a)=0
Adds an argument.
void _checkWithVisitor() const
Performs the special handling described by the Visitor.
virtual std::string longID(const std::string &valueId="val") const
Returns a long ID for the usage.
std::string _setBy
Indicates the value specified to set this flag (like -a or –all).
bool _alreadySet
Indicates whether the argument has been set.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
virtual bool argMatches(const std::string &s) const
A method that tests whether a string matches this argument.
virtual std::string shortID(const std::string &valueId="val") const
Returns a short ID for the usage.
A multiple switch argument.
MultiSwitchArg(const std::string &flag, const std::string &name, const std::string &desc, int init=0, Visitor *v=NULL)
MultiSwitchArg constructor.
int getValue() const
Returns int, the number of times the switch has been set.
std::string shortID(const std::string &val) const
Returns the shortID for this Arg.
std::string longID(const std::string &val) const
Returns the longID for this Arg.
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
int _value
The value of the switch.
void reset()
Clears the Arg object and allows it to be reused by new command lines.
int _default
Used to support the reset() method so that ValueArg can be reset to their constructed value.
A simple switch argument.
bool combinedSwitchesMatch(std::string &combined)
Checks a string to see if any of the chars in the string match the flag for this Switch.
A base class that defines the interface for visitors.