QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsobjectcustomproperties.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsobjectcustomproperties.h
3 -------------------
4 begin : April 2014
5 copyright : (C) 2014 by Martin Dobias
6 email : wonder.sk at gmail dot com
7***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSOBJECTCUSTOMPROPERTIES_H
19#define QGSOBJECTCUSTOMPROPERTIES_H
20
21#include "qgis_core.h"
22
23#include <QMap>
24#include <QVariant>
25
26class QDomDocument;
27class QDomNode;
28
36{
37 public:
38
40
44 QStringList keys() const;
45
51 void setValue( const QString &key, const QVariant &value );
52
58 QVariant value( const QString &key, const QVariant &defaultValue = QVariant() ) const;
59
63 void remove( const QString &key );
64
70 bool contains( const QString &key ) const;
71
79 void readXml( const QDomNode &parentNode, const QString &keyStartsWith = QString() );
80
86 void writeXml( QDomNode &parentNode, QDomDocument &doc ) const;
87
88 protected:
89 QMap<QString, QVariant> mMap;
90
91};
92
93#endif // QGSOBJECTCUSTOMPROPERTIES_H
QgsObjectCustomProperties()=default
void setValue(const QString &key, const QVariant &value)
Add an entry to the store with the specified key.
QMap< QString, QVariant > mMap
QStringList keys() const
Returns a list of all stored keys.
void writeXml(QDomNode &parentNode, QDomDocument &doc) const
Writes the store contents to an XML node.
void remove(const QString &key)
Removes a key (entry) from the store.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant()) const
Returns the value for the given key.
void readXml(const QDomNode &parentNode, const QString &keyStartsWith=QString())
Read store contents from an XML node.
bool contains(const QString &key) const
Returns true if the properties contains a key with the specified name.