#include <ConfigurationSection.h>
Public Types | |
| typedef boost::shared_ptr< ConfigurationSection > | SharedPtr |
| A shared pointer to this type. | |
| typedef boost::shared_ptr< ConfigurationSection const > | ConstSharedPtr |
| A shared pointer to constant data of this type. | |
| typedef std::vector< ConfigurationSetting::SharedPtr > | SettingList |
| A list of pointers to the settings. | |
Public Member Functions | |
| ConfigurationSection (std::string const &name) | |
Constructs a new ConfigurationSection with the given name. | |
| std::string const & | getName () const |
| ConfigurationSection::SettingList | getSetting (std::string const &name) const |
Retrieves a list of settings in this section, or any child section, matching name. | |
| template<typename T> | |
| void | setSetting (std::string const &name, T const &value, ConfigurationSetting::AttributeList const &attributes, bool const unique=false) |
Sets a setting named name to value. | |
| template<typename T> | |
| void | setSetting (std::string const &name, T const &value, bool const unique=false) |
Sets a setting named name to value. | |
| void | setSetting (ConfigurationSetting const &setting, bool const unique=false) |
| Sets a setting specified by a ConfigurationSetting. | |
| void | addChildSection (ConfigurationSection::SharedPtr const childSection) |
| Adds a child section to this section. | |
| ConfigurationSection::SharedPtr | getChildSection (std::string const &name) |
| Retrieves a child section specified by the given name. | |
| size_t | getSettingCount () const |
| size_t | getSettingCount (std::string const &setting) const |
| Retrieves the number of settings in this section with the given name. | |
| ConfigurationSetting::AttributeList const & | getAttributes () const |
| ConfigurationSetting::AttributeList & | getAttributes () |
| void | setAttributes (ConfigurationSetting::AttributeList const &newAttributes) |
| Sets attributes for this section. | |
ConfigurationSections are the "nodes" in the setting hierarchy. The root of every document is a ConfigurationSection, which can contain other ConfigurationSections or ConfigurationSettings.
ConfigurationSections contain a list of settings and attributes associated with the section. They also contain a list of child sections. This allows for complex hierarchies of settings to be created easily.
| typedef boost::shared_ptr<ConfigurationSection> PWToolBox::Configuration::ConfigurationSection::SharedPtr |
A shared pointer to this type.
| typedef boost::shared_ptr<ConfigurationSection const> PWToolBox::Configuration::ConfigurationSection::ConstSharedPtr |
A shared pointer to constant data of this type.
| typedef std::vector<ConfigurationSetting::SharedPtr> PWToolBox::Configuration::ConfigurationSection::SettingList |
A list of pointers to the settings.
| PWToolBox::Configuration::ConfigurationSection::ConfigurationSection | ( | std::string const & | name | ) | [inline] |
Constructs a new ConfigurationSection with the given name.
| name | The name of the section |
| InvalidArgumentException | Thrown if the section name is empty. |
| std::string const& PWToolBox::Configuration::ConfigurationSection::getName | ( | ) | const [inline] |
| ConfigurationSection::SettingList PWToolBox::Configuration::ConfigurationSection::getSetting | ( | std::string const & | name | ) | const |
Retrieves a list of settings in this section, or any child section, matching name.
This function will take a name and return a list of settings matching that name. If name is in dot notataion (contains '.' characters), it will break the name apart into sections and look for the setting in the appropriate child section. For example, a name of "a.b.c" will look for the setting "c" in section "b", which is a child of section "a", which is a child of this section.
| name | The name of the settings in to retrieve. |
| InvalidArgumentException | Thrown if there are no settings by that name |
name | void PWToolBox::Configuration::ConfigurationSection::setSetting | ( | std::string const & | name, | |
| T const & | value, | |||
| ConfigurationSetting::AttributeList const & | attributes, | |||
| bool const | unique = false | |||
| ) | [inline] |
Sets a setting named name to value.
The name can be specified in dot notation (contains '.' characters). This allows easy inserting settings into sections deep within the heirarchy. If the setting or any of its parents do not exist, they are created.
If unique is specified, any existing settings by that name are removed before inserting the new value.
The value must be convertable to std::string.
| name | The name of the setting to set | |
| value | The value of the setting to set. | |
| attributes | The attributes to associate with this setting | |
| unique | true if this setting should be unique, false otherwise |
| InvalidArgumentException | Thrown if name is empty |
| void PWToolBox::Configuration::ConfigurationSection::setSetting | ( | std::string const & | name, | |
| T const & | value, | |||
| bool const | unique = false | |||
| ) | [inline] |
Sets a setting named name to value.
| void PWToolBox::Configuration::ConfigurationSection::setSetting | ( | ConfigurationSetting const & | setting, | |
| bool const | unique = false | |||
| ) |
Sets a setting specified by a ConfigurationSetting.
This allows ConfigurationSettings to be copied into the hierarchy. The implementation of this is an underlying call to another setSetting function, so all the documentation for other setSetting functions applies here.
| void PWToolBox::Configuration::ConfigurationSection::addChildSection | ( | ConfigurationSection::SharedPtr const | childSection | ) |
Adds a child section to this section.
This does not add sections to deeper levels in the hierarchy.
| childSection | The section to add as a child of this section |
| IllegalOperationException | Thrown when a child section with the same name already exists in this section |
| ConfigurationSection::SharedPtr PWToolBox::Configuration::ConfigurationSection::getChildSection | ( | std::string const & | name | ) |
Retrieves a child section specified by the given name.
The name can be in dot notation to retrieve sections deeper in the hierarchy.
| name | The name of the section to retrieve |
| IllegalOperationException | Thrown when a section of that name does not exist. |
| size_t PWToolBox::Configuration::ConfigurationSection::getSettingCount | ( | ) | const [inline] |
| size_t PWToolBox::Configuration::ConfigurationSection::getSettingCount | ( | std::string const & | setting | ) | const [inline] |
Retrieves the number of settings in this section with the given name.
| setting | The name of the setting to get the count of |
| ConfigurationSetting::AttributeList const& PWToolBox::Configuration::ConfigurationSection::getAttributes | ( | ) | const [inline] |
| ConfigurationSetting::AttributeList& PWToolBox::Configuration::ConfigurationSection::getAttributes | ( | ) | [inline] |
| void PWToolBox::Configuration::ConfigurationSection::setAttributes | ( | ConfigurationSetting::AttributeList const & | newAttributes | ) | [inline] |
Sets attributes for this section.
This replaces any previous attributes this section had.
| newAttributes | The attributes to set for this section |
1.5.1