#include <directives.h>
Inheritance diagram for conf::ConfEnum< T >:
Public Types | |
typedef std::map< std::string, T, misc::insensitive_less > | ValueList |
Public Member Functions | |
ConfEnum (std::string const &name, bool reloadable) | |
Constructor setting the directive name. | |
ConfEnum (std::string const &name, T const &defval, bool reloadable) | |
Constructor setting the directive name and default value. | |
ConfEnum (ConfEnum const &cd) | |
Copy constructor. | |
virtual ConfEnum< T > & | operator= (ConfEnum< T > const &right) |
Assignment operator. | |
operator T const & () const | |
Conversion operator. | |
virtual char const * | label (size_t index) const |
Implements ConfDir::label(). | |
Protected Member Functions | |
virtual bool | add (Conf &conf)=0 |
Adds valid values to the list. | |
virtual bool | assign (Conf &conf, unsigned short count, std::string const params[]) |
Sets the value using its string representation in params[0]. | |
Protected Attributes | |
ValueList | m_values |
The list of values. |
This class must not be used directly. Instead, it must be inherited, and the add() function should be overriden to add all possible values to m_values.
The template parameter is the type in which values will be stored. A conversion operator to this type is provided for easy access to the value.
virtual bool conf::ConfEnum< T >::add | ( | Conf & | conf | ) | [protected, pure virtual] |
This function adds valid values to the m_values list. It must be defined in an inherited class. Example of adding a value to the list. m_values["SOMETHING"] = 3;