Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rule based labeling RAII
  • Loading branch information
m-kuhn committed Mar 10, 2019
1 parent 34a792f commit 2ab58c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions python/core/auto_generated/qgsrulebasedlabeling.sip.in
Expand Up @@ -269,6 +269,7 @@ Constructs the labeling from given tree of rules (takes ownership)
~QgsRuleBasedLabeling();

QgsRuleBasedLabeling::Rule *rootRule();
const Rule *rootRule() const;

static QgsRuleBasedLabeling *create( const QDomElement &element, const QgsReadWriteContext &context ) /Factory/;
%Docstring
Expand Down
11 changes: 10 additions & 1 deletion src/core/qgsrulebasedlabeling.cpp
Expand Up @@ -411,7 +411,16 @@ QgsRuleBasedLabeling *QgsRuleBasedLabeling::clone() const

QgsRuleBasedLabeling::~QgsRuleBasedLabeling()
{
delete mRootRule;
}

QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::rootRule()
{
return mRootRule.get();
}

const QgsRuleBasedLabeling::Rule *QgsRuleBasedLabeling::rootRule() const SIP_SKIP
{
return mRootRule.get();
}


Expand Down
6 changes: 3 additions & 3 deletions src/core/qgsrulebasedlabeling.h
Expand Up @@ -346,8 +346,8 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling
explicit QgsRuleBasedLabeling( QgsRuleBasedLabeling::Rule *root SIP_TRANSFER );
~QgsRuleBasedLabeling() override;

QgsRuleBasedLabeling::Rule *rootRule() { return mRootRule; }
const Rule *rootRule() const SIP_SKIP { return mRootRule; }
QgsRuleBasedLabeling::Rule *rootRule();
const Rule *rootRule() const;

//! Create the instance from a DOM element with saved configuration
static QgsRuleBasedLabeling *create( const QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
Expand Down Expand Up @@ -375,7 +375,7 @@ class CORE_EXPORT QgsRuleBasedLabeling : public QgsAbstractVectorLayerLabeling
void toSld( QDomNode &parent, const QgsStringMap &props ) const override;

protected:
Rule *mRootRule = nullptr;
std::unique_ptr<Rule> mRootRule;
};

#ifndef SIP_RUN
Expand Down

0 comments on commit 2ab58c9

Please sign in to comment.