15 #ifndef TCLAP_VALUE_ARGUMENT_H
16 #define TCLAP_VALUE_ARGUMENT_H
26 #if defined(HAVE_SSTREAM)
28 #elif defined(HAVE_STRSTREAM)
31 #error "Need a stringstream (sstream or strstream) to compile!"
38 namespace ValueArgHelper {
79 #if defined(HAVE_SSTREAM)
80 std::istringstream is(val);
81 #elif defined(HAVE_STRSTREAM)
82 std::istrstream is(val.c_str());
84 #error "Need a stringstream (sstream or strstream) to compile!"
90 if ( is.peek() != EOF )
101 if ( valuesRead > 1 )
156 class ValueArg :
public Arg
215 const std::string& name,
216 const std::string& desc,
219 const std::string& typeDesc,
248 const std::string& name,
249 const std::string& desc,
252 const std::string& typeDesc,
279 const std::string& name,
280 const std::string& desc,
309 const std::string& name,
310 const std::string& desc,
325 virtual bool processArg(
int* i, std::vector<std::string>& args);
336 virtual std::string
shortID(
const std::string& val =
"val")
const;
342 virtual std::string
longID(
const std::string& val =
"val")
const;
352 const std::string& name,
353 const std::string& desc,
356 const std::string& typeDesc,
358 :
Arg(flag, name, desc, req, true, v),
360 _typeDesc( typeDesc ),
366 const std::string& name,
367 const std::string& desc,
370 const std::string& typeDesc,
373 :
Arg(flag, name, desc, req, true, v),
375 _typeDesc( typeDesc ),
383 const std::string& name,
384 const std::string& desc,
389 :
Arg(flag, name, desc, req, true, v),
391 _typeDesc( constraint->shortID() ),
392 _constraint( constraint )
397 const std::string& name,
398 const std::string& desc,
404 :
Arg(flag, name, desc, req, true, v),
406 _typeDesc( constraint->shortID() ),
407 _constraint( constraint )
428 if ( _hasBlanks( args[*i] ) )
431 std::string flag = args[*i];
433 std::string value =
"";
434 trimFlag( flag, value );
436 if ( argMatches( flag ) )
443 "Couldn't find delimiter for this argument!",
449 if (
static_cast<unsigned int>(*i) < args.size() )
450 _extractValue( args[*i] );
456 _extractValue( value );
472 std::string stop_warnings = val;
482 std::string stop_warnings = val;
495 val +
"'", toString() ) );
499 "More than one valid value parsed from string '" +
500 val +
"'", toString() ) );
502 if ( _constraint != NULL )
503 if ( ! _constraint->check( _value ) )
505 "' does not meet constraint: " +
506 _constraint->description(),