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 )
159 class MultiArg :
public Arg
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);
306 virtual std::string
shortID(
const std::string& val=
"val")
const;
312 virtual std::string
longID(
const std::string& val=
"val")
const;
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 ),
336 _acceptsMultipleValues =
true;
341 const std::string& name,
342 const std::string& desc,
344 const std::string& typeDesc,
347 :
Arg( flag, name, desc, req, true, v ),
348 _typeDesc( typeDesc ),
353 _acceptsMultipleValues =
true;
361 const std::string& name,
362 const std::string& desc,
366 :
Arg( flag, name, desc, req, true, v ),
367 _typeDesc( constraint->shortID() ),
368 _constraint( constraint ),
371 _acceptsMultipleValues =
true;
376 const std::string& name,
377 const std::string& desc,
382 :
Arg( flag, name, desc, req, true, v ),
383 _typeDesc( constraint->shortID() ),
384 _constraint( constraint ),
388 _acceptsMultipleValues =
true;
400 if ( _hasBlanks( args[*i] ) )
403 std::string flag = args[*i];
404 std::string value =
"";
406 trimFlag( flag, value );
408 if ( argMatches( flag ) )
412 "Couldn't find delimiter for this argument!",
419 if (
static_cast<unsigned int>(*i) < args.size() )
420 _extractValue( args[*i] );
426 _extractValue( value );
462 std::string
id =
Arg::longID(_typeDesc) +
" (accepted multiple times)";
476 if ( _values.size() > 1 )
495 "from string '" + val +
"'", toString() ) );
499 "parsed from string '" + val +
"'",
501 if ( _constraint != NULL )
502 if ( ! _constraint->check( _values.back() ) )
504 "' does not meet constraint: " +
505 _constraint->description(),
512 bool am = _allowMore;