From 496c4e527852d0fd64a24bd5ac2506e50ba0afc7 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Thu, 15 Jan 2015 12:13:18 +0100 Subject: supported more automatic registration behaviour, checked for internal name consistency regarding FieldDescriptors, AnnotationClasses and StructuredClasses and made adding methods for automatically registered references protected. --- test/core/model/TestDomain.hpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'test/core/model/TestDomain.hpp') diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp index 48db57a..f6b8805 100644 --- a/test/core/model/TestDomain.hpp +++ b/test/core/model/TestDomain.hpp @@ -44,40 +44,37 @@ static Rooted constructBookDomain(Manager &mgr, // Set up the "book" node. Rooted book{new StructuredClass( mgr, "book", domain, single, {nullptr}, {nullptr}, false, true)}; - domain->addStructuredClass(book); + // The structure field of it. Rooted book_field{new FieldDescriptor(mgr, book)}; - book->addFieldDescriptor(book_field); // From there on the "section". Rooted section{ new StructuredClass(mgr, "section", domain, any)}; book_field->addChild(section); - domain->addStructuredClass(section); + // And the field of it. Rooted section_field{new FieldDescriptor(mgr, section)}; - section->addFieldDescriptor(section_field); // We also add the "paragraph", which is transparent. Rooted paragraph{new StructuredClass( mgr, "paragraph", domain, any, {nullptr}, {nullptr}, true)}; section_field->addChild(paragraph); book_field->addChild(paragraph); - domain->addStructuredClass(paragraph); + // And the field of it. Rooted paragraph_field{ new FieldDescriptor(mgr, paragraph)}; - paragraph->addFieldDescriptor(paragraph_field); // We append "subsection" to section. Rooted subsection{ new StructuredClass(mgr, "subsection", domain, any)}; section_field->addChild(subsection); - domain->addStructuredClass(subsection); + // And the field of it. Rooted subsection_field{ new FieldDescriptor(mgr, subsection)}; - subsection->addFieldDescriptor(subsection_field); + // and we add the paragraph to subsections fields subsection_field->addChild(paragraph); @@ -85,12 +82,11 @@ static Rooted constructBookDomain(Manager &mgr, Rooted text{new StructuredClass( mgr, "text", domain, any, {nullptr}, {nullptr}, true)}; paragraph_field->addChild(text); - domain->addStructuredClass(text); + // ... and has a primitive field. Rooted text_field{new FieldDescriptor( mgr, text, domain->getTypesystems()[0]->getTypes()[0], "content", false)}; - text->addFieldDescriptor(text_field); return domain; } @@ -98,4 +94,3 @@ static Rooted constructBookDomain(Manager &mgr, } #endif /* _TEST_DOMAIN_HPP_ */ - -- cgit v1.2.3