conf::ConfDuration Class Reference

Class implementing a duration directive type. More...

#include <directives.h>

Inheritance diagram for conf::ConfDuration:

conf::ConfValue< time_t > conf::ConfDir List of all members.

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 ConfDurationoperator= (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.

Detailed Description

This class is used to store duration values.

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.


Constructor & Destructor Documentation

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.

Parameters:
[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.

Parameters:
[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.


Member Function Documentation

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).

Parameters:
[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).
Returns:
true if the function is successful, false otherwise (conf.error() should have be called with an appropriate error message in that case).

Implements conf::ConfValue< time_t >.


The documentation for this class was generated from the following file:
Generated on Sun May 20 21:32:17 2007 for Epona API by  doxygen 1.4.6