QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
QgsObjectCustomProperties Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ QgsObjectCustomProperties()

QgsObjectCustomProperties::QgsObjectCustomProperties ( )
default

Member Function Documentation

◆ contains()

bool QgsObjectCustomProperties::contains ( const QString &  key) const

Returns true if the properties contains a key with the specified name.

Since
QGIS 3.14

Definition at line 46 of file qgsobjectcustomproperties.cpp.

◆ keys()

QStringList QgsObjectCustomProperties::keys ( ) const

Returns a list of all stored keys.

Definition at line 26 of file qgsobjectcustomproperties.cpp.

◆ readXml()

void QgsObjectCustomProperties::readXml ( const QDomNode &  parentNode,
const QString &  keyStartsWith = QString() 
)

Read store contents from an XML node.

Parameters
parentNodenode to read from
keyStartsWithreads only properties starting with the specified string (or all if the string is empty)
See also
writeXml()

Definition at line 51 of file qgsobjectcustomproperties.cpp.

◆ remove()

void QgsObjectCustomProperties::remove ( const QString &  key)

Removes a key (entry) from the store.

Definition at line 41 of file qgsobjectcustomproperties.cpp.

◆ setValue()

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.

◆ value()

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.

◆ writeXml()

void QgsObjectCustomProperties::writeXml ( QDomNode &  parentNode,
QDomDocument &  doc 
) const

Writes the store contents to an XML node.

See also
readXml()

Definition at line 124 of file qgsobjectcustomproperties.cpp.

Member Data Documentation

◆ mMap

QMap<QString, QVariant> QgsObjectCustomProperties::mMap
protected

Definition at line 88 of file qgsobjectcustomproperties.h.


The documentation for this class was generated from the following files: