22 #ifndef QGSPROJECTPROPERTY_H 23 #define QGSPROJECTPROPERTY_H 27 #include <QStringList> 62 virtual void dump(
int tabs = 0 )
const = 0;
65 virtual bool isKey()
const = 0;
68 virtual bool isValue()
const = 0;
77 virtual bool isLeaf()
const = 0;
84 virtual bool readXML( QDomNode & keyNode ) = 0;
95 virtual bool writeXML(
const QString & nodeName,
96 QDomElement & element,
97 QDomDocument & document ) = 0;
108 virtual QVariant value()
const = 0;
131 virtual bool isKey()
const override {
return false; }
134 virtual bool isValue()
const override {
return true; }
136 QVariant
value()
const override {
return value_; }
143 bool isLeaf()
const override {
return true; }
145 void dump(
int tabs = 0 )
const override;
147 bool readXML( QDomNode & keyNode )
override;
149 bool writeXML(
const QString & nodeName,
150 QDomElement & element,
151 QDomDocument & document )
override;
159 void entryList( QStringList & keyName, QStringList & entries )
const 160 { Q_UNUSED( keyName ); Q_UNUSED( entries ); }
198 const QString &
name()
const {
return mName; }
200 QString &
name() {
return mName; }
207 QVariant
value()
const override;
213 delete mProperties.take( keyName );
216 return dynamic_cast<QgsPropertyKey*
>( mProperties.value( keyName ) );
223 delete mProperties.take( keyName );
233 delete mProperties.take( name );
246 return setValue( name(), value );
251 void dump(
int tabs = 0 )
const override;
253 bool readXML( QDomNode & keyNode )
override;
255 bool writeXML(
const QString &nodeName, QDomElement & element, QDomDocument & document )
override;
258 int count()
const {
return mProperties.count(); }
261 bool isEmpty()
const {
return mProperties.isEmpty(); }
264 virtual bool isKey()
const override {
return true; }
267 virtual bool isValue()
const override {
return false; }
270 void entryList( QStringList & entries )
const;
273 void subkeyList( QStringList & entries )
const;
280 bool isLeaf()
const override;
292 qDeleteAll( mProperties );
298 return mProperties.
value( propertyName );
307 QHash < QString, QgsProperty* > mProperties;
virtual bool readXML(QDomNode &keyNode)=0
restores property hierarchy to given Dom node
virtual bool isValue() const override
returns true if is a QgsPropertyValue
virtual bool isLeaf() const =0
returns true if a leaf node
virtual void dump(int tabs=0) const =0
dumps out the keys and values
QgsPropertyKey * addKey(const QString &keyName)
add the given property key
QgsPropertyValue * setValue(const QString &name, const QVariant &value)
set the value associated with this key
virtual bool isKey() const override
returns true if is a QgsPropertyKey
virtual bool isValue() const override
returns true if is a QgsPropertyValue
QgsPropertyValue * setValue(const QVariant &value)
set the value associated with this key
void removeKey(const QString &keyName)
remove the given key
virtual void clearKeys()
delete any sub-nodes
virtual QVariant value() const =0
return the node's value
bool isEmpty() const
Does this property not have any subkeys or values?
virtual ~QgsPropertyValue()
An Abstract Base Class for QGIS project property hierarchies.
QgsProperty * find(QString &propertyName)
virtual bool isKey() const override
returns true if is a QgsPropertyKey
QVariant value() const override
return the node's value
virtual void clear()
reset the QgsProperty key to prestine state
QgsPropertyValue(const QVariant &value)
bool isLeaf() const override
returns true if is a leaf node
virtual bool writeXML(const QString &nodeName, QDomElement &element, QDomDocument &document)=0
adds property hierarchy to given Dom element
void entryList(QStringList &keyName, QStringList &entries) const
return keys that do not contain other keys
const QString & name() const
every key has a name
int count() const
how many elements are contained within this one?