From 0b39dfaf91658295e188c010127bafa468b76b4b Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 6 Feb 2015 16:44:47 +0100 Subject: moved setRoot to Document.cpp --- src/core/model/Document.cpp | 14 ++++++++++++++ src/core/model/Document.hpp | 9 +-------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/core/model') diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index f27da1d..fedd899 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -716,6 +716,20 @@ bool Document::hasChild(Handle s) const return false; } +void Document::setRoot(Handle rt){ + if(rt == nullptr || root == rt){ + return; + } + if(root != nullptr){ + root->setParent(nullptr); + } + root = acquire(rt); + if (rt->getParent() != this) { + rt->setParent(this); + } + invalidate(); +} + /* Type registrations */ namespace RttiTypes { const Rtti Document = RttiBuilder("Document") diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 35c6664..5235006 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -732,14 +732,7 @@ public: * parent of the given StructuredEntity if it is not set to this Document * already. */ - void setRoot(Handle root) - { - invalidate(); - this->root = acquire(root); - if (root->getParent() != this) { - root->setParent(this); - } - }; + void setRoot(Handle root); /** * Returns the root StructuredEntity of this Document. -- cgit v1.2.3