15 #ifndef TCLAP_MULTIPLE_ARGUMENT_H 16 #define TCLAP_MULTIPLE_ARGUMENT_H 26 #if defined(HAVE_SSTREAM) 28 #elif defined(HAVE_STRSTREAM) 31 #error "Need a stringstream (sstream or strstream) to compile!" 38 namespace MultiArgHelper {
81 #if defined(HAVE_SSTREAM) 82 std::istringstream is(val);
83 #elif defined(HAVE_STRSTREAM) 84 std::istrstream is(val.c_str());
86 #error "Need a stringstream (sstream or strstream) to compile!" 93 if ( is.peek() != EOF )
104 if ( valuesRead > 1 )
107 _values.push_back(temp);
184 void _extractValue(
const std::string& val );
208 const std::string& name,
209 const std::string& desc,
211 const std::string& typeDesc,
233 const std::string& name,
234 const std::string& desc,
236 const std::string& typeDesc,
256 const std::string& name,
257 const std::string& desc,
279 const std::string& name,
280 const std::string& desc,
294 virtual bool processArg(
int* i, std::vector<std::string>& args);
300 const std::vector<T>& getValue();
306 virtual std::string shortID(
const std::string& val=
"val")
const;
312 virtual std::string longID(
const std::string& val=
"val")
const;
318 virtual bool isRequired()
const;
320 virtual bool allowMore();
326 const std::string& name,
327 const std::string& desc,
329 const std::string& typeDesc,
331 :
Arg( flag, name, desc, req, true, v ),
332 _typeDesc( typeDesc ),
341 const std::string& name,
342 const std::string& desc,
344 const std::string& typeDesc,
347 :
Arg( flag, name, desc, req, true, v ),
361 const std::string& name,
362 const std::string& desc,
366 :
Arg( flag, name, desc, req, true, v ),
376 const std::string& name,
377 const std::string& desc,
382 :
Arg( flag, name, desc, req, true, v ),
403 std::string flag = args[*i];
404 std::string value =
"";
412 "Couldn't find delimiter for this argument!",
419 if ( static_cast<unsigned int>(*i) < args.size() )
495 "from string '" + val +
"'",
toString() ) );
499 "parsed from string '" + val +
"'",
504 "' does not meet constraint: " +
virtual bool argMatches(const std::string &s) const
TCLAP command line argument parser classes.
TCLAP command line argument parser classes.
TClap class indirectly used to define the interface for visitors.
virtual bool processArg(int *i, std::vector< std::string > &args)
Managing interface for The base class that manages the command line definition and passes along the p...
Virtual parent for all the different argument classes.
virtual std::string longID(const std::string &valueId="val") const
virtual void trimFlag(std::string &flag, std::string &value) const
virtual std::string toString() const
Defines the interaction between an argument and a constraint.
Defines the exception that is thrown when an argument is improperly parsed.
Constraint< T > * _constraint
bool _acceptsMultipleValues
virtual void add(Arg &a)=0
MultiArg(const std::string &flag, const std::string &name, const std::string &desc, bool req, const std::string &typeDesc, Visitor *v=NULL)
bool _hasBlanks(const std::string &s) const
Defines the exception when an argument is improperly specified.
virtual std::string longID(const std::string &val="val") const
virtual std::string shortID(const std::string &valueId="val") const
void _extractValue(const std::string &val)
void _checkWithVisitor() const
const std::vector< T > & getValue()
virtual bool isRequired() const
virtual std::string shortID(const std::string &val="val") const