diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-16 18:49:12 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-02-16 18:49:12 +0100 |
commit | d4e835e5eaa40e5d7bfe2a51f03505bc27ddc8f7 (patch) | |
tree | d2fac2233abd5dcd3798685325192ebf378770e7 | |
parent | f8c457674aaf1c6b1b3855ca9621ef2887b5100b (diff) | |
parent | f69518b192ba5015e7ececddbfcf3a3695487d00 (diff) |
Merge branch 'master' of somweyr.de:ousia
-rw-r--r-- | data/domain/book.osxml (renamed from data/domain/book.oxm) | 0 | ||||
-rw-r--r-- | data/domain/structure.osxml (renamed from data/domain/structure.oxm) | 0 | ||||
-rw-r--r-- | data/typesystem/color.osxml (renamed from data/typesystem/color.oxm) | 0 | ||||
-rw-r--r-- | src/core/model/Document.cpp | 8 | ||||
-rw-r--r-- | src/core/model/Document.hpp | 25 | ||||
-rw-r--r-- | src/plugins/xml/XmlOutput.cpp | 2 | ||||
-rw-r--r-- | test/plugins/filesystem/FileLocatorTest.cpp | 12 |
7 files changed, 36 insertions, 11 deletions
diff --git a/data/domain/book.oxm b/data/domain/book.osxml index 9659334..9659334 100644 --- a/data/domain/book.oxm +++ b/data/domain/book.osxml diff --git a/data/domain/structure.oxm b/data/domain/structure.osxml index 63d0c5c..63d0c5c 100644 --- a/data/domain/structure.oxm +++ b/data/domain/structure.osxml diff --git a/data/typesystem/color.oxm b/data/typesystem/color.osxml index 782c856..782c856 100644 --- a/data/typesystem/color.oxm +++ b/data/typesystem/color.osxml diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 76835a1..2fcd20d 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -724,6 +724,7 @@ void Document::doResolve(ResolutionState &state) continueResolveCompositum(root, state); } continueResolveReferences(domains, state); + continueResolveReferences(typesystems, state); } bool Document::doValidate(Logger &logger) const @@ -763,11 +764,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( @@ -871,4 +875,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 57a4b1a..6903bb3 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -875,6 +875,7 @@ private: Owned<StructuredEntity> root; NodeVector<AnnotationEntity> annotations; NodeVector<Domain> domains; + NodeVector<Typesystem> typesystems; protected: void doResolve(ResolutionState &state) override; @@ -892,7 +893,8 @@ public: Document(Manager &mgr, std::string name) : RootNode(mgr, std::move(name), nullptr), annotations(this), - domains(this) + domains(this), + typesystems(this) { } @@ -1012,6 +1014,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. @@ -1034,4 +1055,4 @@ extern const Rtti Anchor; } } -#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */
\ No newline at end of file +#endif /* _OUSIA_MODEL_DOCUMENT_HPP_ */ diff --git a/src/plugins/xml/XmlOutput.cpp b/src/plugins/xml/XmlOutput.cpp index 68edc0e..e1f1c31 100644 --- a/src/plugins/xml/XmlOutput.cpp +++ b/src/plugins/xml/XmlOutput.cpp @@ -44,7 +44,7 @@ void XmlTransformer::writeXml(Handle<Document> doc, std::ostream &out, transformStructuredEntity(document, doc->getRoot(), logger, pretty); document->addChild(root); // then serialize. - document->serialize(out, "<?xml version=\"1.0\"?>", pretty); + document->serialize(out, "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>", pretty); } Rooted<Element> XmlTransformer::transformStructuredEntity( diff --git a/test/plugins/filesystem/FileLocatorTest.cpp b/test/plugins/filesystem/FileLocatorTest.cpp index 87a9223..361a3ca 100644 --- a/test/plugins/filesystem/FileLocatorTest.cpp +++ b/test/plugins/filesystem/FileLocatorTest.cpp @@ -213,11 +213,11 @@ TEST(FileLocator, testDefaultSearchPaths) FileLocator locator; locator.addDefaultSearchPaths(); - assert_not_located(locator, "book.oxm", "", ResourceType::UNKNOWN); - assert_located(locator, "domain/book.oxm", "", ResourceType::UNKNOWN); - assert_located(locator, "book.oxm", "", ResourceType::DOMAIN_DESC); - assert_not_located(locator, "color.oxm", "", ResourceType::UNKNOWN); - assert_located(locator, "typesystem/color.oxm", "", ResourceType::UNKNOWN); - assert_located(locator, "color.oxm", "", ResourceType::TYPESYSTEM); + assert_not_located(locator, "book.osxml", "", ResourceType::UNKNOWN); + assert_located(locator, "domain/book.osxml", "", ResourceType::UNKNOWN); + assert_located(locator, "book.osxml", "", ResourceType::DOMAIN_DESC); + assert_not_located(locator, "color.osxml", "", ResourceType::UNKNOWN); + assert_located(locator, "typesystem/color.osxml", "", ResourceType::UNKNOWN); + assert_located(locator, "color.osxml", "", ResourceType::TYPESYSTEM); } } |