Skip to content
Permalink
Browse files

Use const pointer for QgsExpression:replaceExpressionText()

  • Loading branch information
NathanW2 committed Oct 10, 2013
1 parent f49ea36 commit 2cd89388b65b6def0b6735eb5f3a234843b246f2
@@ -75,7 +75,7 @@ class QgsExpression
Additional substitutions can be passed through the substitutionMap
parameter
*/
static QString replaceExpressionText( QString action, QgsFeature &feat,
static QString replaceExpressionText( QString action, const QgsFeature *feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap = 0 );
//
@@ -77,7 +77,7 @@ void QgsAttributeAction::doAction( int index, QgsFeature &feat,
return;

// search for expressions while expanding actions
QString expandedAction = QgsExpression::replaceExpressionText( action.action(), feat, mLayer , substitutionMap );
QString expandedAction = QgsExpression::replaceExpressionText( action.action(), &feat, mLayer , substitutionMap );
if ( expandedAction.isEmpty() )
return;

@@ -1721,7 +1721,7 @@ void QgsExpression::acceptVisitor( QgsExpression::Visitor& v ) const
mRootNode->accept( v );
}

QString QgsExpression::replaceExpressionText( QString action, QgsFeature* feat,
QString QgsExpression::replaceExpressionText( QString action, const QgsFeature* feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap )
{
@@ -1796,14 +1796,6 @@ QString QgsExpression::replaceExpressionText( QString action, QgsFeature* feat,
}


QString QgsExpression::replaceExpressionText( QString action, QgsFeature& feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap )
{
return replaceExpressionText( action, &feat, layer, substitutionMap );
}


///////////////////////////////////////////////
// nodes

@@ -171,12 +171,7 @@ class CORE_EXPORT QgsExpression
Additional substitutions can be passed through the substitutionMap
parameter
*/
static QString replaceExpressionText( QString action, QgsFeature* feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap = 0 );


static QString replaceExpressionText( QString action, QgsFeature& feat,
static QString replaceExpressionText( const QString action, const QgsFeature* feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap = 0 );
enum UnaryOperator
@@ -211,7 +211,7 @@ void QgsHtmlAnnotationItem::setFeatureForMapPosition()
mFeatureId = currentFeatureId;
mFeature = currentFeature;

QString newtext = QgsExpression::replaceExpressionText( mHtmlSource, mFeature, vectorLayer() );
QString newtext = QgsExpression::replaceExpressionText( mHtmlSource, &mFeature, vectorLayer() );
mWebView->setHtml( newtext );
}

@@ -100,7 +100,7 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPoint &mapPosition, QgsM

int idx = vlayer->fieldNameIndex( vlayer->displayField() );
if ( idx < 0 )
return QgsExpression::replaceExpressionText( vlayer->displayField(), feature, vlayer );
return QgsExpression::replaceExpressionText( vlayer->displayField(), &feature, vlayer );
else
return feature.attribute( idx ).toString();
}

0 comments on commit 2cd8938

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