31 #include <cmdLine/cmdArg.h>
39 class SwitchArg :
public DtCmdLine::Arg
67 const std::string& name,
68 const std::string& desc,
70 DtCmdLine::Visitor* v = NULL);
87 const std::string& name,
88 const std::string& desc,
90 DtCmdLine::CmdLineInterface& parser,
91 DtCmdLine::Visitor* v = NULL);
102 virtual bool processArg(
int* i, std::vector<std::string>& args);
125 const std::string& name,
126 const std::string& desc,
128 DtCmdLine::Visitor* v )
129 : DtCmdLine::
Arg(flag, name, desc, false, false, v),
134 const std::string& name,
135 const std::string& desc,
137 DtCmdLine::CmdLineInterface& parser,
138 DtCmdLine::Visitor* v )
139 :
Arg(flag, name, desc, false, false, v),
147 inline SwitchArg::operator
bool() {
return _value; }
152 if ( combinedSwitches[0] != Arg::flagStartString()[0] )
156 if ( combinedSwitches.substr( 0, Arg::nameStartString().length() ) ==
157 Arg::nameStartString() )
162 for (
unsigned int i = 1; i < combinedSwitches.length(); i++ )
163 if ( !_flag.empty() && combinedSwitches[i] == _flag[0] )
169 combinedSwitches[i] = Arg::blankChar();
180 if ( _ignoreable && Arg::ignoreRest() )
189 if ( argMatches( args[*i] ) )
193 throw(DtCmdLine::CmdLineParseException(
"Argument already set!", toString()));
Make the types of arguments of a function dependent on the types in a function pointer.
Definition: DtAgent.h:44
virtual bool processArg(int *i, std::vector< std::string > &args)
Handles the processing of the argument.
Definition: DtVrvCmdSwitchArg.h:178
SwitchArg(const std::string &flag, const std::string &name, const std::string &desc, bool def, DtCmdLine::Visitor *v=NULL)
SwitchArg constructor.
Definition: DtVrvCmdSwitchArg.h:124
bool combinedSwitchesMatch(std::string &combined)
Checks a string to see if any of the chars in the string match the flag for this Switch.
Definition: DtVrvCmdSwitchArg.h:149
bool getValue() const
Returns bool, whether or not the switch has been set.
Definition: DtVrvCmdSwitchArg.h:145
bool _value
The value of the switch.
Definition: DtVrvCmdSwitchArg.h:49