QGIS API Documentation  2.5.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | List of all members
QgsPropertyKey Class Reference

QgsPropertyKey node. More...

#include <qgsprojectproperty.h>

Inheritance diagram for QgsPropertyKey:
Inheritance graph
[legend]

Public Member Functions

 QgsPropertyKey (const QString &name="")
 
virtual ~QgsPropertyKey ()
 
QVariant value () const
 if this key has a value, it will be stored by its name in its properties More...
 
QgsPropertyKeyaddKey (const QString &keyName)
 add the given property key More...
 
void removeKey (const QString &keyName)
 remove the given key More...
 
QgsPropertyValuesetValue (const QString &name, const QVariant &value)
 set the value associated with this key More...
 
QgsPropertyValuesetValue (const QVariant &value)
 set the value associated with this key More...
 
void dump (int tabs=0) const
 dumps out the keys and values More...
 
bool readXML (QDomNode &keyNode)
 restores property hierarchy to given Dom node More...
 
bool writeXML (const QString &nodeName, QDomElement &element, QDomDocument &document)
 Property keys will always create a Dom element for itself and then recursively call writeXML for any constituent properties. More...
 
int count () const
 how many elements are contained within this one? More...
 
bool isEmpty () const
 Does this property not have any subkeys or values? More...
 
virtual bool isKey () const
 returns true if is a QgsPropertyKey More...
 
virtual bool isValue () const
 returns true if is a QgsPropertyValue More...
 
void entryList (QStringList &entries) const
 return keys that do not contain other keys More...
 
void subkeyList (QStringList &entries) const
 return keys that contain other keys More...
 
bool isLeaf () const
 returns true if a leaf node More...
 
virtual void clear ()
 reset the QgsProperty key to prestine state More...
 
virtual void clearKeys ()
 delete any sub-nodes More...
 
QgsPropertyfind (QString &propertyName)
 
const QString & name () const
 every key has a name More...
 
QString & name ()
 
- Public Member Functions inherited from QgsProperty
 QgsProperty ()
 
virtual ~QgsProperty ()
 

Detailed Description

QgsPropertyKey node.

Can, itself, contain QgsPropertyKeys and QgsPropertyValues.

The internal QHash, mProperties, maps key names to their respective QgsPropertyValue or next QgsPropertyKey in the key name sequence. The key with the current name should contain its QgsPropertyValue.

E.g., given the key sequence "/foo/bar", "foo" will have a corresponding QgsPropertyKey with a name "foo". It will contain an element in its mProperties that maps to "bar", which is another QgsPropertyKey. The "bar" QgsPropertyKey will, in turn, have an element that maps to itself, i.e. "bar", that will contain a QgsPropertyValue.

Constructor & Destructor Documentation

QgsPropertyKey::QgsPropertyKey ( const QString &  name = "")
QgsPropertyKey::~QgsPropertyKey ( )
virtual

Member Function Documentation

QgsPropertyKey* QgsPropertyKey::addKey ( const QString &  keyName)
inline

add the given property key

virtual void QgsPropertyKey::clear ( )
inlinevirtual

reset the QgsProperty key to prestine state

virtual void QgsPropertyKey::clearKeys ( )
inlinevirtual

delete any sub-nodes

int QgsPropertyKey::count ( ) const
inline

how many elements are contained within this one?

void QgsPropertyKey::dump ( int  tabs = 0) const
virtual

dumps out the keys and values

Parameters
tabsis number of tabs to print; used for pretty-printing hierarchy

Implements QgsProperty.

void QgsPropertyKey::entryList ( QStringList &  entries) const

return keys that do not contain other keys

QgsProperty* QgsPropertyKey::find ( QString &  propertyName)
inline
bool QgsPropertyKey::isEmpty ( ) const
inline

Does this property not have any subkeys or values?

virtual bool QgsPropertyKey::isKey ( ) const
inlinevirtual

returns true if is a QgsPropertyKey

Implements QgsProperty.

bool QgsPropertyKey::isLeaf ( ) const
virtual

returns true if a leaf node

A leaf node is a key node that has either no value or a single value. A non-leaf node would be a key node with key sub-nodes.

Implements QgsProperty.

virtual bool QgsPropertyKey::isValue ( ) const
inlinevirtual

returns true if is a QgsPropertyValue

Implements QgsProperty.

const QString& QgsPropertyKey::name ( ) const
inline

every key has a name

QString& QgsPropertyKey::name ( )
inline
bool QgsPropertyKey::readXML ( QDomNode &  keyNode)
virtual

restores property hierarchy to given Dom node

Used for restoring properties from project file

Implements QgsProperty.

void QgsPropertyKey::removeKey ( const QString &  keyName)
inline

remove the given key

QgsPropertyValue* QgsPropertyKey::setValue ( const QString &  name,
const QVariant &  value 
)
inline

set the value associated with this key

Parameters
nameis the key name
valueis the value to set
Returns
pointer to property value
QgsPropertyValue* QgsPropertyKey::setValue ( const QVariant &  value)
inline

set the value associated with this key

Note
that the single value node associated with each key is always stored keyed by the current key name
void QgsPropertyKey::subkeyList ( QStringList &  entries) const

return keys that contain other keys

QVariant QgsPropertyKey::value ( ) const
virtual

if this key has a value, it will be stored by its name in its properties

Implements QgsProperty.

bool QgsPropertyKey::writeXML ( const QString &  nodeName,
QDomElement &  element,
QDomDocument &  document 
)
virtual

Property keys will always create a Dom element for itself and then recursively call writeXML for any constituent properties.

Implements QgsProperty.


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