24#ifndef TCLAP_VALUES_CONSTRAINT_H
25#define TCLAP_VALUES_CONSTRAINT_H
62 virtual std::string
shortID()
const;
69 virtual bool check(
const T &value)
const;
85 : _allowed(allowed), _typeDesc(
"") {
86 for (
unsigned int i = 0; i <
_allowed.size(); i++) {
87 std::ostringstream os;
90 std::string temp(os.str());
99 return std::find(_allowed.begin(), _allowed.end(), val) != _allowed.end();
The interface that defines the interaction between the Arg and Constraint.
A Constraint that constrains the Arg to only those values specified in the constraint.
std::string _typeDesc
The string used to describe the allowed values of this constraint.
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 description() const
Returns a description of the Constraint.
virtual ~ValuesConstraint()
Virtual destructor.
ValuesConstraint(const std::vector< T > &allowed)
Constructor.
std::vector< T > _allowed
The list of valid values.
virtual std::string shortID() const
Returns the short ID for the Constraint.