Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 56ada16
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions python/core/qgsexpression.sip
Expand Up @@ -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;
Expand Down

0 comments on commit 56ada16

Please sign in to comment.