Skip to content
Permalink
Browse files

PyQGIS: add conversion from QgsExpression::Node to subclasses

This makes it possible to investigate expression node tree within Python
  • Loading branch information
wonder-sk committed May 12, 2015
1 parent 1c64363 commit 56ada166c465eff73b88145511b9f8862c60668f
Showing with 14 additions and 0 deletions.
  1. +14 −0 python/core/qgsexpression.sip
@@ -270,6 +270,20 @@ class QgsExpression

class Node
{
%ConvertToSubClassCode
switch (sipCpp->nodeType())
{
case QgsExpression::ntUnaryOperator: sipClass = sipClass_QgsExpression_NodeUnaryOperator; break;
case QgsExpression::ntBinaryOperator: sipClass = sipClass_QgsExpression_NodeBinaryOperator; break;
case QgsExpression::ntInOperator: sipClass = sipClass_QgsExpression_NodeInOperator; break;
case QgsExpression::ntFunction: sipClass = sipClass_QgsExpression_NodeFunction; break;
case QgsExpression::ntLiteral: sipClass = sipClass_QgsExpression_NodeLiteral; break;
case QgsExpression::ntColumnRef: sipClass = sipClass_QgsExpression_NodeColumnRef; break;
case QgsExpression::ntCondition: sipClass = sipClass_QgsExpression_NodeCondition; break;
default: sipClass = 0; break;
}
%End

public:
virtual ~Node();
virtual QgsExpression::NodeType nodeType() const = 0;

0 comments on commit 56ada16

Please sign in to comment.
You can’t perform that action at this time.