conf::ConfEnum< T > Class Template Reference

Class implementing an enum directive type. More...

#include <directives.h>

Inheritance diagram for conf::ConfEnum< T >:

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

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.

Detailed Description

template<class T = u_int32_t>
class conf::ConfEnum< T >

This class is used to store integer values that are set using predefined string representations.

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.


Member Function Documentation

template<class T = u_int32_t>
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;

Parameters:
[in] conf The Conf object that called the set() function.
Returns:
true if successful, false otherwise. You must log an error message through conf.error() in that case.


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