1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/expression/qgsexpressionfunction.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsExpressionFunction
{
%Docstring(signature="appended")
A abstract base class for defining :py:class:`QgsExpression` functions.
%End
%TypeHeaderCode
#include "qgsexpressionfunction.h"
%End
public:
class Parameter
{
%Docstring(signature="appended")
Represents a single parameter passed to a function.
%End
%TypeHeaderCode
#include "qgsexpressionfunction.h"
%End
public:
Parameter( const QString &name,
bool optional = false,
const QVariant &defaultValue = QVariant(),
bool isSubExpression = false );
%Docstring
Constructor for Parameter.
:param name: parameter name, used when named parameter are specified in
an expression
:param optional: set to ``True`` if parameter should be optional
:param defaultValue: default value to use for optional parameters
:param isSubExpression: set to ``True`` if this parameter is a
sub-expression
%End
QString name() const;
%Docstring
Returns the name of the parameter.
%End
bool optional() const;
%Docstring
Returns ``True`` if the parameter is optional.
%End
QVariant defaultValue() const;
%Docstring
Returns the default value for the parameter.
%End
bool isSubExpression() const;
%Docstring
Returns ``True`` if parameter argument is a separate sub-expression, and
should not be checked while determining referenced columns for the
expression.
.. versionadded:: 3.2
%End
bool operator==( const QgsExpressionFunction::Parameter &other ) const;
};
typedef QList< QgsExpressionFunction::Parameter > ParameterList;
QgsExpressionFunction( const QString &fnname,
int params,
const QString &group,
const QString &helpText = QString(),
bool lazyEval = false,
bool handlesNull = false,
bool isContextual = false );
%Docstring
Constructor for function which uses unnamed parameters
%End
QgsExpressionFunction( const QString &fnname,
int params,
const QStringList &groups,
const QString &helpText = QString(),
bool lazyEval = false,
bool handlesNull = false,
bool isContextual = false );
%Docstring
Constructor for function which uses unnamed parameters and group list
%End
QgsExpressionFunction( const QString &fnname,
const QgsExpressionFunction::ParameterList ¶ms,
const QString &group,
const QString &helpText = QString(),
bool lazyEval = false,
bool handlesNull = false,
bool isContextual = false );
%Docstring
Constructor for function which uses named parameter list.
%End
QgsExpressionFunction( const QString &fnname,
const QgsExpressionFunction::ParameterList ¶ms,
const QStringList &groups,
const QString &helpText = QString(),
bool lazyEval = false,
bool handlesNull = false,
bool isContextual = false );
%Docstring
Constructor for function which uses named parameter list and group list.
%End
virtual ~QgsExpressionFunction();
QString name() const;
%Docstring
The name of the function.
%End
int params() const;
%Docstring
The number of parameters this function takes.
%End
int minParams() const;
%Docstring
The minimum number of parameters this function takes.
%End
const QgsExpressionFunction::ParameterList ¶meters() const;
%Docstring
Returns the list of named parameters for the function, if set.
%End
virtual bool usesGeometry( const QgsExpressionNodeFunction *node ) const;
%Docstring
Does this function use a geometry object.
%End
virtual QStringList aliases() const;
%Docstring
Returns a list of possible aliases for the function. These include other
permissible names for the function, e.g., deprecated names.
:return: list of known aliases
%End
bool lazyEval() const;
%Docstring
``True`` if this function should use lazy evaluation. Lazy evaluation
functions take :py:class:`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.
%End
virtual bool isStatic( const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context ) const;
%Docstring
Will be called during prepare to determine if the function is static. A
function is static if it will return the same value for every feature
with different attributes and/or geometry.
By default this will return ``True``, if all arguments that have been
passed to the function are also static.
%End
virtual bool prepare( const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context ) const;
%Docstring
This will be called during the prepare
:py:func:`~QgsExpressionFunction.step` of an expression if it is not
static.
This can be used by functions to do any preparation steps that might
help to speedup the upcoming evaluation.
%End
virtual QSet<QString> referencedColumns( const QgsExpressionNodeFunction *node ) const;
%Docstring
Returns a set of field names which are required for this function. May
contain :py:class:`QgsFeatureRequest`.AllAttributes to signal that all
attributes are required. If in doubt this will return more fields than
strictly required.
%End
bool isContextual() const;
%Docstring
Returns whether the function is only available if provided by a
:py:class:`QgsExpressionContext` object.
%End
virtual bool isDeprecated() const;
%Docstring
Returns ``True`` if the function is deprecated and should not be
presented as a valid option to users in expression builders.
%End
QString group() const;
%Docstring
Returns the first group which the function belongs to.
.. note::
consider using :py:func:`~QgsExpressionFunction.groups` instead, as some functions naturally belong in multiple groups
%End
QStringList groups() const;
%Docstring
Returns a list of the groups the function belongs to.
.. seealso:: :py:func:`group`
%End
const QString helpText() const;
%Docstring
The help text for the function.
%End
virtual QVariant func( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction *node ) = 0;
%Docstring
Returns result of evaluating the function.
:param values: list of values passed to the function
:param context: context expression is being evaluated against
:param parent: parent expression
:param node: expression node
:return: result of function
%End
virtual QVariant run( QgsExpressionNode::NodeList *args, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction *node );
%Docstring
Evaluates the function, first evaluating all required arguments before
passing them to the function's :py:func:`~QgsExpressionFunction.func`
method.
%End
bool operator==( const QgsExpressionFunction &other ) const;
virtual bool handlesNull() const;
%Docstring
Returns ``True`` if the function handles NULL values in arguments by
itself, and the default NULL value handling should be skipped.
%End
protected:
static bool allParamsStatic( const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context );
%Docstring
This will return ``True`` if all the params for the provided function
``node`` are static within the constraints imposed by the ``context``
within the given ``parent``.
This can be used as callback for custom implementations of subclasses.
It is the default for implementation for StaticFunction.isStatic.
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/expression/qgsexpressionfunction.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|