22 #ifndef QGSPROJECTPROPERTY_H
23 #define QGSPROJECTPROPERTY_H
27 #include <QStringList>
62 virtual void dump(
size_t 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;
151 void dump(
size_t tabs = 0 )
const;
153 bool readXML( QDomNode & keyNode );
155 bool writeXML(
const QString & nodeName,
156 QDomElement & element,
157 QDomDocument & document );
167 void entryList( QStringList & keyName, QStringList & entries )
const
168 { Q_UNUSED( keyName ); Q_UNUSED( entries ); }
217 QVariant
value()
const;
223 delete mProperties.take( keyName );
226 return dynamic_cast<QgsPropertyKey*
>( mProperties.value( keyName ) );
233 delete mProperties.take( keyName );
243 delete mProperties.take( name );
256 return setValue( name(), value );
261 void dump(
size_t tabs = 0 )
const;
263 bool readXML( QDomNode & keyNode );
265 bool writeXML(
const QString &nodeName, QDomElement & element, QDomDocument & document );
269 {
return mProperties.count(); }
273 {
return mProperties.isEmpty(); }
284 void entryList( QStringList & entries )
const;
287 void subkeyList( QStringList & entries )
const;
306 qDeleteAll( mProperties );
312 return mProperties.
value( propertyName );
virtual bool isKey() const
returns true if is a QgsPropertyKey
virtual bool readXML(QDomNode &keyNode)=0
restores property hierarchy to given Dom node
size_t count() const
how many elements are contained within this one?
virtual bool isLeaf() const =0
returns true if a leaf node
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
QVariant value() const
return the node's value
QHash< QString, QgsProperty * > mProperties
sub-keys
QString mName
every key has a name
bool isLeaf() const
returns true if is a leaf node
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?
An Abstract Base Class for QGIS project property hierarchies.
QgsProperty * find(QString &propertyName)
virtual void clear()
reset the QgsProperty key to prestine state
virtual bool isKey() const
returns true if is a QgsPropertyKey
QgsPropertyValue(const QVariant &value)
QVariant value_
We use QVariant as it's very handy to keep multiple types and provides type conversions.
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
virtual bool isValue() const
returns true if is a QgsPropertyValue
const QString & name() const
every key has a name
virtual void dump(size_t tabs=0) const =0
dumps out the keys and values
virtual bool isValue() const
returns true if is a QgsPropertyValue