QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
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 | |
Constructor for QgsObjectCustomProperties. More... | |
bool | contains (const QString &key) const |
Returns true if the properties contains a key with the specified name. More... | |
QStringList | keys () const |
Returns a list of all stored keys. More... | |
void | readXml (const QDomNode &parentNode, const QString &keyStartsWith=QString()) |
Read store contents from an XML node. More... | |
void | remove (const QString &key) |
Removes a key (entry) from the store. More... | |
void | setValue (const QString &key, const QVariant &value) |
Add an entry to the store with the specified key. More... | |
QVariant | value (const QString &key, const QVariant &defaultValue=QVariant()) const |
Returns the value for the given key. More... | |
void | writeXml (QDomNode &parentNode, QDomDocument &doc) const |
Writes the store contents to an XML node. More... | |
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 35 of file qgsobjectcustomproperties.h.
|
default |
Constructor for QgsObjectCustomProperties.
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 130 of file qgsobjectcustomproperties.cpp.
|
protected |
Definition at line 92 of file qgsobjectcustomproperties.h.