Skip to content
Permalink
Browse files

Rename QgsProperty to QgsProjectProperty

and QgsPropertyKey/Value to QgsProjectPropertyKey/Value

The QgsProperty names are too generic to be used in this
context
  • Loading branch information
nyalldawson committed Jan 2, 2017
1 parent a05096d commit 89cfa683691318b228a99887eb440f4f0ded84d0
@@ -115,6 +115,9 @@ Renamed Classes {#qgis_api_break_3_0_renamed_classes}
<tr><td>QgsMultiLineStringV2<td>QgsMultiLineString
<tr><td>QgsMultiSurfaceV2<td>QgsMultiSurface
<tr><td>QgsPointSequenceV2<td>QgsPointSequence
<tr><td>QgsProperty<td>QgsProjectProperty
<tr><td>QgsPropertyKey<td>QgsProjectPropertyKey
<tr><td>QgsPropertyValue<td>QgsProjectPropertyValue
<tr><td>QgsRandomColorsV2<td>QgsRandomColorRamp
<tr><td>QgsRendererCategoryV2<td>QgsRendererCategory
<tr><td>QgsRendererRangeV2<td>QgsRendererRange
@@ -1,12 +1,12 @@
class QgsProperty
class QgsProjectProperty
{
%TypeHeaderCode
#include <qgsprojectproperty.h>
%End

public:
QgsProperty();
virtual ~QgsProperty();
QgsProjectProperty();
virtual ~QgsProjectProperty();

/** Dumps out the keys and values
*
@@ -63,16 +63,16 @@ class QgsProperty
}; // class QgsProperty


class QgsPropertyValue : QgsProperty
class QgsProjectPropertyValue : QgsProjectProperty
{
%TypeHeaderCode
#include <qgsprojectproperty.h>
%End

public:
QgsPropertyValue();
QgsPropertyValue( const QVariant &value );
virtual ~QgsPropertyValue();
QgsProjectPropertyValue();
QgsProjectPropertyValue( const QVariant &value );
virtual ~QgsProjectPropertyValue();

/** Returns true if is a QgsPropertyKey */
virtual bool isKey() const;
@@ -106,15 +106,15 @@ class QgsPropertyValue : QgsProperty

};

class QgsPropertyKey : QgsProperty
class QgsProjectPropertyKey : QgsProjectProperty
{
%TypeHeaderCode
#include <qgsprojectproperty.h>
%End

public:
QgsPropertyKey( const QString& name = QString() );
virtual ~QgsPropertyKey();
QgsProjectPropertyKey( const QString& name = QString() );
virtual ~QgsProjectPropertyKey();

/**
* The name of the property is used as identifier.
@@ -133,7 +133,7 @@ class QgsPropertyKey : QgsProperty


/// add the given property key
QgsPropertyKey * addKey( const QString & keyName );
QgsProjectPropertyKey * addKey( const QString & keyName );

/// remove the given key
void removeKey( const QString & keyName );
@@ -143,14 +143,14 @@ class QgsPropertyKey : QgsProperty
* @param value is the value to set
* @return pointer to property value
*/
QgsPropertyValue * setValue( const QString & name, const QVariant & value );
QgsProjectPropertyValue * setValue( const QString & name, const QVariant & value );

/** 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
*/
QgsPropertyValue * setValue( const QVariant & value );
QgsProjectPropertyValue * setValue( const QVariant & value );


void dump( int tabs = 0 ) const;
@@ -189,5 +189,5 @@ class QgsPropertyKey : QgsProperty
/// delete any sub-nodes
virtual void clearKeys();

QgsProperty * find( QString & propertyName );
QgsProjectProperty * find( QString & propertyName );
}; // class QgsPropertyKey
@@ -106,16 +106,16 @@ QStringList makeKeyTokens_( const QString& scope, const QString& key )
@param scope scope of key
@param key keyname
@param rootProperty is likely to be the top level QgsPropertyKey in QgsProject:e:Imp.
@param rootProperty is likely to be the top level QgsProjectPropertyKey in QgsProject:e:Imp.
@return null if not found, otherwise located Property
*/
QgsProperty* findKey_( const QString& scope,
const QString& key,
QgsPropertyKey& rootProperty )
QgsProjectProperty* findKey_( const QString& scope,
const QString& key,
QgsProjectPropertyKey& rootProperty )
{
QgsPropertyKey* currentProperty = &rootProperty;
QgsProperty* nextProperty; // link to next property down hiearchy
QgsProjectPropertyKey* currentProperty = &rootProperty;
QgsProjectProperty* nextProperty; // link to next property down hiearchy

QStringList keySequence = makeKeyTokens_( scope, key );

@@ -144,7 +144,7 @@ QgsProperty* findKey_( const QString& scope,
{
if ( nextProperty->isKey() )
{
currentProperty = static_cast<QgsPropertyKey*>( nextProperty );
currentProperty = static_cast<QgsProjectPropertyKey*>( nextProperty );
}
else if ( nextProperty->isValue() && 1 == keySequence.count() )
{
@@ -156,7 +156,7 @@ QgsProperty* findKey_( const QString& scope,
}
else
{
// QgsPropertyValue not Key, so return null
// QgsProjectPropertyValue not Key, so return null
return nullptr;
}
}
@@ -185,17 +185,17 @@ QgsProperty* findKey_( const QString& scope,
@param rootProperty is the property from which to start adding
@param value the value associated with the key
*/
QgsProperty *addKey_( const QString& scope,
const QString& key,
QgsPropertyKey* rootProperty,
const QVariant& value )
QgsProjectProperty *addKey_( const QString& scope,
const QString& key,
QgsProjectPropertyKey* rootProperty,
const QVariant& value )
{
QStringList keySequence = makeKeyTokens_( scope, key );

// cursor through property key/value hierarchy
QgsPropertyKey *currentProperty = rootProperty;
QgsProperty *nextProperty; // link to next property down hiearchy
QgsPropertyKey* newPropertyKey;
QgsProjectPropertyKey *currentProperty = rootProperty;
QgsProjectProperty *nextProperty; // link to next property down hiearchy
QgsProjectPropertyKey* newPropertyKey;

while ( ! keySequence.isEmpty() )
{
@@ -223,13 +223,13 @@ QgsProperty *addKey_( const QString& scope,
}
else if (( nextProperty = currentProperty->find( keySequence.first() ) ) )
{
currentProperty = dynamic_cast<QgsPropertyKey*>( nextProperty );
currentProperty = dynamic_cast<QgsProjectPropertyKey*>( nextProperty );

if ( currentProperty )
{
continue;
}
else // QgsPropertyValue not Key, so return null
else // QgsProjectPropertyValue not Key, so return null
{
return nullptr;
}
@@ -256,12 +256,12 @@ QgsProperty *addKey_( const QString& scope,

void removeKey_( const QString& scope,
const QString& key,
QgsPropertyKey &rootProperty )
QgsProjectPropertyKey &rootProperty )
{
QgsPropertyKey *currentProperty = &rootProperty;
QgsProjectPropertyKey *currentProperty = &rootProperty;

QgsProperty *nextProperty = nullptr; // link to next property down hiearchy
QgsPropertyKey *previousQgsPropertyKey = nullptr; // link to previous property up hiearchy
QgsProjectProperty *nextProperty = nullptr; // link to next property down hiearchy
QgsProjectPropertyKey *previousQgsPropertyKey = nullptr; // link to previous property up hiearchy

QStringList keySequence = makeKeyTokens_( scope, key );

@@ -290,13 +290,13 @@ void removeKey_( const QString& scope,
else if (( nextProperty = currentProperty->find( keySequence.first() ) ) )
{
previousQgsPropertyKey = currentProperty;
currentProperty = dynamic_cast<QgsPropertyKey*>( nextProperty );
currentProperty = dynamic_cast<QgsProjectPropertyKey*>( nextProperty );

if ( currentProperty )
{
continue;
}
else // QgsPropertyValue not Key, so return null
else // QgsProjectPropertyValue not Key, so return null
{
return;
}
@@ -475,7 +475,7 @@ void QgsProject::clear()
}

// basically a debugging tool to dump property list values
void dump_( const QgsPropertyKey& topQgsPropertyKey )
void dump_( const QgsProjectPropertyKey& topQgsPropertyKey )
{
QgsDebugMsg( "current properties:" );
topQgsPropertyKey.dump();
@@ -509,10 +509,10 @@ scope. "layers" is a list containing three string values.
\endcode
@param doc xml document
@param project_properties should be the top QgsPropertyKey node.
@param project_properties should be the top QgsProjectPropertyKey node.
*/
void _getProperties( const QDomDocument& doc, QgsPropertyKey& project_properties )
void _getProperties( const QDomDocument& doc, QgsProjectPropertyKey& project_properties )
{
QDomNodeList properties = doc.elementsByTagName( QStringLiteral( "properties" ) );

@@ -1397,7 +1397,7 @@ QStringList QgsProject::readListEntry( const QString& scope,
const QStringList& def,
bool* ok ) const
{
QgsProperty* property = findKey_( scope, key, mProperties );
QgsProjectProperty* property = findKey_( scope, key, mProperties );

QVariant value;

@@ -1424,7 +1424,7 @@ QString QgsProject::readEntry( const QString& scope,
const QString& def,
bool* ok ) const
{
QgsProperty *property = findKey_( scope, key, mProperties );
QgsProjectProperty *property = findKey_( scope, key, mProperties );

QVariant value;

@@ -1446,7 +1446,7 @@ QString QgsProject::readEntry( const QString& scope,
int QgsProject::readNumEntry( const QString& scope, const QString &key, int def,
bool* ok ) const
{
QgsProperty *property = findKey_( scope, key, mProperties );
QgsProjectProperty *property = findKey_( scope, key, mProperties );

QVariant value;

@@ -1474,7 +1474,7 @@ double QgsProject::readDoubleEntry( const QString& scope, const QString& key,
double def,
bool* ok ) const
{
QgsProperty *property = findKey_( scope, key, mProperties );
QgsProjectProperty *property = findKey_( scope, key, mProperties );
if ( property )
{
QVariant value = property->value();
@@ -1493,7 +1493,7 @@ double QgsProject::readDoubleEntry( const QString& scope, const QString& key,
bool QgsProject::readBoolEntry( const QString& scope, const QString &key, bool def,
bool* ok ) const
{
QgsProperty *property = findKey_( scope, key, mProperties );
QgsProjectProperty *property = findKey_( scope, key, mProperties );

if ( property )
{
@@ -1523,13 +1523,13 @@ bool QgsProject::removeEntry( const QString& scope, const QString& key )

QStringList QgsProject::entryList( const QString& scope, const QString& key ) const
{
QgsProperty *foundProperty = findKey_( scope, key, mProperties );
QgsProjectProperty *foundProperty = findKey_( scope, key, mProperties );

QStringList entries;

if ( foundProperty )
{
QgsPropertyKey *propertyKey = dynamic_cast<QgsPropertyKey*>( foundProperty );
QgsProjectPropertyKey *propertyKey = dynamic_cast<QgsProjectPropertyKey*>( foundProperty );

if ( propertyKey )
{ propertyKey->entryList( entries ); }
@@ -1540,13 +1540,13 @@ QStringList QgsProject::entryList( const QString& scope, const QString& key ) co

QStringList QgsProject::subkeyList( const QString& scope, const QString& key ) const
{
QgsProperty *foundProperty = findKey_( scope, key, mProperties );
QgsProjectProperty *foundProperty = findKey_( scope, key, mProperties );

QStringList entries;

if ( foundProperty )
{
QgsPropertyKey *propertyKey = dynamic_cast<QgsPropertyKey*>( foundProperty );
QgsProjectPropertyKey *propertyKey = dynamic_cast<QgsProjectPropertyKey*>( foundProperty );

if ( propertyKey )
{ propertyKey->subkeyList( entries ); }
@@ -997,7 +997,7 @@ class CORE_EXPORT QgsProject : public QObject, public QgsExpressionContextGenera
QVariantMap mCustomVariables;

QFile mFile; // current physical project file
mutable QgsPropertyKey mProperties; // property hierarchy, TODO: this shouldn't be mutable
mutable QgsProjectPropertyKey mProperties; // property hierarchy, TODO: this shouldn't be mutable
QString mTitle; // project title
bool mAutoTransaction; // transaction grouped editing
bool mEvaluateDefaultValues; // evaluate default values immediately
@@ -404,7 +404,7 @@ void QgsProjectFileTransform::transform1100to1200()
for ( int i = 0; i < tolList.childNodes().count(); i++ )
units << QStringLiteral( "0" );

QgsPropertyValue value( units );
QgsProjectPropertyValue value( units );
value.writeXml( QStringLiteral( "LayerSnappingToleranceUnitList" ), digitizing, mDom );
}

0 comments on commit 89cfa68

Please sign in to comment.
You can’t perform that action at this time.