conf::ConfRatio Class Reference

Class implementing a ratio directive type. More...

#include <directives.h>

Inheritance diagram for conf::ConfRatio:

conf::ConfValue< misc::Ratio > conf::ConfDir

List of all members.

Public Member Functions

 ConfRatio (std::string const &name, bool reloadable, int32_t minx, int32_t maxx, int32_t miny, int32_t maxy)
 Constructor without default value.
 ConfRatio (std::string const &name, misc::Ratio const &defval, bool reloadable, int32_t minx, int32_t maxx, int32_t miny, int32_t maxy)
 Constructor with default value.
 ConfRatio (std::string const &name, bool reloadable)
 ConfArray-specific constructor.
 ConfRatio (ConfRatio const &cd)
 Copy constructor.
virtual ConfRatiooperator= (ConfRatio const &right)
 Assignment 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, misc::Ratio value) const
 Checks for ranges of value.x() and value.y().

Protected Attributes

time_t m_minx
 The minimum X value.
time_t m_maxx
 The maximum X value.
time_t m_miny
 The minimum Y value.
time_t m_maxy
 The maximum Y value.


Detailed Description

This class is used to store ratio values.

It converts string expressions of a ratio in the form x:y where x and y are integers, to a value of the Ratio class.


Constructor & Destructor Documentation

conf::ConfRatio::ConfRatio ( std::string const &  name,
bool  reloadable,
int32_t  minx,
int32_t  maxx,
int32_t  miny,
int32_t  maxy 
) [inline, explicit]

This constructor sets the directive name and whether it can be reloaded, along with the minimum and maximum X and Y values 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] minx The minimum X to accept as a value.
[in] maxx The maximum X to accept as a value.
[in] miny The minimum Y to accept as a value.
[in] maxy The maximum Y to accept as a value.

conf::ConfRatio::ConfRatio ( std::string const &  name,
misc::Ratio const &  defval,
bool  reloadable,
int32_t  minx,
int32_t  maxx,
int32_t  miny,
int32_t  maxy 
) [inline]

This constructor sets the directive name, default value and whether it can be reloaded, along with the minimum and maximum X and Y values 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] minx The minimum X to accept as a value.
[in] maxx The maximum X to accept as a value.
[in] miny The minimum Y to accept as a value.
[in] maxy The maximum Y to accept as a value.


Member Function Documentation

virtual bool conf::ConfRatio::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< misc::Ratio >.


The documentation for this class was generated from the following file:
Generated on Fri Apr 18 22:03:28 2008 for Epona API by  doxygen 1.5.3