From 87a89145c476713fa5716bf1a15b8b4d498d0a61 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 28 Jan 2015 01:04:28 +0100 Subject: Renamed add* and include* methods for referencing another Typesystem/Domain description to "reference*" to have a consistent nomenclature --- src/core/model/Document.hpp | 4 ++-- src/core/model/Domain.hpp | 8 +++----- src/core/model/Typesystem.cpp | 2 +- src/core/model/Typesystem.hpp | 4 ++-- test/core/model/DocumentTest.cpp | 16 ++++++++-------- test/core/model/TestAdvanced.hpp | 2 +- test/core/model/TestDocument.hpp | 2 +- test/plugins/html/DemoOutputTest.cpp | 2 +- 8 files changed, 19 insertions(+), 21 deletions(-) diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 1f2fb37..dcb8966 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -849,7 +849,7 @@ public: /** * Adds a Domain reference to this Document. */ - void addDomain(Handle d) + void referenceDomain(Handle d) { invalidate(); domains.push_back(d); @@ -858,7 +858,7 @@ public: /** * Adds multiple Domain references to this Document. */ - void addDomains(const std::vector> &d) + void referenceDomains(const std::vector> &d) { invalidate(); domains.insert(domains.end(), d.begin(), d.end()); diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index 541a428..cd649d5 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -899,8 +899,6 @@ class Domain : public Node { private: NodeVector structuredClasses; NodeVector annotationClasses; - // TODO: Is it wise to attach the type systems here? If not: What would be - // a good alternative. NodeVector typesystems; protected: @@ -937,7 +935,7 @@ public: Domain(Manager &mgr, Handle sys, std::string name = "") : Domain(mgr, std::move(name)) { - includeTypesystem(sys); + referenceTypesystem(sys); } /** @@ -1071,12 +1069,12 @@ public: /** * Adds a Typesystem reference to this Domain. */ - void includeTypesystem(Handle t) { typesystems.push_back(t); } + void referenceTypesystem(Handle t) { typesystems.push_back(t); } /** * Adds multiple Typesystem references to this Domain. */ - void includeTypesystems(const std::vector> &ts) + void referenceTypesystems(const std::vector> &ts) { typesystems.insert(typesystems.end(), ts.begin(), ts.end()); } diff --git a/src/core/model/Typesystem.cpp b/src/core/model/Typesystem.cpp index 5f8f613..7844227 100644 --- a/src/core/model/Typesystem.cpp +++ b/src/core/model/Typesystem.cpp @@ -542,7 +542,7 @@ Rooted Typesystem::createStructType(const std::string &name) return structType; } -void Typesystem::includeTypesystem(Handle typesystem) +void Typesystem::referenceTypesystem(Handle typesystem) { typesystems.push_back(typesystem); } diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp index 1405ed6..e06938e 100644 --- a/src/core/model/Typesystem.hpp +++ b/src/core/model/Typesystem.hpp @@ -989,7 +989,7 @@ public: Typesystem(Manager &mgr, Handle sys, std::string name) : Typesystem(mgr, std::move(name)) { - includeTypesystem(sys); + referenceTypesystem(sys); } /** @@ -1007,7 +1007,7 @@ public: * @param typesystem is the typesystem that should be added to the * referenced typesystems list. */ - void includeTypesystem(Handle typesystem); + void referenceTypesystem(Handle typesystem); /** * Adds the given type to the to the type list. diff --git a/test/core/model/DocumentTest.cpp b/test/core/model/DocumentTest.cpp index 563f1b4..c629bf5 100644 --- a/test/core/model/DocumentTest.cpp +++ b/test/core/model/DocumentTest.cpp @@ -126,7 +126,7 @@ TEST(Document, validate) { // first an invalid one, which is empty. Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState()); ASSERT_FALSE(doc->validate(logger)); // then add a root, which should make it valid. @@ -138,7 +138,7 @@ TEST(Document, validate) { // A root with an invalid name, however, should make it invalid Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity( doc, logger, {"root"}, {}, "my invalid root"); ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState()); @@ -157,7 +157,7 @@ TEST(Document, validate) * document should be invalid again. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); ASSERT_EQ(ValidationState::UNKNOWN, doc->getValidationState()); @@ -181,7 +181,7 @@ TEST(Document, validate) * A document with one instance of the Child subclass should be valid. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); buildStructuredEntity(doc, logger, root, {"childSub"}); @@ -200,7 +200,7 @@ TEST(Document, validate) * invalid, because it has no children of itself. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); buildStructuredEntity(doc, logger, root, {"childSub"}); @@ -218,7 +218,7 @@ TEST(Document, validate) * valid, because of the override. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); buildStructuredEntity(doc, logger, root, {"childSub"}); @@ -234,7 +234,7 @@ TEST(Document, validate) * invalid again, because we are missing the primitive content. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); Rooted child = @@ -259,7 +259,7 @@ TEST(Document, validate) * Create a valid document in itself. */ Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(domain); + doc->referenceDomain(domain); Rooted root = buildRootStructuredEntity(doc, logger, {"root"}); Rooted start{new Anchor(mgr, "start", root)}; diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp index 035ee8e..d90f917 100644 --- a/test/core/model/TestAdvanced.hpp +++ b/test/core/model/TestAdvanced.hpp @@ -186,7 +186,7 @@ static Rooted constructAdvancedDocument(Manager &mgr, Logger &logger, { // Start with the (empty) document. Rooted doc{new Document(mgr, "kant_was_ist_aufklaerung.oxd")}; - doc->addDomains({bookDom, headingDom, listDom, emphasisDom}); + doc->referenceDomains({bookDom, headingDom, listDom, emphasisDom}); // Add the root. Rooted book = diff --git a/test/core/model/TestDocument.hpp b/test/core/model/TestDocument.hpp index 243672b..0cb52a3 100644 --- a/test/core/model/TestDocument.hpp +++ b/test/core/model/TestDocument.hpp @@ -36,7 +36,7 @@ static Rooted constructBookDocument(Manager &mgr, Logger &logger, { // Start with the (empty) document. Rooted doc{new Document(mgr, "myDoc.oxd")}; - doc->addDomain(bookDomain); + doc->referenceDomain(bookDomain); // Add the root. Rooted root = diff --git a/test/plugins/html/DemoOutputTest.cpp b/test/plugins/html/DemoOutputTest.cpp index 094b5fd..5006655 100644 --- a/test/plugins/html/DemoOutputTest.cpp +++ b/test/plugins/html/DemoOutputTest.cpp @@ -86,7 +86,7 @@ TEST(DemoHTMLTransformer, AnnotationProcessing) // Construct a document only containing overlapping annotations. // it has the form: blablubbla Rooted doc{new Document(mgr, "annotations.oxd")}; - doc->addDomains({bookDom, emDom}); + doc->referenceDomains({bookDom, emDom}); Rooted book = buildRootStructuredEntity(doc, logger, {"book"}); ASSERT_TRUE(book != nullptr); -- cgit v1.2.3