QgsExpressionNodeBinaryOperator class
A binary expression operator, which operates on two values.
Contents
Base classes
- class QgsExpressionNode
- Abstract base class for all nodes that can appear in an expression.
Public types
Constructors, destructors, conversion operators
-
QgsExpressionNodeBinaryOperator(QgsExpressionNodeBinaryOperator::
BinaryOperator op, QgsExpressionNode* opLeft, QgsExpressionNode* opRight) - Binary combination of the left and the right with op.
Public functions
- auto clone() const -> QgsExpressionNode* override
- Generate a clone of this node.
- auto dump() const -> QString override
- Dump this node into a serialized (part) of an expression.
- auto evalNode(QgsExpression* parent, const QgsExpressionContext* context) -> QVariant override
- Abstract virtual eval method Errors are reported to the parent.
- auto isStatic(QgsExpression* parent, const QgsExpressionContext* context) const -> bool override
- Returns true if this node can be evaluated for a static value.
- auto leftAssociative() const -> bool
- Returns true if the operator is left-associative.
- auto needsGeometry() const -> bool override
- Abstract virtual method which returns if the geometry is required to evaluate this expression.
- auto nodes() const -> QList<const QgsExpressionNode*> override
- Returns a list of all nodes which are used in this expression.
-
auto nodeType() const -> QgsExpressionNode::
NodeType override - Gets the type of this node.
-
auto op() const -> QgsExpressionNodeBinaryOperator::
BinaryOperator - Returns the binary operator.
- auto opLeft() const -> QgsExpressionNode*
- Returns the node to the left of the operator.
- auto opRight() const -> QgsExpressionNode*
- Returns the node to the right of the operator.
- auto precedence() const -> int
- Returns the precedence index for the operator.
- auto prepareNode(QgsExpression* parent, const QgsExpressionContext* context) -> bool override
- Abstract virtual preparation method Errors are reported to the parent.
- auto referencedColumns() const -> QSet<QString> override
- Abstract virtual method which returns a list of columns required to evaluate this node.
- auto referencedFunctions() const -> QSet<QString> override
- Returns a set of all functions which are used in this expression.
- auto referencedVariables() const -> QSet<QString> override
- Returns a set of all variables which are used in this expression.
- auto text() const -> QString
- Returns a the name of this operator without the operands.
Enum documentation
Function documentation
QgsExpressionNode* QgsExpressionNodeBinaryOperator:: clone() const override
Generate a clone of this node.
| Returns | a deep copy of this node. |
|---|
Ownership is transferred to the caller.
QString QgsExpressionNodeBinaryOperator:: dump() const override
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.
QVariant QgsExpressionNodeBinaryOperator:: evalNode(QgsExpression* parent,
const QgsExpressionContext* context) override
Abstract virtual eval method Errors are reported to the parent.
bool QgsExpressionNodeBinaryOperator:: isStatic(QgsExpression* parent,
const QgsExpressionContext* context) const override
Returns true if this node can be evaluated for a static value.
This is used during the 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 eval()). In case this returns true, prepareNode() will never be called.
bool QgsExpressionNodeBinaryOperator:: needsGeometry() const override
Abstract virtual method which returns if the geometry is required to evaluate this expression.
| Returns | true if a geometry is required to evaluate this expression |
|---|
This needs to call needsGeometry() recursively on any child nodes.
QList<const QgsExpressionNode*> QgsExpressionNodeBinaryOperator:: nodes() const override
Returns a list of all nodes which are used in this expression.
QgsExpressionNode:: NodeType QgsExpressionNodeBinaryOperator:: nodeType() const override
Gets the type of this node.
| Returns | The type of this node |
|---|
QgsExpressionNode* QgsExpressionNodeBinaryOperator:: opLeft() const
Returns the node to the left of the operator.
QgsExpressionNode* QgsExpressionNodeBinaryOperator:: opRight() const
Returns the node to the right of the operator.
int QgsExpressionNodeBinaryOperator:: precedence() const
Returns the precedence index for the operator.
Higher values have higher precedence.
bool QgsExpressionNodeBinaryOperator:: prepareNode(QgsExpression* parent,
const QgsExpressionContext* context) override
Abstract virtual preparation method Errors are reported to the parent.
QSet<QString> QgsExpressionNodeBinaryOperator:: referencedColumns() const override
Abstract virtual method which returns a list of columns required to evaluate this node.
| Returns | A list of columns required to evaluate this expression |
|---|
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.
QString QgsExpressionNodeBinaryOperator:: text() const
Returns a the name of this operator without the operands.
I.e. "AND", "OR", ...