@@ -570,12 +570,31 @@ Does this function use a geometry object.
570
570
%Docstring
571
571
True if this function should use lazy evaluation. Lazy evaluation functions take QgsExpression.Node objects
572
572
rather than the node results when called. You can use node->eval(parent, feature) to evaluate the node and return the result
573
- Functions are non lazy default and will be given the node return value when called **
573
+ Functions are non lazy default and will be given the node return value when called.
574
574
:rtype: bool
575
575
%End
576
576
577
577
virtual bool isStatic( const QgsExpression::NodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context ) const;
578
578
%Docstring
579
+ Will be called during prepare to determine if the function is static.
580
+ A function is static if it will return the same value for every feature with different
581
+ attributes and/or geometry.
582
+
583
+ By default this will return true, if all arguments that have been passed to the function
584
+ are also static.
585
+
586
+ .. versionadded:: 3.0
587
+ :rtype: bool
588
+ %End
589
+
590
+ virtual bool prepare( const QgsExpression::NodeFunction *node, QgsExpression *parent, const QgsExpressionContext *context ) const;
591
+ %Docstring
592
+ This will be called during the prepare step() of an expression if it is not static.
593
+
594
+ This can be used by functions to do any preparation steps that might help to speedup the upcoming
595
+ evaluation.
596
+
597
+ .. versionadded:: 3.0
579
598
:rtype: bool
580
599
%End
581
600
@@ -828,8 +847,6 @@ return index of the function in Functions array
828
847
virtual QgsExpression::Node *clone() const = 0;
829
848
%Docstring
830
849
Generate a clone of this node.
831
- Make sure that the clone does not contain any information which is
832
- generated in prepare and context related.
833
850
Ownership is transferred to the caller.
834
851
835
852
:return: a deep copy of this node.
@@ -888,6 +905,16 @@ return index of the function in Functions array
888
905
:rtype: bool
889
906
%End
890
907
908
+
909
+ protected:
910
+
911
+ void cloneTo( QgsExpression::Node *target ) const;
912
+ %Docstring
913
+ Needs to be called by all subclasses as part of their clone() implementation.
914
+
915
+ .. versionadded:: 3.0
916
+ %End
917
+
891
918
private:
892
919
virtual bool prepareNode( QgsExpression *parent, const QgsExpressionContext *context ) = 0 ;
893
920
%Docstring
0 commit comments