Go to the documentation of this file.
23 #ifndef TCLAP_VALUESCONSTRAINT_H
24 #define TCLAP_VALUESCONSTRAINT_H
42 class ValuesConstraint :
public Constraint<T>
66 virtual std::string
shortID()
const;
73 virtual bool check(
const T& value)
const;
94 for (
unsigned int i = 0; i < _allowed.size(); i++ )
97 #if defined(HAVE_SSTREAM)
99 #elif defined(HAVE_STRSTREAM)
102 #error "Need a stringstream (sstream or strstream) to compile!"
107 std::string temp( os.str() );
118 if ( std::find(_allowed.begin(),_allowed.end(),val) == _allowed.end() )
std::ostringstream ostringstream
ValuesConstraint(std::vector< T > &allowed)
Constructor.
std::vector< T > _allowed
The list of valid values.
virtual bool check(const T &value) const
The method used to verify that the value parsed from the command line meets the constraint.
virtual std::string shortID() const
Returns the short ID for the Constraint.
std::string _typeDesc
The string used to describe the allowed values of this constraint.
virtual ~ValuesConstraint()
Virtual destructor.
virtual std::string description() const
Returns a description of the Constraint.