diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-23 00:40:51 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-23 00:40:51 +0100 |
commit | 78bdb210ad81edd0ba41a6adfc4797b1ccc62228 (patch) | |
tree | 6abf6b224f1a2d7c8a31894634d2f9f313997afd /src/core/model/Domain.cpp | |
parent | 33008f1110523ae9c9b9e1d2ca24ed642637c40d (diff) |
Added 'createChild'-style methods to Document and Domain classes.
Diffstat (limited to 'src/core/model/Domain.cpp')
-rw-r--r-- | src/core/model/Domain.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
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<FieldDescriptor> fd) return false; } +Rooted<FieldDescriptor> Descriptor::createPrimitiveFieldDescriptor( + Handle<Type> primitiveType, std::string name, bool optional) +{ + return Rooted<FieldDescriptor>{new FieldDescriptor( + getManager(), this, primitiveType, std::move(name), optional)}; +} + +Rooted<FieldDescriptor> Descriptor::createFieldDescriptor( + FieldDescriptor::FieldType fieldType, std::string name, bool optional) +{ + return Rooted<FieldDescriptor>{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<StructuredClass> s) return false; } +Rooted<StructuredClass> Domain::createStructuredClass( + std::string name, const Cardinality &cardinality, + Handle<StructType> attributesDescriptor, Handle<StructuredClass> superclass, + bool transparent, bool root) +{ + return Rooted<StructuredClass>{new StructuredClass( + getManager(), std::move(name), this, cardinality, attributesDescriptor, + superclass, std::move(transparent), std::move(root))}; +} + void Domain::addAnnotationClass(Handle<AnnotationClass> a) { // only add it if we need to. @@ -509,6 +533,13 @@ bool Domain::removeAnnotationClass(Handle<AnnotationClass> a) } return false; } + +Rooted<AnnotationClass> Domain::createAnnotationClass( + std::string name, Handle<StructType> attributesDescriptor) +{ + return Rooted<AnnotationClass>{new AnnotationClass( + getManager(), std::move(name), this, attributesDescriptor)}; +} } /* Type registrations */ |