#include <directives.h>
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 ConfRatio & | operator= (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. |
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.
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.
[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.
[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. |
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).
[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< misc::Ratio >.