summaryrefslogtreecommitdiff
path: root/src/core/model/RootNode.cpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-02 01:59:57 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-02 01:59:57 +0100
commitcbeffc5776c93a1b6380d9edfda231c8482f71f5 (patch)
tree1101bde560ac9e960d2e158e48fd70601ee7b2e2 /src/core/model/RootNode.cpp
parente4071ff5894d13e95f72457aac68899610e5d7eb (diff)
Introduced RootNode class from which Document, Domain and Typesystem should derive. This class is needed for the "import" handler.
Diffstat (limited to 'src/core/model/RootNode.cpp')
-rw-r--r--src/core/model/RootNode.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/core/model/RootNode.cpp b/src/core/model/RootNode.cpp
new file mode 100644
index 0000000..fa05c36
--- /dev/null
+++ b/src/core/model/RootNode.cpp
@@ -0,0 +1,41 @@
+/*
+ Ousía
+ Copyright (C) 2014, 2015 Benjamin Paaßen, Andreas Stöckel
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <core/common/RttiBuilder.hpp>
+
+#include "RootNode.hpp"
+
+namespace ousia {
+
+void RootNode::import(Handle<Node> node)
+{
+ if (!node->type().isOneOf(doGetImportTypes())) {
+ throw OusiaException(
+ std::string("Node with type ") + node->type().name +
+ std::string(" cannot be imported in a ") + type().name);
+ }
+ doImport(node);
+}
+
+RttiSet RootNode::getImportTypes() { return doGetImportTypes(); }
+
+namespace RttiTypes {
+const Rtti RootNode = RttiBuilder<ousia::RootNode>("RootNode").parent(&Node);
+}
+}
+