summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-02-16 13:49:47 +0100
committerAndreas Stöckel <andreas@somweyr.de>2015-02-16 13:49:47 +0100
commite2a765fc4eaf559bce04b53ca1a1538b1f5f1628 (patch)
tree3b68bfe0b4c63d695480241a490eb684743fb964
parent658692f5ae3657c5e16b3958f62707d4dacc34b0 (diff)
Allow typesystem references in Document
-rw-r--r--src/core/model/Document.cpp8
-rw-r--r--src/core/model/Document.hpp23
2 files changed, 28 insertions, 3 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp
index 4e101fc..848142d 100644
--- a/src/core/model/Document.cpp
+++ b/src/core/model/Document.cpp
@@ -674,6 +674,7 @@ void Document::doResolve(ResolutionState &state)
continueResolveCompositum(root, state);
}
continueResolveReferences(domains, state);
+ continueResolveReferences(typesystems, state);
}
bool Document::doValidate(Logger &logger) const
@@ -713,11 +714,14 @@ void Document::doReference(Handle<Node> node)
if (node->isa(&RttiTypes::Domain)) {
referenceDomain(node.cast<Domain>());
}
+ if (node->isa(&RttiTypes::Typesystem)) {
+ referenceTypesystem(node.cast<Typesystem>());
+ }
}
RttiSet Document::doGetReferenceTypes() const
{
- return RttiSet{&RttiTypes::Domain};
+ return RttiSet{&RttiTypes::Domain, &RttiTypes::Typesystem};
}
Rooted<StructuredEntity> Document::createRootStructuredEntity(
@@ -821,4 +825,4 @@ const Rtti AnnotationEntity =
.parent(&Node)
.composedOf({&StructuredEntity, &DocumentPrimitive, &Anchor});
}
-} \ No newline at end of file
+}
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp
index 5f06eb0..e314304 100644
--- a/src/core/model/Document.hpp
+++ b/src/core/model/Document.hpp
@@ -754,6 +754,7 @@ private:
Owned<StructuredEntity> root;
NodeVector<AnnotationEntity> annotations;
NodeVector<Domain> domains;
+ NodeVector<Typesystem> typesystems;
protected:
void doResolve(ResolutionState &state) override;
@@ -771,7 +772,8 @@ public:
Document(Manager &mgr, std::string name)
: RootNode(mgr, std::move(name), nullptr),
annotations(this),
- domains(this)
+ domains(this),
+ typesystems(this)
{
}
@@ -891,6 +893,25 @@ public:
}
/**
+ * Adds a Typesystem reference to this Document.
+ */
+ void referenceTypesystem(Handle<Typesystem> d)
+ {
+ invalidate();
+ typesystems.push_back(d);
+ }
+
+ /**
+ * Adds multiple Typesystem references to this Document.
+ */
+ void referenceTypesystems(const std::vector<Handle<Typesystem>> &d)
+ {
+ invalidate();
+ typesystems.insert(typesystems.end(), d.begin(), d.end());
+ }
+
+
+ /**
* Returns true if and only if the given StructureNode is part of this
* document, meaning that there is a path of parent references in the
* Structure Tree leading from the given StructureNode to this Document.