QGIS API Documentation  2.18.3-Las Palmas (77b8c3d)
Public Member Functions | List of all members
QgsExpression::Function Class Reference

A abstract base class for defining QgsExpression functions. More...

#include <qgsexpression.h>

Inheritance diagram for QgsExpression::Function:
Inheritance graph
[legend]

Public Member Functions

 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 *)
 
virtual QVariant func (const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent)
 Returns result of evaluating the function. More...
 
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

A abstract base class for defining QgsExpression functions.

Definition at line 516 of file qgsexpression.h.

Constructor & Destructor Documentation

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 
)
inline

Constructor for function which uses unnamed parameters.

Definition at line 521 of file qgsexpression.h.

QgsExpression::Function::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 
)
inline

Constructor for function which uses unnamed parameters and group list.

Note
added in QGIS 2.18

Definition at line 545 of file qgsexpression.h.

QgsExpression::Function::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 
)
inline

Constructor for function which uses named parameter list.

Note
added in QGIS 2.16

Definition at line 569 of file qgsexpression.h.

QgsExpression::Function::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 
)
inline

Constructor for function which uses named parameter list and group list.

Note
added in QGIS 2.18

Definition at line 593 of file qgsexpression.h.

virtual QgsExpression::Function::~Function ( )
inlinevirtual

Definition at line 615 of file qgsexpression.h.

Member Function Documentation

virtual QStringList QgsExpression::Function::aliases ( ) const
inlinevirtual

Returns a list of possible aliases for the function.

These include other permissible names for the function, eg deprecated names.

Returns
list of known aliases
Note
added in QGIS 2.9

Reimplemented in QgsExpression::StaticFunction.

Definition at line 652 of file qgsexpression.h.

QVariant QgsExpression::Function::func ( const QVariantList &  values,
const QgsFeature feature,
QgsExpression parent 
)
virtual
Deprecated:
Use QgsExpressionContext variant instead

Reimplemented in QgsExpression::StaticFunction.

Definition at line 5259 of file qgsexpression.cpp.

QVariant QgsExpression::Function::func ( const QVariantList &  values,
const QgsExpressionContext context,
QgsExpression parent 
)
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 in QgsExpression::StaticFunction, and QgsScopedExpressionFunction.

Definition at line 5266 of file qgsexpression.cpp.

QString QgsExpression::Function::group ( ) const
inline

Returns the first group which the function belongs to.

Note
consider using groups() instead, as some functions naturally belong in multiple groups

Definition at line 676 of file qgsexpression.h.

QStringList QgsExpression::Function::groups ( ) const
inline

Returns a list of the groups the function belongs to.

Note
added in QGIS 2.18
See also
group()

Definition at line 682 of file qgsexpression.h.

virtual bool QgsExpression::Function::handlesNull ( ) const
inlinevirtual

Definition at line 709 of file qgsexpression.h.

const QString QgsExpression::Function::helptext ( ) const
inline

The help text for the function.

Definition at line 686 of file qgsexpression.h.

bool QgsExpression::Function::isContextual ( ) const
inline

Returns whether the function is only available if provided by a QgsExpressionContext object.

Note
added in QGIS 2.12

Definition at line 665 of file qgsexpression.h.

virtual bool QgsExpression::Function::isDeprecated ( ) const
inlinevirtual

Returns true if the function is deprecated and should not be presented as a valid option to users in expression builders.

Note
added in QGIS 2.18

Definition at line 671 of file qgsexpression.h.

bool QgsExpression::Function::lazyEval ( ) const
inline

True if this function should use lazy evaluation.

Lazy evaluation functions take QgsExpression::Node objects rather than the node results when called. You can use node->eval(parent, feature) to evaluate the node and return the result Functions are non lazy default and will be given the node return value when called

Definition at line 658 of file qgsexpression.h.

int QgsExpression::Function::minParams ( ) const
inline

The mininum number of parameters this function takes.

Definition at line 624 of file qgsexpression.h.

QString QgsExpression::Function::name ( ) const
inline

The name of the function.

Definition at line 618 of file qgsexpression.h.

bool QgsExpression::Function::operator== ( const Function other) const
inline

Definition at line 701 of file qgsexpression.h.

const ParameterList& QgsExpression::Function::parameters ( ) const
inline

Returns the list of named parameters for the function, if set.

Note
added in QGIS 2.16

Definition at line 641 of file qgsexpression.h.

int QgsExpression::Function::params ( ) const
inline

The number of parameters this function takes.

Definition at line 621 of file qgsexpression.h.

virtual QStringList QgsExpression::Function::referencedColumns ( ) const
inlinevirtual

Definition at line 660 of file qgsexpression.h.

bool QgsExpression::Function::usesgeometry ( ) const
inline

Does this function use a geometry object.

Definition at line 645 of file qgsexpression.h.


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