#include <settings.h>
Public Member Functions | |
| SettingMap (const QDomElement &node, const QString &element, const QString &key) | |
| uint | size () const |
| Settings | get (const Key &index) const |
| Settings | insert (const Key &index) |
| void | clear () |
Protected Member Functions | |
| virtual QDomElement | node () const |
Protected Attributes | |
| QDomElement | m_node |
| QString | m_element |
| QString | m_key |
A setting map is a collection of setting nodes, all having the same parent node and the same name, and containing an inner node acting as a key. The following is an example of how the configuration node containing a setting map may look like. The element name is "event" and the key name is "name".
<event> <name>click</name> <action>action1</action> </event> <event> <name>double-click</name> <action>action2</action> </event>
Other than the key, each element of the map may contain any arbitrarily nested nodes.
To use a map, you simply access its elements by keys using the get member function, which returns a Settings object associated to the specified element.
Elements are cached as an STL map, which is kept in sync with the configuration file, so read operation have the same complexity of the corresponding STL operations (i.e. logarithmic).
| uint SettingMap< Key >::size | ( | ) | const [inline] |
| Settings SettingMap< Key >::get | ( | const Key & | index | ) | const |
Retrieve an element by key.
| index | The key of the element. |
| Settings SettingMap< Key >::insert | ( | const Key & | index | ) |
Insert an element into the map.
| index | The key of the element. |
| void SettingMap< Key >::clear | ( | ) |
Clear the map, removing all its elements.
1.5.1