#include <directives.h>
Inheritance diagram for conf::ConfInt< T >:
Public Member Functions | |
ConfInt (std::string const &name, bool reloadable, T minvalue, T maxvalue) | |
Constructor without default value. | |
ConfInt (std::string const &name, T const &defval, bool reloadable, T minvalue, T maxvalue) | |
Constructor with default value. | |
ConfInt (std::string const &name, bool reloadable) | |
ConfArray-specific constructor. | |
ConfInt (ConfInt const &cd) | |
Copy constructor. | |
virtual ConfInt< T > & | operator= (ConfInt< T > const &right) |
Assignment operator. | |
operator T () const | |
Conversion operator. | |
virtual char const * | label (size_t index) const |
Implements ConfDir::label(). | |
Protected Member Functions | |
virtual bool | assign (Conf &conf, unsigned short count, std::string const params[]) |
Sets the value. | |
virtual bool | check (Conf &conf, T const &value) const |
Checks if the value is in the m_minvalue..m_maxvalue range. | |
virtual bool | convert (Conf &conf, std::string const &expr, T &result) const |
Converts the string to an integer. | |
virtual T | my_strtol (char const *nptr, char **endptr, int base) const |
Calls the strtol() function. | |
Protected Attributes | |
T | m_minvalue |
T | m_maxvalue |
Conversions are done with strtol() (therefore the range of possible values is LONG_MIN..LONG_MAX). This can be changed by overriding the convert() and/or my_strtol() functions in derived classes. The class also overrides check() to refine range checking to the caller's need.
A conversion operator to the integer type T is provided as well for easy access to the value.
|
This constructor sets the directive name and whether it can be reloaded, along with the minimum and maximum values that will be accepted when the directive is set.
|
|
This constructor sets the directive name, default value and whether it can be reloaded, along with the minimum and maximum values that will be accepted when the directive is set.
|
|
Transforms the string array passed by the parser into the directive's value. This function must ensure that the value is valid through a call to check() before setting it (you don't need to set m_value_set to true, this will be handled by set() when the function returns successfully).
Implements conf::ConfValue< T >. |
|
Converts the given string to an integer, if possible. The my_strtol() function of the class is used to do the conversion.
Reimplemented in conf::ConfUint< T >. |
|
This function just calls the strtol() function. You may override it to call other strtol-like functions... Parameters are the same than those of the strtol() function, but the return value is different. Reimplemented in conf::ConfUint< T >. |