From 78bdb210ad81edd0ba41a6adfc4797b1ccc62228 Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 23 Jan 2015 00:40:51 +0100 Subject: Added 'createChild'-style methods to Document and Domain classes. --- src/core/model/Domain.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/core/model/Domain.cpp') diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index b425174..c7afd22 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -289,6 +289,20 @@ bool Descriptor::removeFieldDescriptor(Handle fd) return false; } +Rooted Descriptor::createPrimitiveFieldDescriptor( + Handle primitiveType, std::string name, bool optional) +{ + return Rooted{new FieldDescriptor( + getManager(), this, primitiveType, std::move(name), optional)}; +} + +Rooted Descriptor::createFieldDescriptor( + FieldDescriptor::FieldType fieldType, std::string name, bool optional) +{ + return Rooted{new FieldDescriptor( + getManager(), this, fieldType, std::move(name), optional)}; +} + /* Class StructuredClass */ StructuredClass::StructuredClass(Manager &mgr, std::string name, @@ -481,6 +495,16 @@ bool Domain::removeStructuredClass(Handle s) return false; } +Rooted Domain::createStructuredClass( + std::string name, const Cardinality &cardinality, + Handle attributesDescriptor, Handle superclass, + bool transparent, bool root) +{ + return Rooted{new StructuredClass( + getManager(), std::move(name), this, cardinality, attributesDescriptor, + superclass, std::move(transparent), std::move(root))}; +} + void Domain::addAnnotationClass(Handle a) { // only add it if we need to. @@ -509,6 +533,13 @@ bool Domain::removeAnnotationClass(Handle a) } return false; } + +Rooted Domain::createAnnotationClass( + std::string name, Handle attributesDescriptor) +{ + return Rooted{new AnnotationClass( + getManager(), std::move(name), this, attributesDescriptor)}; +} } /* Type registrations */ -- cgit v1.2.3