22 #ifndef QGSPROJECTPROPERTY_H 23 #define QGSPROJECTPROPERTY_H 27 #include <QStringList> 57 virtual void dump(
int tabs = 0 )
const = 0;
60 virtual bool isKey()
const = 0;
63 virtual bool isValue()
const = 0;
72 virtual bool isLeaf()
const = 0;
79 virtual bool readXML(
QDomNode & keyNode ) = 0;
90 virtual bool writeXML(
const QString & nodeName,
127 virtual bool isKey()
const override {
return false; }
130 virtual bool isValue()
const override {
return true; }
139 bool isLeaf()
const override {
return true; }
141 void dump(
int tabs = 0 )
const override;
155 { Q_UNUSED( keyName ); Q_UNUSED( entries ); }
209 delete mProperties.take( keyName );
212 return dynamic_cast<QgsPropertyKey*
>( mProperties.value( keyName ) );
219 delete mProperties.take( keyName );
229 delete mProperties.take( name );
242 return setValue( name(), value );
245 void dump(
int tabs = 0 )
const override;
252 int count()
const {
return mProperties.count(); }
255 bool isEmpty()
const {
return mProperties.isEmpty(); }
258 virtual bool isKey()
const override {
return true; }
261 virtual bool isValue()
const override {
return false; }
273 bool isLeaf()
const override;
285 qDeleteAll( mProperties );
291 return mProperties.
value( propertyName );
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.
void entryList(QStringList &keyName, QStringList &entries) const
Return keys that do not contain other keys Since QgsPropertyValue isn't a key, don't do anything...
int count() const
how many elements are contained within this one?
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.
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
QString name() const
every key has a name
bool isEmpty() const
Does this property not have any subkeys or values?