Public Member Functions | |
Integer (const int lower_bound=min_int_value, const int upper_bound=max_int_value) | |
virtual bool | match (const std::string &test_string) const |
virtual std::string | description () const |
virtual PatternBase * | clone () const |
Static Public Attributes | |
static const int | min_int_value |
static const int | max_int_value |
Private Attributes | |
const int | lower_bound |
const int | upper_bound |
If the upper bound given to the constructor is smaller than the lower bound, then the infinite interval is implied, i.e. every integer is allowed.
Giving bounds may be useful if for example a value can only be positive and less than a reasonable upper bound (for example the number of refinement steps to be performed), or in many other cases.
Patterns::Integer::Integer | ( | const int | lower_bound = min_int_value , |
|
const int | upper_bound = max_int_value | |||
) |
Constructor. Bounds can be specified within which a valid parameter has to be. If the upper bound is smaller than the lower bound, then the infinite interval is meant. The default values are chosen such that no bounds are enforced on parameters.
virtual bool Patterns::Integer::match | ( | const std::string & | test_string | ) | const [virtual] |
Return true
if the string is an integer and its value is within the specified range.
Implements Patterns::PatternBase.
virtual std::string Patterns::Integer::description | ( | ) | const [virtual] |
Return a description of the pattern that valid strings are expected to match. If bounds were specified to the constructor, then include them into this description.
Implements Patterns::PatternBase.
virtual PatternBase* Patterns::Integer::clone | ( | ) | const [virtual] |
Return a copy of the present object, which is newly allocated on the heap. Ownership of that object is transferred to the caller of this function.
Implements Patterns::PatternBase.
const int Patterns::Integer::min_int_value [static] |
Minimal integer value. If the numeric_limits class is available use this information to obtain the extremal values, otherwise set it so that this class understands that all values are allowed.
const int Patterns::Integer::max_int_value [static] |
Maximal integer value. If the numeric_limits class is available use this information to obtain the extremal values, otherwise set it so that this class understands that all values are allowed.
const int Patterns::Integer::lower_bound [private] |
Value of the lower bound. A number that satisfies the match operation of this class must be equal to this value or larger, if the bounds of the interval for a valid range.
const int Patterns::Integer::upper_bound [private] |
Value of the upper bound. A number that satisfies the match operation of this class must be equal to this value or less, if the bounds of the interval for a valid range.