File: qgsexpressionnode.sip.in

package info (click to toggle)
qgis 3.40.11%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,183,800 kB
  • sloc: cpp: 1,595,841; python: 372,637; xml: 23,474; sh: 3,761; perl: 3,664; ansic: 2,257; sql: 2,137; yacc: 1,068; lex: 577; javascript: 540; lisp: 411; makefile: 154
file content (318 lines) | stat: -rw-r--r-- 9,144 bytes parent folder | download | duplicates (6)
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/expression/qgsexpressionnode.h                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/






class QgsExpressionNode /Abstract/
{
%Docstring(signature="appended")
Abstract base class for all nodes that can appear in an expression.
%End

%TypeHeaderCode
#include "qgsexpressionnode.h"
%End
%ConvertToSubClassCode
    switch ( sipCpp->nodeType() )
    {
      case QgsExpressionNode::ntUnaryOperator:
        sipType = sipType_QgsExpressionNodeUnaryOperator;
        break;
      case QgsExpressionNode::ntBinaryOperator:
        sipType = sipType_QgsExpressionNodeBinaryOperator;
        break;
      case QgsExpressionNode::ntInOperator:
        sipType = sipType_QgsExpressionNodeInOperator;
        break;
      case QgsExpressionNode::ntFunction:
        sipType = sipType_QgsExpressionNodeFunction;
        break;
      case QgsExpressionNode::ntLiteral:
        sipType = sipType_QgsExpressionNodeLiteral;
        break;
      case QgsExpressionNode::ntColumnRef:
        sipType = sipType_QgsExpressionNodeColumnRef;
        break;
      case QgsExpressionNode::ntCondition:
        sipType = sipType_QgsExpressionNodeCondition;
        break;
      case QgsExpressionNode::ntBetweenOperator:
        sipType = sipType_QgsExpressionNodeBetweenOperator;
        break;
      default:
        sipType = 0;
        break;
    }
%End
  public:

    enum NodeType /BaseType=IntEnum/
    {
      ntUnaryOperator,
      ntBinaryOperator,
      ntInOperator,
      ntFunction,
      ntLiteral,
      ntColumnRef,
      ntCondition,
      ntIndexOperator,
      ntBetweenOperator,
    };


    struct NamedNode
    {
      public:

        NamedNode( const QString &name, QgsExpressionNode *node );
%Docstring
Constructor for NamedNode

:param name: node name
:param node: node
%End

        QString name;

        QgsExpressionNode *node;
    };

    class NodeList
{
%Docstring(signature="appended")
A list of expression nodes.
%End

%TypeHeaderCode
#include "qgsexpressionnode.h"
%End
      public:
        virtual ~NodeList();
        void append( QgsExpressionNode *node /Transfer/ );
%Docstring
Takes ownership of the provided node
%End

        void append( QgsExpressionNode::NamedNode *node /Transfer/ );
%Docstring
Adds a named node. Takes ownership of the provided node.
%End

        int count() const;
%Docstring
Returns the number of nodes in the list.
%End

        void reserve( int size );
%Docstring
Reserves size for the node list.

.. versionadded:: 3.34
%End

        bool hasNamedNodes() const;
%Docstring
Returns ``True`` if list contains any named nodes
%End

        QList<QgsExpressionNode *> list();
%Docstring
Gets a list of all the nodes.
%End

        QgsExpressionNode *at( int i );
%Docstring
Gets the node at position i in the list.
%End

        QStringList names() const;
%Docstring
Returns a list of names for nodes. Unnamed nodes will be indicated by an
empty string in the list.
%End

        QgsExpressionNode::NodeList *clone() const /Factory/;
%Docstring
Creates a deep copy of this list. Ownership is transferred to the caller
%End

        virtual QString dump() const;
%Docstring
Returns a string dump of the expression node.
%End

      public:
    };

    virtual ~QgsExpressionNode();

    virtual QgsExpressionNode::NodeType nodeType() const = 0;
%Docstring
Gets the type of this node.

:return: The type of this node
%End

    virtual QString dump() const = 0;
%Docstring
Dump this node into a serialized (part) of an expression. The returned
expression does not necessarily literally match the original expression,
it's just guaranteed to behave the same way.
%End

    QVariant eval( QgsExpression *parent, const QgsExpressionContext *context );
%Docstring
Evaluate this node with the given context and parent. This will return a
cached value if it has been determined to be static during the
:py:func:`~QgsExpressionNode.prepare` execution.
%End

    virtual QgsExpressionNode *clone() const = 0;
%Docstring
Generate a clone of this node. Ownership is transferred to the caller.

:return: a deep copy of this node.
%End

    virtual QSet<QString> referencedColumns() const = 0;
%Docstring
Abstract virtual method which returns a list of columns required to
evaluate this node.

When reimplementing this, you need to return any column that is required
to evaluate this node and in addition recursively collect all the
columns required to evaluate child nodes.

.. warning::

   If the expression has been prepared via a call to :py:func:`QgsExpression.prepare()`,
   or a call to :py:func:`QgsExpressionNode.prepare()` for a node has been made, then some nodes in
   the expression may have been determined to evaluate to a static pre-calculatable value.
   In this case the results will omit attribute indices which are used by these
   pre-calculated nodes, regardless of their actual referenced columns.
   If you are seeking to use these functions to introspect an expression you must
   take care to do this with an unprepared expression node.

:return: A list of columns required to evaluate this expression
%End

    virtual QSet<QString> referencedVariables() const = 0;
%Docstring
Returns a set of all variables which are used in this expression.

.. note::

   In contrast to the :py:func:`~QgsExpressionNode.referencedColumns` function this method
   is not affected by any previous calls to :py:func:`QgsExpressionNode.prepare()`.
%End

    virtual QSet<QString> referencedFunctions() const = 0;
%Docstring
Returns a set of all functions which are used in this expression.

.. note::

   In contrast to the :py:func:`~QgsExpressionNode.referencedColumns` function this method
   is not affected by any previous calls to :py:func:`QgsExpressionNode.prepare()`.
%End

    virtual bool needsGeometry() const = 0;
%Docstring
Abstract virtual method which returns if the geometry is required to
evaluate this expression.

This needs to call `:py:func:`~QgsExpressionNode.needsGeometry``
recursively on any child nodes.

:return: ``True`` if a geometry is required to evaluate this expression
%End

    virtual bool isStatic( QgsExpression *parent, const QgsExpressionContext *context ) const = 0;
%Docstring
Returns ``True`` if this node can be evaluated for a static value. This
is used during the :py:func:`~QgsExpressionNode.prepare` step and in
case it returns ``True``, the value of this node will already be
evaluated and the result cached (and therefore not re-evaluated in
subsequent calls to :py:func:`~QgsExpressionNode.eval`). In case this
returns ``True``, :py:func:`~QgsExpressionNode.prepareNode` will never
be called.
%End

    bool prepare( QgsExpression *parent, const QgsExpressionContext *context );
%Docstring
Prepare this node for evaluation. This will check if the node content is
static and in this case cache the value. If it's not static it will call
:py:func:`~QgsExpressionNode.prepareNode` to allow the node to do
initialization work like for example resolving a column name to an
attribute index.
%End

    int parserFirstLine;

    int parserFirstColumn;

    int parserLastLine;

    int parserLastColumn;

    bool hasCachedStaticValue() const;
%Docstring
Returns ``True`` if the node can be replaced by a static cached value.

.. seealso:: :py:func:`cachedStaticValue`

.. versionadded:: 3.18
%End

    QVariant cachedStaticValue() const;
%Docstring
Returns the node's static cached value. Only valid if
:py:func:`~QgsExpressionNode.hasCachedStaticValue` is ``True``.

.. seealso:: :py:func:`hasCachedStaticValue`

.. versionadded:: 3.18
%End


    const QgsExpressionNode *effectiveNode() const;
%Docstring
Returns a reference to the simplest node which represents this node,
after any compilation optimizations have been applied.

Eg. a node like "CASE WHEN true THEN "some_field" WHEN other condition
THEN ... END" can effectively be replaced entirely by a
:py:class:`QgsExpressionNodeColumnRef` referencing the "some_field"
field, as the CASE WHEN ... will ALWAYS evaluate to "some_field".

Returns a reference to the current object if no optimizations were
applied.

.. versionadded:: 3.20
%End

  protected:

    QgsExpressionNode();
    QgsExpressionNode( const QgsExpressionNode &other );



};


/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/expression/qgsexpressionnode.h                              *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/