#include <directives.h>

Public Member Functions | |
| ConfDuration (std::string const &name, bool reloadable, time_t mindur, time_t maxdur) | |
| Constructor without default value. | |
| ConfDuration (std::string const &name, time_t defval, bool reloadable, time_t mindur, time_t maxdur) | |
| Constructor with default value. | |
| ConfDuration (std::string const &name, bool reloadable) | |
| ConfArray-specific constructor. | |
| ConfDuration (ConfDuration const &cd) | |
| Copy constructor. | |
| virtual ConfDuration & | operator= (ConfDuration const &right) |
| Assignment operator. | |
| operator time_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, time_t value) const |
| Checks if the duration is in the range m_mindur..m_maxdur. | |
Protected Attributes | |
| time_t | m_mindur |
| The minimum duration. | |
| time_t | m_maxdur |
| The maximum duration. | |
It converts string expressions of a duration to a number of seconds. The conversion function used to do the job is duration_scan() from the misc library. See its help for more information about valid expressions.
A conversion operator to time_t is provided for easy value access.
| conf::ConfDuration::ConfDuration | ( | std::string const & | name, | |
| bool | reloadable, | |||
| time_t | mindur, | |||
| time_t | maxdur | |||
| ) | [inline, explicit] |
This constructor sets the directive name and whether it can be reloaded, along with the minimum and maximum duration that will be accepted when the directive is set.
| [in] | name | The name of the directive |
| [in] | reloadable | true if the directive can be reloaded, false otherwise. |
| [in] | mindur | The minimum duration to accept as a value. |
| [in] | maxdur | The maximum duration to accept as a value. |
| conf::ConfDuration::ConfDuration | ( | std::string const & | name, | |
| time_t | defval, | |||
| bool | reloadable, | |||
| time_t | mindur, | |||
| time_t | maxdur | |||
| ) | [inline] |
This constructor sets the directive name, default value and whether it can be reloaded, along with the minimum and maximum duration that will be accepted when the directive is set.
| [in] | name | The name of the directive |
| [in] | defval | The default value. |
| [in] | reloadable | true if the directive can be reloaded, false otherwise. |
| [in] | mindur | The minimum duration to accept as a value. |
| [in] | maxdur | The maximum duration to accept as a value. |
| virtual bool conf::ConfDuration::assign | ( | Conf & | conf, | |
| unsigned short | count, | |||
| std::string const | params[] | |||
| ) | [protected, virtual] |
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).
| [in] | conf | The Conf object that called set(). |
| [in] | count | Number of parameters in params. |
| [in] | params | Parameters passed to the directive (NULL if count is 0). |
Implements conf::ConfValue< time_t >.
1.5.3