From 15dd9d1aa1e0cfe8b31364fb42985ee8d5c5fc9d Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Mon, 5 Jan 2015 15:05:28 +0100 Subject: corrected RTTI for domain und document and added a reference to system type system in test domain. --- test/core/model/TestDomain.hpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'test/core/model/TestDomain.hpp') diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp index f457531..54e79ee 100644 --- a/test/core/model/TestDomain.hpp +++ b/test/core/model/TestDomain.hpp @@ -25,33 +25,16 @@ namespace ousia { namespace model { -/** - * This constructs a somewhat trivial system of standard types. - * - * Currently contained: string, text (struct wrapper for string) - */ -static Rooted constructTypeSystem(Manager &mgr, Logger &logger) -{ - Rooted sys{new Typesystem(mgr, "std")}; - Rooted string{new StringType(mgr, sys)}; - sys->addType(string); - Rooted string_struct{StructType::createValidated( - mgr, "text", sys, nullptr, {new Attribute(mgr, "content", string, "", false)}, logger)}; - sys->addType(string_struct); - - return sys; -} - /** * This constructs the "book" domain for test purposes. The structure of the * domain is fairly simple and can be seen from the construction itself. */ -static Rooted constructBookDomain(Manager &mgr, Logger &logger) +static Rooted constructBookDomain(Manager &mgr, + Handle sys, + Logger &logger) { // Start with the Domain itself. - Rooted domain{new Domain(mgr, "book")}; - // The standard type system. - domain->getTypesystems().push_back(constructTypeSystem(mgr, logger)); + Rooted domain{new Domain(mgr, sys, "book")}; // Set up the cardinalities we'll need. Cardinality single; single.merge({1}); @@ -82,9 +65,10 @@ static Rooted constructBookDomain(Manager &mgr, Logger &logger) book_field->getChildren().push_back(paragraph); domain->getStructureClasses().push_back(paragraph); // And the field of it. - Rooted paragraph_field{new FieldDescriptor(mgr, paragraph)}; + Rooted paragraph_field{ + new FieldDescriptor(mgr, paragraph)}; paragraph->getFieldDescriptors().push_back(paragraph_field); - + // Finally we add the "text" node, which is transparent as well. Rooted text{new StructuredClass( mgr, "text", domain, any, {nullptr}, {nullptr}, true)}; -- cgit v1.2.3