|
Util--
1.1
|
#include <utilmm/configfile/configset.hh>


Public Types | |
| typedef std::list< const config_set * > | subsets |
Public Member Functions | |
| config_set (config_set *parent=0) | |
| ~config_set () | |
| bool | empty () const |
| bool | exists (const std::string &attribute) const |
| const config_set * | parent () const |
| config_set * | parent () |
| std::list< const config_set * > | children (const std::string &name) const |
| config_set const & | child (std::string const &name) const |
| template<typename T > | |
| 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 > | |
| T | get (std::string const &name, T const &defval=T(), typename boost::disable_if< details::is_list< T > >::type *enabler=0) const |
| void | set (std::string const &name, std::string const &value) |
| void | set (std::string const &name, std::list< std::string > const &value) |
| 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) |
| void | erase (std::string const &name) |
| template<> | |
| bool | convert (std::string const &value) |
| template<> | |
| config_set::stringlist | get (std::string const &name, config_set::stringlist const &defval, boost::enable_if< details::is_list< config_set::stringlist > >::type *enabler) const |
Protected Types | |
| typedef std::multimap < std::string, std::string > | ValueMap |
| typedef std::multimap < std::string, const config_set * > | ChildMap |
Protected Member Functions | |
| void | clear () |
Protected Attributes | |
| config_set * | m_parent |
| ValueMap | m_values |
| ChildMap | m_children |
Friends | |
| class | ConfigFile |
A scope in configuration files
|
protected |
| typedef std::list<const config_set*> utilmm::config_set::subsets |
|
protected |
|
explicit |
| utilmm::config_set::~config_set | ( | ) |
| config_set const& utilmm::config_set::child | ( | std::string const & | name | ) | const |
Get the first child named name or an empty set
| std::list<const config_set*> utilmm::config_set::children | ( | const std::string & | name | ) | const |
Get the list of children named name
|
protected |
Clears this set
| bool utilmm::config_set::convert | ( | std::string const & | value | ) |
| bool utilmm::config_set::empty | ( | ) | const |
Checks if this set is empty (no child, no attributes)
| void utilmm::config_set::erase | ( | std::string const & | name | ) |
Remove the given option
| bool utilmm::config_set::exists | ( | const std::string & | attribute | ) | const |
Tests for the existence of an attribute
| 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
| 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
| config_set::stringlist utilmm::config_set::get | ( | std::string const & | name, |
| config_set::stringlist const & | defval, | ||
| boost::enable_if< details::is_list< config_set::stringlist > >::type * | enabler | ||
| ) | const |
| void utilmm::config_set::insert | ( | std::string const & | name, |
| std::string const & | value | ||
| ) |
Appends the given value to the values already associated with name
| void utilmm::config_set::insert | ( | std::string const & | name, |
| std::list< std::string > const & | value | ||
| ) |
Appends the given values to the valus already associated with name
| void utilmm::config_set::insert | ( | std::string const & | name, |
| config_set const * | value | ||
| ) |
Add a child to this config_set
| const config_set* utilmm::config_set::parent | ( | ) | const |
The parent config_set object
| config_set* utilmm::config_set::parent | ( | ) |
| void utilmm::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
| void utilmm::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.
|
friend |
|
protected |
|
protected |
|
protected |
1.8.6