25 #ifndef TCLAP_ARGUMENT_H
26 #define TCLAP_ARGUMENT_H
41 #if defined(HAVE_SSTREAM)
44 #elif defined(HAVE_STRSTREAM)
48 #error "Need a stringstream (sstream or strstream) to compile!"
71 static bool& ignoreRestRef() {
static bool ign =
false;
return ign; }
77 static char& delimiterRef() {
static char delim =
' ';
return delim; }
169 Arg(
const std::string& flag,
170 const std::string& name,
171 const std::string& desc,
186 virtual void addToList( std::list<Arg*>& argList )
const;
245 virtual bool processArg(
int *i, std::vector<std::string>& args) = 0;
257 const std::string&
getFlag()
const;
262 const std::string&
getName()
const;
310 virtual bool argMatches(
const std::string& s )
const;
316 virtual std::string
toString()
const;
322 virtual std::string
shortID(
const std::string& valueId =
"val" )
const;
328 virtual std::string
longID(
const std::string& valueId =
"val" )
const;
337 virtual void trimFlag( std::string& flag, std::string& value )
const;
345 bool _hasBlanks(
const std::string& s )
const;
370 virtual void reset();
394 template<
typename T>
void
397 static_cast<void>(vl);
401 while ( is.good() ) {
402 if ( is.peek() != EOF )
403 #ifdef TCLAP_SETBASE_ZERO
404 is >> std::setbase(0) >> destVal;
416 "from string '" + strVal +
"'"));
419 if ( valuesRead > 1 )
421 "string '" + strVal +
"'"));
431 template<
typename T>
void
434 static_cast<void>(sl);
443 const std::string& name,
444 const std::string& desc,
452 _requireLabel(
"required"),
453 _valueRequired(valreq),
458 _acceptsMultipleValues(false)
460 if (
_flag.length() > 1 )
462 "Argument flag can only be one character long",
toString() ) );
475 (
_name.find(
" ", 0 ) != std::string::npos ) )
503 inline std::string
Arg::longID(
const std::string& valueId )
const
536 std::string desc =
"";
603 for (
int i = 0;
static_cast<unsigned int>(i) < flag.length(); i++ )
612 value = flag.substr(stop+1);
613 flag = flag.substr(0,stop);
623 for (
int i = 1;
static_cast<unsigned int>(i) < s.length(); i++ )
646 argList.push_front( const_cast<Arg*>(
this) );