#include <directives.h>
Inheritance diagram for conf::ConfArray< ValueT, ContainerT >:

Public Types | |
| typedef ValueT | value_type |
| The value type. | |
| typedef ContainerT | container_type |
Public Member Functions | |
| ConfArray (std::string const &name, bool reloadable=true, typename ContainerT::size_type max=INT_MAX) | |
| Constructor. | |
| ConfArray (std::string const &name, ContainerT const &defval, bool reloadable=true, typename ContainerT::size_type max=INT_MAX) | |
| Constructor setting a default value. | |
| ConfArray (ConfArray const &cd) | |
| Copy constructor. | |
|
virtual ConfArray< ValueT, ContainerT > & | operator= (ConfArray< ValueT, ContainerT > const &right) |
| Assignment operator. | |
| operator ContainerT const & () const | |
| Conversion operator. | |
| ContainerT const & | operator * () const |
| Provides access to the underlying container. | |
| ContainerT const * | operator-> () const |
| Provides access to the underlying container. | |
| virtual char const * | label (size_t index) const |
| Implements ConfDir::label(). | |
| virtual size_t | label_count () const |
| Implements ConfDir::label_count(). | |
Protected Member Functions | |
| virtual bool | assign (Conf &conf, unsigned short count, std::string const params[]) |
| Sets the value. | |
| virtual ContainerT::iterator | insert () |
| Inserts a new ValueT object in the container. | |
Protected Attributes | |
| ContainerT::size_type | m_max_values |
The template also lets you choose the container type you want to use to implement the array (it will work as long as the container has insert(iterator pos, T const &value), clear() and size() functions -- which is the case of all containers of the C++ STL.
Operators * and -> are overloaded so you can easily access the internal container object. A conversion operator to the container type is also provided.
Example of use:
ConfArray<ConfBool, std::vector<ConfBool> > array;
Caveat:
|
||||||||||||||||||||
|
This constructor sets the directive name and the maximum number of values that can be added to the container.
|
|
||||||||||||||||||||||||
|
This constructor sets the directive name, default value and the maximum number of values that can be added to the container.
|
|
||||||||||||||||||||
|
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).
Implements conf::ConfValue< ContainerT >. |
|
|||||||||
|
Inserts a new ValueT directive (that the function is responsible to create) in the container, through a call to the ContainerT::insert(iterator, ValueT) function. It must name the new directive as the name[n] where name is this directive name and n is ContainerT::size().
|
1.4.6