Represents a collection of key-value pairs. More...
#include <keyvaluecollection.h>
Public Types | |
| using | const_iterator = std::map< std::string, std::string >::const_iterator |
| Provides a bidirectional iterator that can read a const element in the collection. | |
Public Member Functions | |
| const_iterator | begin () const |
| Returns a const iterator to the beginning of the collection. More... | |
| const_iterator | end () const |
| Returns a const iterator to the end of the collection. More... | |
| std::string | get (const std::string &name) const |
| Gets the value of the specified key as a string. More... | |
| bool | getBool (const std::string &name) const |
| Gets the value of the specified key as a bool. More... | |
| QColor | getColor (const std::string &name) const |
| Gets the value of the specified key as a QColor. More... | |
| QString | getQString (const std::string &name) const |
| Gets the value of the specified key as a QString. More... | |
| double | getDouble (const std::string &name) const |
| Gets the value of the specified key as a double. More... | |
| int | getInt (const std::string &name) const |
| Gets the value of the specified key as an integer. More... | |
| template<typename ValueType , int N> | |
| std::array< ValueType, N > | getValues (const std::string &name) const |
| Gets an array of values from the specified key. More... | |
| void | set (const std::string &name, const std::string &value) |
| Sets the value of the specified key. More... | |
| void | setBool (const std::string &name, bool value) |
| Sets the value of the specified key as a bool. More... | |
| void | setColor (const std::string &name, const QColor &value) |
| Sets the value of the specified key as a QColor. More... | |
| void | setInt (const std::string &name, int value) |
| Sets the value of the specified key as an int. More... | |
| template<typename... T> | |
| void | setValues (const std::string &name, T...values) |
| Sets the value of the specified key as an array. More... | |
| void | setQString (const std::string &name, const QString &value) |
| Sets the value of the specified key as a QString. More... | |
| bool | trySet (const std::string &name, const std::string &value) |
| Attempts to set the value of the specified key. More... | |
Protected Attributes | |
|
std::map< std::string, std::string > | keyValueMap |
| Contains the key-value mappings in an std::map. | |
Represents a collection of key-value pairs.
| KeyValueCollection::const_iterator cavapa_gui::KeyValueCollection::begin | ( | ) | const |
Returns a const iterator to the beginning of the collection.
| KeyValueCollection::const_iterator cavapa_gui::KeyValueCollection::end | ( | ) | const |
Returns a const iterator to the end of the collection.
| std::string cavapa_gui::KeyValueCollection::get | ( | const std::string & | name | ) | const |
Gets the value of the specified key as a string.
| name | The name of the key to be retrieved. |
| bool cavapa_gui::KeyValueCollection::getBool | ( | const std::string & | name | ) | const |
Gets the value of the specified key as a bool.
| name | The name of the key to be retrieved. |
| QColor cavapa_gui::KeyValueCollection::getColor | ( | const std::string & | name | ) | const |
Gets the value of the specified key as a QColor.
| name | The name of the key to be retrieved. |
| double cavapa_gui::KeyValueCollection::getDouble | ( | const std::string & | name | ) | const |
Gets the value of the specified key as a double.
| name | The name of the key to be retrieved. |
| int cavapa_gui::KeyValueCollection::getInt | ( | const std::string & | name | ) | const |
Gets the value of the specified key as an integer.
| name | The name of the key to be retrieved. |
| QString cavapa_gui::KeyValueCollection::getQString | ( | const std::string & | name | ) | const |
Gets the value of the specified key as a QString.
| name | The name of the key to be retrieved. |
|
inline |
Gets an array of values from the specified key.
| name | The name of the key to be retrieved. |
| ValueType | The type of the values, either double or int. |
| N | The size of the array. |
| void cavapa_gui::KeyValueCollection::set | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Sets the value of the specified key.
| name | The name of the key to be set. |
| value | The value of the key. |
| void cavapa_gui::KeyValueCollection::setBool | ( | const std::string & | name, |
| bool | value | ||
| ) |
Sets the value of the specified key as a bool.
| name | The name of the key to be set. |
| value | The value of the key as a bool. |
| void cavapa_gui::KeyValueCollection::setColor | ( | const std::string & | name, |
| const QColor & | value | ||
| ) |
Sets the value of the specified key as a QColor.
| name | The name of the key to be set. |
| value | The value of the key as a QColor. |
| void cavapa_gui::KeyValueCollection::setInt | ( | const std::string & | name, |
| int | value | ||
| ) |
Sets the value of the specified key as an int.
| name | The name of the key to be set. |
| value | The value of the key as an int. |
| void cavapa_gui::KeyValueCollection::setQString | ( | const std::string & | name, |
| const QString & | value | ||
| ) |
Sets the value of the specified key as a QString.
| name | The name of the key to be set. |
| value | The value of the key as a QString. |
|
inline |
Sets the value of the specified key as an array.
| name | The name of the key to be set. |
| values | The values. |
| T | The type of the values, usually deduced automatically by the compiler. |
| bool cavapa_gui::KeyValueCollection::trySet | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Attempts to set the value of the specified key.
| name | The name of the key to be set. |
| value | The value of the key. |
1.8.7