Skip to content

Commit

Permalink
Standardise capitalisation in some QgsExpression methods
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 10, 2016
1 parent a0360a6 commit cd5f813
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
3 changes: 3 additions & 0 deletions doc/api_break.dox
Expand Up @@ -329,9 +329,12 @@ removed. Use QgsExpressionContext variables instead.</li>
<li>The replaceExpressionText version which accepts a QgsFeature argument has been removed. Use the QgsExpressionContext
version instead.</li>
<li>QgsExpression::Function::func has been modified to use a QgsExpressionContext argument rather than a QgsFeature.</li>
<li>QgsExpression::Function::usesgeometry() has been renamed to usesGeometry()</li>
<li>QgsExpression::Function::helptext() has been renamed to helpText()</li>
<li>The QgsExpression::Node::eval and prepare versions which take a QgsFeature has been removed, use the QgsExpressionContext versions instead.</li>
<li>QgsExpression::Interval has been removed. Use QgsInterval instead.</li>
<li>replaceExpressionText() no longer accepts a substitution map parameter. Use expression context variables instead.</li>
<li>helptext() has been renamed to helpText()</li>
</ul>

\subsection qgis_api_break_3_0_QgsFeature QgsFeature
Expand Down
8 changes: 4 additions & 4 deletions python/core/qgsexpression.sip
Expand Up @@ -305,7 +305,7 @@ class QgsExpression
const QgsExpression::ParameterList& parameters() const;

/** Does this function use a geometry object. */
bool usesgeometry() const;
bool usesGeometry() const;

/** Returns a list of possible aliases for the function. These include
* other permissible names for the function, eg deprecated names.
Expand All @@ -330,7 +330,7 @@ class QgsExpression
/** The group the function belongs to. */
QString group() const;
/** The help text for the function. */
const QString helptext() const;
const QString helpText() const;

/** Returns result of evaluating the function.
* @param values list of values passed to the function
Expand Down Expand Up @@ -764,13 +764,13 @@ class QgsExpression
* @param name function name
* @see variableHelpText()
*/
static QString helptext( QString name );
static QString helpText( QString name );

/** Returns the help text for a specified variable.
* @param variableName name of variable
* @param showValue set to true to include current value of variable in help text
* @param value current value of variable to show in help text
* @see helptext()
* @see helpText()
* @note added in QGIS 2.12
*/
static QString variableHelpText( const QString& variableName, bool showValue = true, const QVariant& value = QVariant() );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsexpression.cpp
Expand Up @@ -4566,7 +4566,7 @@ QgsExpression::Node* QgsExpression::NodeCondition::clone() const
}


QString QgsExpression::helptext( QString name )
QString QgsExpression::helpText( QString name )
{
QgsExpression::initFunctionHelp();

Expand Down
13 changes: 6 additions & 7 deletions src/core/qgsexpression.h
Expand Up @@ -477,8 +477,7 @@ class CORE_EXPORT QgsExpression
const ParameterList& parameters() const { return mParameterList; }

/** Does this function use a geometry object. */
//TODO QGIS 3.0 - rename to usesGeometry()
bool usesgeometry() const { return mUsesGeometry; }
bool usesGeometry() const { return mUsesGeometry; }

/** Returns a list of possible aliases for the function. These include
* other permissible names for the function, eg deprecated names.
Expand All @@ -501,9 +500,9 @@ class CORE_EXPORT QgsExpression

/** The group the function belongs to. */
QString group() const { return mGroup; }

/** The help text for the function. */
//TODO QGIS 3.0 - rename to helpText()
const QString helptext() const { return mHelpText.isEmpty() ? QgsExpression::helptext( mName ) : mHelpText; }
const QString helpText() const { return mHelpText.isEmpty() ? QgsExpression::helpText( mName ) : mHelpText; }

/** Returns result of evaluating the function.
* @param values list of values passed to the function
Expand Down Expand Up @@ -998,7 +997,7 @@ class CORE_EXPORT QgsExpression
virtual QString dump() const override;

virtual QStringList referencedColumns() const override;
virtual bool needsGeometry() const override { bool needs = Functions()[mFnIndex]->usesgeometry(); if ( mArgs ) { Q_FOREACH ( Node* n, mArgs->list() ) needs |= n->needsGeometry(); } return needs; }
virtual bool needsGeometry() const override { bool needs = Functions()[mFnIndex]->usesGeometry(); if ( mArgs ) { Q_FOREACH ( Node* n, mArgs->list() ) needs |= n->needsGeometry(); } return needs; }
virtual void accept( Visitor& v ) const override { v.visit( *this ); }
virtual Node* clone() const override;

Expand Down Expand Up @@ -1213,13 +1212,13 @@ class CORE_EXPORT QgsExpression
* @param name function name
* @see variableHelpText()
*/
static QString helptext( QString name );
static QString helpText( QString name );

/** Returns the help text for a specified variable.
* @param variableName name of variable
* @param showValue set to true to include current value of variable in help text
* @param value current value of variable to show in help text
* @see helptext()
* @see helpText()
* @note added in QGIS 2.12
*/
static QString variableHelpText( const QString& variableName, bool showValue = true, const QVariant& value = QVariant() );
Expand Down
8 changes: 4 additions & 4 deletions src/gui/qgsexpressionbuilderwidget.cpp
Expand Up @@ -491,7 +491,7 @@ void QgsExpressionBuilderWidget::updateFunctionTree()
name += '(';
else if ( !name.startsWith( '$' ) )
name += "()";
registerItem( func->group(), func->name(), ' ' + name + ' ', func->helptext() );
registerItem( func->group(), func->name(), ' ' + name + ' ', func->helpText() );
}

loadExpressionContext();
Expand Down Expand Up @@ -614,7 +614,7 @@ void QgsExpressionBuilderWidget::loadExpressionContext()
continue;
if ( func->params() != 0 )
name += '(';
registerItem( func->group(), func->name(), ' ' + name + ' ', func->helptext() );
registerItem( func->group(), func->name(), ' ' + name + ' ', func->helpText() );
}
}

Expand Down Expand Up @@ -780,9 +780,9 @@ QString QgsExpressionBuilderWidget::loadFunctionHelp( QgsExpressionItem* express
QString name = expressionItem->data( Qt::UserRole ).toString();

if ( expressionItem->getItemType() == QgsExpressionItem::Field )
helpContents = QgsExpression::helptext( "Field" );
helpContents = QgsExpression::helpText( "Field" );
else
helpContents = QgsExpression::helptext( name );
helpContents = QgsExpression::helpText( name );
}

return "<head><style>" + helpStylesheet() + "</style></head><body>" + helpContents + "</body>";
Expand Down
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
Expand Up @@ -848,7 +848,7 @@ void registerQgisFunctions( sqlite3* db )
// register QGIS expression functions
Q_FOREACH ( QgsExpression::Function* foo, QgsExpression::Functions() )
{
if ( foo->usesgeometry() || foo->lazyEval() )
if ( foo->usesGeometry() || foo->lazyEval() )
{
// there is no "current" feature here, so calling functions that access "the" geometry does not make sense
// also, we can't pass Node values for lazy evaluations
Expand Down

0 comments on commit cd5f813

Please sign in to comment.