Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Private Types | Static Private Member Functions | Friends
utilmm::config_set Class Reference

#include <configset.hh>

Inheritance diagram for utilmm::config_set:
Inheritance graph
[legend]

List of all members.

Public Types

typedef std::list< const
config_set * > 
subsets

Public Member Functions

config_set const & child (std::string const &name) const
std::list< const config_set * > children (const std::string &name) const
 config_set (config_set *parent=0)
bool empty () const
void erase (std::string const &name)
bool exists (const std::string &attribute) const
template<typename T >
get (std::string const &name, T const &defval=T(), typename boost::enable_if< details::is_list< T > >::type *enabler=0) const
template<typename T >
get (std::string const &name, T const &defval=T(), typename boost::disable_if< details::is_list< T > >::type *enabler=0) const
template<>
config_set::stringlist get (const std::string &name, stringlist const &defval, boost::enable_if< details::is_list< config_set::stringlist > >::type *dummy) const
void insert (std::string const &name, std::string const &value)
void insert (std::string const &name, std::list< std::string > const &value)
void insert (std::string const &name, config_set const *value)
const config_setparent () const
config_setparent ()
void set (std::string const &name, std::string const &value)
void set (std::string const &name, std::list< std::string > const &value)
 ~config_set ()

Protected Types

typedef std::multimap
< std::string, const
config_set * > 
ChildMap
typedef std::multimap
< std::string, std::string > 
ValueMap

Protected Member Functions

void clear ()

Protected Attributes

ChildMap m_children
config_setm_parent
ValueMap m_values

Private Types

typedef std::list< std::string > stringlist

Static Private Member Functions

template<typename T >
static T convert (std::string const &value)

Friends

class ConfigFile

Detailed Description

A scope in configuration files

Definition at line 24 of file configset.hh.


Member Typedef Documentation

typedef std::multimap<std::string, const config_set*> utilmm::config_set::ChildMap [protected]

Definition at line 38 of file configset.hh.

typedef std::list<std::string> utilmm::config_set::stringlist [private]

Definition at line 30 of file configset.hh.

typedef std::list<const config_set*> utilmm::config_set::subsets

Definition at line 49 of file configset.hh.

typedef std::multimap<std::string, std::string> utilmm::config_set::ValueMap [protected]

Definition at line 36 of file configset.hh.


Constructor & Destructor Documentation

config_set::config_set ( config_set parent = 0) [explicit]

Definition at line 7 of file configset.cc.

Definition at line 10 of file configset.cc.


Member Function Documentation

config_set const & config_set::child ( std::string const &  name) const

Get the first child named name or an empty set

Definition at line 48 of file configset.cc.

list< const config_set * > config_set::children ( const std::string &  name) const

Get the list of children named name

Definition at line 30 of file configset.cc.

void config_set::clear ( ) [protected]

Clears this set

Definition at line 17 of file configset.cc.

template<typename T >
T utilmm::config_set::convert ( std::string const &  value) [static, private]

Definition at line 89 of file configset.cc.

bool config_set::empty ( ) const

Checks if this set is empty (no child, no attributes)

Definition at line 15 of file configset.cc.

void config_set::erase ( std::string const &  name)

Remove the given option

Definition at line 84 of file configset.cc.

bool config_set::exists ( const std::string &  attribute) const

Tests for the existence of an attribute

Definition at line 57 of file configset.cc.

template<typename T >
T utilmm::config_set::get ( std::string const &  name,
T const &  defval = T(),
typename boost::enable_if< details::is_list< T > >::type *  enabler = 0 
) const

In a config_set object, all values are stored as lists of strings. This method converts the stored value into the required type using the associated config_set::convert template specialization (if it exists).

If no value is stored under the given key, returns defval

Definition at line 123 of file configset.hh.

template<typename T >
T utilmm::config_set::get ( std::string const &  name,
T const &  defval = T(),
typename boost::disable_if< details::is_list< T > >::type *  enabler = 0 
) const

In a config_set object, all values are stored as lists of strings. This method is a convenience method when only one value is stored for a given key. It converts the stored value into the required type using the associated config_set::convert template specialization (if it exists).

If no value is associated with the key, returns defval

Definition at line 138 of file configset.hh.

config_set::stringlist utilmm::config_set::get ( const std::string &  name,
stringlist const &  defval,
boost::enable_if< details::is_list< config_set::stringlist > >::type *  dummy 
) const

Definition at line 100 of file configset.cc.

void config_set::insert ( std::string const &  name,
std::string const &  value 
)

Appends the given value to the values already associated with name

Definition at line 64 of file configset.cc.

void config_set::insert ( std::string const &  name,
std::list< std::string > const &  value 
)

Appends the given values to the valus already associated with name

Definition at line 66 of file configset.cc.

void config_set::insert ( std::string const &  name,
config_set const *  value 
)

Add a child to this config_set

Definition at line 72 of file configset.cc.

const config_set * config_set::parent ( ) const

The parent config_set object

Returns:
the config_set object for our parent scope, or 0 if this scope is top-level

Definition at line 28 of file configset.cc.

Definition at line 29 of file configset.cc.

void config_set::set ( std::string const &  name,
std::string const &  value 
)

Replaces any value associated with name with the value provided. See insert to append new values to already existing ones

Definition at line 74 of file configset.cc.

void config_set::set ( std::string const &  name,
std::list< std::string > const &  value 
)

Sets multiple values for this key. If some value was already associated with name, the new value replaces it. See insert to append new values to already existing ones.

Definition at line 79 of file configset.cc.


Friends And Related Function Documentation

friend class ConfigFile [friend]

Definition at line 27 of file configset.hh.


Member Data Documentation

Definition at line 39 of file configset.hh.

Definition at line 35 of file configset.hh.

Definition at line 37 of file configset.hh.


The documentation for this class was generated from the following files:


utilmm
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:31