26 #ifndef TCLAP_SWITCH_ARG_H 
   27 #define TCLAP_SWITCH_ARG_H 
   71         const std::string& name, 
 
   72         const std::string& desc,
 
   91         const std::string& name, 
 
   92         const std::string& desc,
 
  106   virtual bool processArg(
int* i, std::vector<std::string>& args); 
 
  126   virtual void reset();
 
  133   bool lastCombined(std::string& combined);
 
  138   void commonProcessing();
 
  145                 const std::string& name, 
 
  146                 const std::string& desc, 
 
  149   : 
Arg(flag, name, desc, false, false, v),
 
  150     _value( default_val ),
 
  151     _default( default_val )
 
  155                 const std::string& name, 
 
  156                 const std::string& desc, 
 
  160   : 
Arg(flag, name, desc, false, false, v),
 
  161     _value( default_val ),
 
  162     _default(default_val)
 
  167 inline bool SwitchArg::lastCombined(std::string& combinedSwitches ) 
 
  169   for ( 
unsigned int i = 1; i < combinedSwitches.length(); i++ )
 
  179   if ( combinedSwitches.length() > 0 &&
 
  189   if ( combinedSwitches.find_first_of(
Arg::delimiter()) != std::string::npos)
 
  194   for ( 
unsigned int i = 1; i < combinedSwitches.length(); i++ )
 
  195     if ( 
_flag.length() > 0 && 
 
  196      combinedSwitches[i] == 
_flag[0] &&
 
  211 inline void SwitchArg::commonProcessing()
 
  215                 "Mutually exclusive argument already set!", 
toString()));
 
  256       return lastCombined( args[*i] );
 
A virtual base class that defines the essential data for all arguments.
static char blankChar()
The char used as a place holder when SwitchArgs are combined.
void _checkWithVisitor() const
Performs the special handling described by the Visitor.
static const std::string nameStartString()
static bool ignoreRest()
Whether to ignore the rest.
bool _alreadySet
Indicates whether the argument has been set.
bool _ignoreable
Whether this argument can be ignored, if desired.
static char delimiter()
The delimiter that separates an argument flag/name from the value.
bool _xorSet
Indicates that the arg was set as part of an XOR and not on the command line.
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 toString() const
Returns a simple string representation of the argument.
std::string _flag
The single char flag used to identify the argument.
static const std::string flagStartString()
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,...
A simple switch argument.
bool _value
The value of the switch.
SwitchArg(const std::string &flag, const std::string &name, const std::string &desc, bool def=false, Visitor *v=NULL)
SwitchArg constructor.
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
bool getValue() const
Returns bool, whether or not the switch has been set.
bool _default
Used to support the reset() method so that ValueArg can be reset to their constructed value.
bool combinedSwitchesMatch(std::string &combined)
Checks a string to see if any of the chars in the string match the flag for this Switch.
virtual void reset()
Clears the Arg object and allows it to be reused by new command lines.
A base class that defines the interface for visitors.