QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | List of all members
QgsScopedExpressionFunction Class Referenceabstract

Expression function for use within a QgsExpressionContextScope. More...

#include <qgsexpressioncontext.h>

Inheritance diagram for QgsScopedExpressionFunction:
Inheritance graph
[legend]

Public Member Functions

 QgsScopedExpressionFunction (const QString &fnname, int params, const QString &group, const QString &helpText=QString(), bool usesGeometry=false, const QStringList &referencedColumns=QStringList(), bool lazyEval=false, bool handlesNull=false, bool isContextual=true)
 
virtual ~QgsScopedExpressionFunction ()
 
virtual QgsScopedExpressionFunctionclone () const =0
 Returns a clone of the function. More...
 
virtual QVariant func (const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent) override=0
 Returns result of evaluating the function. More...
 
- Public Member Functions inherited from QgsExpression::Function
 Function (const QString &fnname, int params, const QString &group, const QString &helpText=QString(), bool usesGeometry=false, const QStringList &referencedColumns=QStringList(), bool lazyEval=false, bool handlesNull=false, bool isContextual=false)
 Constructor for function which uses unnamed parameters. More...
 
 Function (const QString &fnname, int params, const QStringList &groups, const QString &helpText=QString(), bool usesGeometry=false, const QStringList &referencedColumns=QStringList(), bool lazyEval=false, bool handlesNull=false, bool isContextual=false)
 Constructor for function which uses unnamed parameters and group list. More...
 
 Function (const QString &fnname, const ParameterList &params, const QString &group, const QString &helpText=QString(), bool usesGeometry=false, const QStringList &referencedColumns=QStringList(), bool lazyEval=false, bool handlesNull=false, bool isContextual=false)
 Constructor for function which uses named parameter list. More...
 
 Function (const QString &fnname, const ParameterList &params, const QStringList &groups, const QString &helpText=QString(), bool usesGeometry=false, const QStringList &referencedColumns=QStringList(), bool lazyEval=false, bool handlesNull=false, bool isContextual=false)
 Constructor for function which uses named parameter list and group list. More...
 
virtual ~Function ()
 
virtual QStringList aliases () const
 Returns a list of possible aliases for the function. More...
 
virtual Q_DECL_DEPRECATED QVariant func (const QVariantList &, const QgsFeature *, QgsExpression *)
 
QString group () const
 Returns the first group which the function belongs to. More...
 
QStringList groups () const
 Returns a list of the groups the function belongs to. More...
 
virtual bool handlesNull () const
 
const QString helptext () const
 The help text for the function. More...
 
bool isContextual () const
 Returns whether the function is only available if provided by a QgsExpressionContext object. More...
 
virtual bool isDeprecated () const
 Returns true if the function is deprecated and should not be presented as a valid option to users in expression builders. More...
 
bool lazyEval () const
 True if this function should use lazy evaluation. More...
 
int minParams () const
 The mininum number of parameters this function takes. More...
 
QString name () const
 The name of the function. More...
 
bool operator== (const Function &other) const
 
const ParameterListparameters () const
 Returns the list of named parameters for the function, if set. More...
 
int params () const
 The number of parameters this function takes. More...
 
virtual QStringList referencedColumns () const
 
bool usesgeometry () const
 Does this function use a geometry object. More...
 

Detailed Description

Expression function for use within a QgsExpressionContextScope.

This differs from a standard QgsExpression::Function in that it requires an implemented clone() method.

Note
added in QGIS 2.12

Definition at line 41 of file qgsexpressioncontext.h.

Constructor & Destructor Documentation

◆ QgsScopedExpressionFunction()

QgsScopedExpressionFunction::QgsScopedExpressionFunction ( const QString fnname,
int  params,
const QString group,
const QString helpText = QString(),
bool  usesGeometry = false,
const QStringList referencedColumns = QStringList(),
bool  lazyEval = false,
bool  handlesNull = false,
bool  isContextual = true 
)
inline

Definition at line 44 of file qgsexpressioncontext.h.

◆ ~QgsScopedExpressionFunction()

virtual QgsScopedExpressionFunction::~QgsScopedExpressionFunction ( )
inlinevirtual

Definition at line 56 of file qgsexpressioncontext.h.

Member Function Documentation

◆ clone()

virtual QgsScopedExpressionFunction* QgsScopedExpressionFunction::clone ( ) const
pure virtual

Returns a clone of the function.

◆ func()

virtual QVariant QgsScopedExpressionFunction::func ( const QVariantList &  values,
const QgsExpressionContext context,
QgsExpression parent 
)
overridepure virtual

Returns result of evaluating the function.

Parameters
valueslist of values passed to the function
contextcontext expression is being evaluated against
parentparent expression
Returns
result of function
Note
named funcV2 in Python bindings. Will be renamed to func to replace deprecated method in QGIS 3.0.

Reimplemented from QgsExpression::Function.


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