File: qgsexpressioncontext.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 (1013 lines) | stat: -rw-r--r-- 27,621 bytes parent folder | download | duplicates (12)
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
/************************************************************************
 * This file has been generated automatically from                      *
 *                                                                      *
 * src/core/qgsexpressioncontext.h                                      *
 *                                                                      *
 * Do not edit manually ! Edit header and run scripts/sipify.py again   *
 ************************************************************************/





class QgsScopedExpressionFunction : QgsExpressionFunction
{
%Docstring(signature="appended")
Expression function for use within a
:py:class:`QgsExpressionContextScope`. This differs from a standard
:py:class:`QgsExpression`.Function in that it requires an implemented
:py:func:`~clone` method.
%End

%TypeHeaderCode
#include "qgsexpressioncontext.h"
%End
  public:

    QgsScopedExpressionFunction( const QString &fnname,
                                 int params,
                                 const QString &group,
                                 const QString &helpText = QString(),
                                 bool usesGeometry = false,
                                 const QSet<QString> &referencedColumns = QSet<QString>(),
                                 bool lazyEval = false,
                                 bool handlesNull = false,
                                 bool isContextual = true );
%Docstring
Create a new QgsScopedExpressionFunction
%End

    QgsScopedExpressionFunction( const QString &fnname,
                                 const QgsExpressionFunction::ParameterList &params,
                                 const QString &group,
                                 const QString &helpText = QString(),
                                 bool usesGeometry = false,
                                 const QSet<QString> &referencedColumns = QSet<QString>(),
                                 bool lazyEval = false,
                                 bool handlesNull = false,
                                 bool isContextual = true );
%Docstring
Create a new QgsScopedExpressionFunction using named parameters.
%End

    virtual QVariant func( const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent, const QgsExpressionNodeFunction *node ) = 0;


    virtual QgsScopedExpressionFunction *clone() const = 0 /Factory/;
%Docstring
Returns a clone of the function.
%End

    virtual bool usesGeometry( const QgsExpressionNodeFunction *node ) const;


    virtual QSet<QString> referencedColumns( const QgsExpressionNodeFunction *node ) const;


    virtual bool isStatic( const QgsExpressionNodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context ) const;


};



class QgsExpressionContextScope
{
%Docstring(signature="appended")
Single scope for storing variables and functions for use within a
:py:class:`QgsExpressionContext`.

Examples include a project's scope, which could contain information
about the current project such as the project file's location.
:py:class:`QgsExpressionContextScope` can encapsulate both variables
(static values) and functions(which are calculated only when an
expression is evaluated).

See :py:class:`QgsExpressionContextUtils` for helper methods for working
with :py:class:`QgsExpressionContextScope` objects.
%End

%TypeHeaderCode
#include "qgsexpressioncontext.h"
%End
  public:

    struct StaticVariable
    {

      StaticVariable( const QString &name = QString(), const QVariant &value = QVariant(), bool readOnly = false, bool isStatic = false, const QString &description = QString() );
%Docstring
Constructor for StaticVariable.

:param name: variable name (should be unique within the
             QgsExpressionContextScope)
:param value: initial variable value
:param readOnly: ``True`` if variable should not be editable by users
:param isStatic: ``True`` if the variable will not change during the
                 lifteime of an iterator.
:param description: optional translated description of variable, for use
                    in expression builder widgets
%End

      QString name;

      QVariant value;

      bool readOnly;

      bool isStatic;

      QString description;
    };

    QgsExpressionContextScope( const QString &name = QString() );
%Docstring
Constructor for QgsExpressionContextScope

:param name: friendly display name for the context scope
%End

    QgsExpressionContextScope( const QgsExpressionContextScope &other );


    ~QgsExpressionContextScope();

    QString name() const;
%Docstring
Returns the friendly display name of the context scope.
%End

    void setVariable( const QString &name, const QVariant &value, bool isStatic = false );
%Docstring
Convenience method for setting a variable in the context scope by
``name`` name and ``value``. If a variable with the same name is already
set then its value is overwritten, otherwise a new variable is added to
the scope. If the ``isStatic`` parameter is set to ``True``, this
variable can be cached during the execution of
:py:func:`QgsExpression.prepare()`.

.. seealso:: :py:func:`addVariable`
%End

    void addVariable( const QgsExpressionContextScope::StaticVariable &variable );
%Docstring
Adds a variable into the context scope. If a variable with the same name
is already set then its value is overwritten, otherwise a new variable
is added to the scope.

:param variable: definition of variable to insert

.. seealso:: :py:func:`setVariable`

.. seealso:: :py:func:`addFunction`
%End

    bool removeVariable( const QString &name );
%Docstring
Removes a variable from the context scope, if found.

:param name: name of variable to remove

:return: ``True`` if variable was removed from the scope, ``False`` if
         matching variable was not found within the scope
%End

    bool hasVariable( const QString &name ) const;
%Docstring
Tests whether a variable with the specified name exists in the scope.

:param name: variable name

:return: ``True`` if matching variable was found in the scope

.. seealso:: :py:func:`variable`

.. seealso:: :py:func:`hasFunction`
%End

    QVariant variable( const QString &name ) const;
%Docstring
Retrieves a variable's value from the scope.

:param name: variable name

:return: variable value, or invalid QVariant if matching variable could
         not be found

.. seealso:: :py:func:`hasVariable`

.. seealso:: :py:func:`function`
%End

    QStringList variableNames() const;
%Docstring
Returns a list of variable names contained within the scope.

.. seealso:: :py:func:`functionNames`

.. seealso:: :py:func:`filteredVariableNames`
%End

    QStringList filteredVariableNames() const;
%Docstring
Returns a filtered and sorted list of variable names contained within
the scope. Hidden variable names will be excluded, and the list will be
sorted so that read only variables are listed first.

.. seealso:: :py:func:`variableNames`
%End

    bool isReadOnly( const QString &name ) const;
%Docstring
Tests whether the specified variable is read only and should not be
editable by users.

:param name: variable name

:return: ``True`` if variable is read only
%End

    bool isStatic( const QString &name ) const;
%Docstring
Tests whether the variable with the specified ``name`` is static and can
be cached.
%End

    QString description( const QString &name ) const;
%Docstring
Returns the translated description for the variable with the specified
``name`` (if set).
%End

    int variableCount() const;
%Docstring
Returns the count of variables contained within the scope.
%End

    bool hasFunction( const QString &name ) const;
%Docstring
Tests whether a function with the specified name exists in the scope.

:param name: function name

:return: ``True`` if matching function was found in the scope

.. seealso:: :py:func:`function`

.. seealso:: :py:func:`hasFunction`
%End

    QgsExpressionFunction *function( const QString &name ) const;
%Docstring
Retrieves a function from the scope.

:param name: function name

:return: function, or ``None`` if matching function could not be found

.. seealso:: :py:func:`hasFunction`

.. seealso:: :py:func:`functionNames`

.. seealso:: :py:func:`variable`
%End

    QStringList functionNames() const;
%Docstring
Retrieves a list of names of functions contained in the scope.

.. seealso:: :py:func:`function`

.. seealso:: :py:func:`variableNames`
%End

    void addFunction( const QString &name, QgsScopedExpressionFunction *function /Transfer/ );
%Docstring
Adds a function to the scope.

:param name: function name
:param function: function to insert. Ownership is transferred to the
                 scope.

.. seealso:: :py:func:`addVariable`
%End

    bool hasFeature() const;
%Docstring
Returns ``True`` if the scope has a feature associated with it.

.. seealso:: :py:func:`feature`
%End

    QgsFeature feature() const;
%Docstring
Sets the feature associated with the scope.

.. seealso:: :py:func:`setFeature`

.. seealso:: :py:func:`hasFeature`
%End

    void setFeature( const QgsFeature &feature );
%Docstring
Convenience function for setting a feature for the scope. Any existing
feature set by the scope will be overwritten.

:param feature: feature for scope

.. seealso:: :py:func:`removeFeature`

.. seealso:: :py:func:`feature`
%End

    void removeFeature();
%Docstring
Removes any feature associated with the scope.

.. seealso:: :py:func:`setFeature`

.. seealso:: :py:func:`hasFeature`
%End

    bool hasGeometry() const;
%Docstring
Returns ``True`` if the scope has a geometry associated with it.

.. seealso:: :py:func:`geometry`

.. versionadded:: 3.24
%End

    QgsGeometry geometry() const;
%Docstring
Sets the geometry associated with the scope.

.. seealso:: :py:func:`setGeometry`

.. seealso:: :py:func:`hasGeometry`

.. versionadded:: 3.24
%End

    void setGeometry( const QgsGeometry &geometry );
%Docstring
Convenience function for setting a ``geometry`` for the scope. Any
existing geometry set by the scope will be overwritten.

.. seealso:: :py:func:`removeGeometry`

.. seealso:: :py:func:`geometry`

.. versionadded:: 3.24
%End

    void removeGeometry();
%Docstring
Removes any geometry associated with the scope.

.. seealso:: :py:func:`setGeometry`

.. seealso:: :py:func:`hasGeometry`

.. versionadded:: 3.24
%End

    void setFields( const QgsFields &fields );
%Docstring
Convenience function for setting a fields for the scope. Any existing
fields set by the scope will be overwritten.

:param fields: fields for scope
%End

    void readXml( const QDomElement &element, const QgsReadWriteContext &context );
%Docstring
Reads scope variables from an XML element.

.. seealso:: :py:func:`writeXml`

.. versionadded:: 3.6
%End

    bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const;
%Docstring
Writes scope variables to an XML ``element``.

.. seealso:: :py:func:`readXml`

.. versionadded:: 3.6
%End


    QStringList hiddenVariables() const;
%Docstring
Returns the list of variables hidden within the scope.

.. seealso:: :py:func:`setHiddenVariables`

.. seealso:: :py:func:`addHiddenVariable`

.. seealso:: :py:func:`removeHiddenVariable`

.. versionadded:: 3.28
%End

    void setHiddenVariables( const QStringList &hiddenVariables );
%Docstring
Sets the list of variables intended to be hidden in the expression
builder dialog and widget.

.. seealso:: :py:func:`hiddenVariables`

.. seealso:: :py:func:`addHiddenVariable`

.. seealso:: :py:func:`removeHiddenVariable`

.. versionadded:: 3.28
%End


    void addHiddenVariable( const QString &hiddenVariable );
%Docstring
Adds the passed variable to a list of hidden variables that won't be
visible in the expression builder dialog and widget.

.. seealso:: :py:func:`hiddenVariables`

.. seealso:: :py:func:`setHiddenVariables`

.. seealso:: :py:func:`removeHiddenVariable`

.. versionadded:: 3.28
%End

    void removeHiddenVariable( const QString &hiddenVariable );
%Docstring
Removes the passed variable from a list of hidden variables.

.. seealso:: :py:func:`hiddenVariables`

.. seealso:: :py:func:`setHiddenVariables`

.. seealso:: :py:func:`addHiddenVariable`

.. versionadded:: 3.28
%End

    void addLayerStore( QgsMapLayerStore *store );
%Docstring
Adds a layer ``store`` to the scope.

Ownership of the ``store`` is not transferred to the scope, it is the
caller's responsibility to ensure that the store remains alive for the
duration of the expression context.

.. seealso:: :py:func:`layerStores`

.. versionadded:: 3.30
%End

    QList< QgsMapLayerStore * > layerStores() const;
%Docstring
Returns the list of layer stores associated with the scope.

.. seealso:: :py:func:`addLayerStore`

.. versionadded:: 3.30
%End

};

class QgsExpressionContext
{
%Docstring(signature="appended")
Expression contexts are used to encapsulate the parameters around which
a :py:class:`QgsExpression` should be evaluated.

:py:class:`QgsExpressions` can then utilize the information stored
within a context to contextualise their evaluated result. A
:py:class:`QgsExpressionContext` consists of a stack of
:py:class:`QgsExpressionContextScope` objects, where scopes added later
to the stack will override conflicting variables and functions from
scopes lower in the stack.

See :py:class:`QgsExpressionContextUtils` for helper methods for working
with :py:class:`QgsExpressionContext` objects.
%End

%TypeHeaderCode
#include "qgsexpressioncontext.h"
%End
  public:

    QgsExpressionContext();

    explicit QgsExpressionContext( const QList<QgsExpressionContextScope *> &scopes /Transfer/ );
%Docstring
Initializes the context with given list of scopes. Ownership of the
scopes is transferred to the stack.
%End

    QgsExpressionContext( const QgsExpressionContext &other );



    ~QgsExpressionContext();

    bool hasVariable( const QString &name ) const;
%Docstring
Check whether a variable is specified by any scope within the context.

:param name: variable name

:return: ``True`` if variable is set

.. seealso:: :py:func:`variable`

.. seealso:: :py:func:`variableNames`
%End

    QVariant variable( const QString &name ) const;
%Docstring
Fetches a matching variable from the context. The variable will be
fetched from the last scope contained within the context which has a
matching variable set.

:param name: variable name

:return: variable value if matching variable exists in the context,
         otherwise an invalid QVariant

.. seealso:: :py:func:`hasVariable`

.. seealso:: :py:func:`variableNames`
%End

    QVariantMap variablesToMap() const;
%Docstring
Returns a map of variable name to value representing all the expression
variables contained by the context.
%End

    bool isHighlightedVariable( const QString &name ) const;
%Docstring
Returns ``True`` if the specified variable ``name`` is intended to be
highlighted to the user. This is used by the expression builder to more
prominently display the variable.

.. seealso:: :py:func:`setHighlightedVariables`

.. seealso:: :py:func:`isHighlightedFunction`
%End

    QStringList highlightedVariables() const;
%Docstring
Returns the current list of variables highlighted within the context.

.. seealso:: :py:func:`setHighlightedVariables`

.. versionadded:: 3.8
%End

    void setHighlightedVariables( const QStringList &variableNames );
%Docstring
Sets the list of variable names within the context intended to be
highlighted to the user. This is used by the expression builder to more
prominently display these variables.

:param variableNames: variable names to highlight

.. seealso:: :py:func:`isHighlightedVariable`

.. seealso:: :py:func:`setHighlightedFunctions`
%End

    bool isHighlightedFunction( const QString &name ) const;
%Docstring
Returns ``True`` if the specified function ``name`` is intended to be
highlighted to the user. This is used by the expression builder to more
prominently display the function.

.. seealso:: :py:func:`setHighlightedFunctions`

.. seealso:: :py:func:`isHighlightedVariable`

.. versionadded:: 3.4
%End

    void setHighlightedFunctions( const QStringList &names );
%Docstring
Sets the list of function ``names`` intended to be highlighted to the
user. This is used by the expression builder to more prominently display
these functions.

Note that these function names may include standard functions which are
not functions specific to this context, and these standard functions
will also be highlighted to users.

.. seealso:: :py:func:`isHighlightedFunction`

.. seealso:: :py:func:`setHighlightedVariables`

.. versionadded:: 3.4
%End

    QgsExpressionContextScope *activeScopeForVariable( const QString &name );
%Docstring
Returns the currently active scope from the context for a specified
variable name. As scopes later in the stack override earlier contexts,
this will be the last matching scope which contains a matching variable.

:param name: variable name

:return: matching scope containing variable, or ``None`` if none found
%End


    QgsExpressionContextScope *scope( int index );
%Docstring
Returns the scope at the specified index within the context.

:param index: index of scope

:return: matching scope, or ``None`` if none found

.. seealso:: :py:func:`lastScope`
%End

    QgsExpressionContextScope *lastScope();
%Docstring
Returns the last scope added to the context.

.. seealso:: :py:func:`scope`
%End

    QList< QgsExpressionContextScope * > scopes();
%Docstring
Returns a list of scopes contained within the stack.

:return: list of pointers to scopes
%End

    int indexOfScope( QgsExpressionContextScope *scope ) const;
%Docstring
Returns the index of the specified scope if it exists within the
context.

:param scope: scope to find

:return: index of scope, or -1 if scope was not found within the
         context.
%End

    int indexOfScope( const QString &scopeName ) const;
%Docstring
Returns the index of the first scope with a matching name within the
context.

:param scopeName: name of scope to find

:return: index of scope, or -1 if scope was not found within the
         context.
%End

    QStringList variableNames() const;
%Docstring
Returns a list of variables names set by all scopes in the context.

:return: list of unique variable names

.. seealso:: :py:func:`filteredVariableNames`

.. seealso:: :py:func:`functionNames`

.. seealso:: :py:func:`hasVariable`

.. seealso:: :py:func:`variable`
%End

    QStringList filteredVariableNames() const;
%Docstring
Returns a filtered list of variables names set by all scopes in the
context. The included variables are those which should be seen by users.

:return: filtered list of unique variable names

.. seealso:: :py:func:`variableNames`
%End

    bool isReadOnly( const QString &name ) const;
%Docstring
Returns whether a variable is read only, and should not be modifiable by
users.

:param name: variable name

:return: ``True`` if variable is read only. Read only status will be
         taken from last matching scope which contains a matching
         variable.
%End

    QString description( const QString &name ) const;
%Docstring
Returns a translated description string for the variable with specified
``name``.

If no specific description has been provided for the variable, the value
from :py:func:`QgsExpression.variableHelpText()` will be returned.
%End

    bool hasFunction( const QString &name ) const;
%Docstring
Checks whether a specified function is contained in the context.

:param name: function name

:return: ``True`` if context provides a matching function

.. seealso:: :py:func:`function`
%End

    QStringList functionNames() const;
%Docstring
Retrieves a list of function names contained in the context.

.. seealso:: :py:func:`function`

.. seealso:: :py:func:`variableNames`
%End

    QgsExpressionFunction *function( const QString &name ) const;
%Docstring
Fetches a matching function from the context. The function will be
fetched from the last scope contained within the context which has a
matching function set.

:param name: function name

:return: function if contained by the context, otherwise ``None``.

.. seealso:: :py:func:`hasFunction`
%End

    int scopeCount() const;
%Docstring
Returns the number of scopes contained in the context.
%End

    void appendScope( QgsExpressionContextScope *scope /Transfer/ );
%Docstring
Appends a scope to the end of the context. This scope will override any
matching variables or functions provided by existing scopes within the
context. Ownership of the scope is transferred to the stack.

:param scope: expression context to append to context
%End

    void appendScopes( const QList<QgsExpressionContextScope *> &scopes /Transfer/ );
%Docstring
Appends a list of scopes to the end of the context. This scopes will
override any matching variables or functions provided by existing scopes
within the context. Ownership of the scopes is transferred to the stack.

:param scopes: scopes to append to context
%End

    QgsExpressionContextScope *popScope();
%Docstring
Removes the last scope from the expression context and return it.
%End



    void setFeature( const QgsFeature &feature );
%Docstring
Convenience function for setting a feature for the context. The feature
will be set within the last scope of the context, so will override any
existing features within the context.

:param feature: feature for context

.. seealso:: :py:func:`feature`
%End

    bool hasFeature() const;
%Docstring
Returns ``True`` if the context has a feature associated with it.

.. seealso:: :py:func:`feature`
%End

    QgsFeature feature() const;
%Docstring
Convenience function for retrieving the feature for the context, if set.

.. seealso:: :py:func:`setFeature`
%End

    void setGeometry( const QgsGeometry &geometry );
%Docstring
Convenience function for setting a ``geometry`` for the context. The
geometry will be set within the last scope of the context, so will
override any existing geometries within the context.

.. seealso:: :py:func:`geometry`

.. versionadded:: 3.24
%End

    bool hasGeometry() const;
%Docstring
Returns ``True`` if the context has a geometry associated with it.

.. seealso:: :py:func:`geometry`

.. versionadded:: 3.24
%End

    QgsGeometry geometry() const;
%Docstring
Convenience function for retrieving the geometry for the context, if
set.

.. seealso:: :py:func:`setGeometry`

.. versionadded:: 3.24
%End

    void setFields( const QgsFields &fields );
%Docstring
Convenience function for setting a fields for the context. The fields
will be set within the last scope of the context, so will override any
existing fields within the context.

:param fields: fields for context

.. seealso:: :py:func:`fields`
%End

    QgsFields fields() const;
%Docstring
Convenience function for retrieving the fields for the context, if set.

.. seealso:: :py:func:`setFields`
%End

    void setOriginalValueVariable( const QVariant &value );
%Docstring
Sets the original value variable value for the context.

:param value: value for original value variable. This usually represents
              an original widget value before any data defined overrides
              have been applied.
%End

    void setCachedValue( const QString &key, const QVariant &value ) const;
%Docstring
Sets a value to cache within the expression context. This can be used to
cache the results of expensive expression sub-calculations, to speed up
future evaluations using the same expression context.

:param key: unique key for retrieving cached value
:param value: value to cache

.. seealso:: :py:func:`hasCachedValue`

.. seealso:: :py:func:`cachedValue`

.. seealso:: :py:func:`clearCachedValues`
%End

    bool hasCachedValue( const QString &key ) const;
%Docstring
Returns ``True`` if the expression context contains a cached value with
a matching key.

:param key: unique key used to store cached value

.. seealso:: :py:func:`setCachedValue`

.. seealso:: :py:func:`cachedValue`

.. seealso:: :py:func:`clearCachedValues`
%End

    QVariant cachedValue( const QString &key ) const;
%Docstring
Returns the matching cached value, if set. This can be used to retrieve
the previously stored results of an expensive expression
sub-calculation.

:param key: unique key used to store cached value

:return: matching cached value, or invalid QVariant if not set

.. seealso:: :py:func:`setCachedValue`

.. seealso:: :py:func:`hasCachedValue`

.. seealso:: :py:func:`clearCachedValues`
%End

    void clearCachedValues() const;
%Docstring
Clears all cached values from the context.

.. seealso:: :py:func:`setCachedValue`

.. seealso:: :py:func:`hasCachedValue`

.. seealso:: :py:func:`cachedValue`
%End

    QList< QgsMapLayerStore * > layerStores() const;
%Docstring
Returns the list of layer stores associated with the context.

.. versionadded:: 3.30
%End

    void setLoadedLayerStore( QgsMapLayerStore *store );
%Docstring
Sets the destination layer ``store`` for any layers loaded during
expression evaluation.

Ownership of the ``store`` is not transferred to the context, it is the
caller's responsibility to ensure that the store remains alive for the
duration of the expression context.

.. seealso:: :py:func:`loadedLayerStore`

.. versionadded:: 3.30
%End

    QgsMapLayerStore *loadedLayerStore() const;
%Docstring
Returns the destination layer store for any layers loaded during
expression evaluation.

.. seealso:: :py:func:`setLoadedLayerStore`

.. versionadded:: 3.30
%End

    void setFeedback( QgsFeedback *feedback );
%Docstring
Attach a ``feedback`` object that can be queried regularly by the
expression engine to check if expression evaluation should be canceled.

Ownership of ``feedback`` is NOT transferred, and the caller must take
care that it exists for the lifetime of the expression context.

.. seealso:: :py:func:`feedback`

.. versionadded:: 3.20
%End

    QgsFeedback *feedback() const;
%Docstring
Returns the feedback object that can be queried regularly by the
expression to check if evaluation should be canceled, if set.

.. seealso:: :py:func:`setFeedback`

.. versionadded:: 3.20
%End

    QString uniqueHash( bool &ok /Out/, const QSet<QString> &variables = QSet<QString>() ) const;
%Docstring
Returns a unique hash representing the current state of the context.

:param variables: optional names of a subset of variables to include in
                  the hash. If not specified, all variables will be
                  considered.

:return: - calculated hash
         - ok: ``True`` if the hash could be generated, or false if e.g.
           a variable value is of a type which cannot be hashed

.. versionadded:: 3.40
%End

    static const QString EXPR_FIELDS;
    static const QString EXPR_ORIGINAL_VALUE;
    static const QString EXPR_SYMBOL_COLOR;
    static const QString EXPR_SYMBOL_ANGLE;
    static const QString EXPR_GEOMETRY_PART_COUNT;
    static const QString EXPR_GEOMETRY_PART_NUM;

    static const QString EXPR_GEOMETRY_RING_NUM;
    static const QString EXPR_GEOMETRY_POINT_COUNT;
    static const QString EXPR_GEOMETRY_POINT_NUM;
    static const QString EXPR_CLUSTER_SIZE;
    static const QString EXPR_CLUSTER_COLOR;

};

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