QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML in. More...
#include <qgsobjectcustomproperties.h>
Public Member Functions | |
QgsObjectCustomProperties ()=default | |
bool | contains (const QString &key) const |
Returns true if the properties contains a key with the specified name. | |
QStringList | keys () const |
Returns a list of all stored keys. | |
void | readXml (const QDomNode &parentNode, const QString &keyStartsWith=QString()) |
Read store contents from an XML node. | |
void | remove (const QString &key) |
Removes a key (entry) from the store. | |
void | setValue (const QString &key, const QVariant &value) |
Add an entry to the store with the specified key. | |
QVariant | value (const QString &key, const QVariant &defaultValue=QVariant()) const |
Returns the value for the given key. | |
void | writeXml (QDomNode &parentNode, QDomDocument &doc) const |
Writes the store contents to an XML node. | |
Protected Attributes | |
QMap< QString, QVariant > | mMap |
Simple key-value store (keys = strings, values = variants) that supports loading/saving to/from XML in.
<customproperties>
element.
Definition at line 34 of file qgsobjectcustomproperties.h.
|
default |
bool QgsObjectCustomProperties::contains | ( | const QString & | key | ) | const |
Returns true
if the properties contains a key with the specified name.
Definition at line 46 of file qgsobjectcustomproperties.cpp.
QStringList QgsObjectCustomProperties::keys | ( | ) | const |
Returns a list of all stored keys.
Definition at line 26 of file qgsobjectcustomproperties.cpp.
void QgsObjectCustomProperties::readXml | ( | const QDomNode & | parentNode, |
const QString & | keyStartsWith = QString() |
||
) |
Read store contents from an XML node.
parentNode | node to read from |
keyStartsWith | reads only properties starting with the specified string (or all if the string is empty) |
Definition at line 51 of file qgsobjectcustomproperties.cpp.
void QgsObjectCustomProperties::remove | ( | const QString & | key | ) |
Removes a key (entry) from the store.
Definition at line 41 of file qgsobjectcustomproperties.cpp.
void QgsObjectCustomProperties::setValue | ( | const QString & | key, |
const QVariant & | value | ||
) |
Add an entry to the store with the specified key.
If an entry with the same key exists already, it will be overwritten.
Definition at line 31 of file qgsobjectcustomproperties.cpp.
QVariant QgsObjectCustomProperties::value | ( | const QString & | key, |
const QVariant & | defaultValue = QVariant() |
||
) | const |
Returns the value for the given key.
If the key is not present in the properties, the defaultValue will be returned.
Definition at line 36 of file qgsobjectcustomproperties.cpp.
void QgsObjectCustomProperties::writeXml | ( | QDomNode & | parentNode, |
QDomDocument & | doc | ||
) | const |
Writes the store contents to an XML node.
Definition at line 124 of file qgsobjectcustomproperties.cpp.
|
protected |
Definition at line 88 of file qgsobjectcustomproperties.h.