Skip to content

Commit

Permalink
Dump CASE correctly in QgsExpression::dump()
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jan 27, 2014
1 parent 578a83a commit eb9a22e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/core/qgsexpression.cpp
Expand Up @@ -2315,13 +2315,14 @@ bool QgsExpression::NodeCondition::prepare( QgsExpression* parent, const QgsFiel

QString QgsExpression::NodeCondition::dump() const
{
QString msg = "CONDITION:\n";
QString msg = QString("CASE ");
foreach ( WhenThen* cond, mConditions )
{
msg += QString( "- WHEN %1 THEN %2\n" ).arg( cond->mWhenExp->dump() ).arg( cond->mThenExp->dump() );
msg += QString( "WHEN %1 THEN %2" ).arg( cond->mWhenExp->dump() ).arg( cond->mThenExp->dump() );
}
if ( mElseExp )
msg += QString( "- ELSE %1" ).arg( mElseExp->dump() );
msg += QString( "ELSE %1" ).arg( mElseExp->dump() );
msg += QString(" END");
return msg;
}

Expand Down
7 changes: 2 additions & 5 deletions src/core/qgsexpression.h
Expand Up @@ -152,12 +152,9 @@ class CORE_EXPORT QgsExpression

int scale() {return mScale; }

//! Return the expression string that was given when created.
const QString expression() const { return mExp; }
const QString expression() const { return dump(); }

//! Return the a debugging string of the expression.
//! This can be used for debugging. Use {@link expression()}
//! if you need the full expression string.
//! Return the expression string that represents this QgsExpression.
QString dump() const;

//! Return calculator used for distance and area calculations
Expand Down

0 comments on commit eb9a22e

Please sign in to comment.