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. --- src/core/model/Document.hpp | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'src/core/model/Document.hpp') diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index 357b752..15a5ec8 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -427,7 +427,9 @@ public: * The constructor for an AnnotationEntity. * * @param mgr is the Manager instance. - * @param parent is the Document this AnnotationEntity is part of. + * @param parent is the Document this AnnotationEntity is part of. The + * constructor will automatically register this + * AnnotationEntity at that document. * @param descriptor is the AnnotationClass of this AnnotationEntity. * @param start is the start Anchor of this AnnotationEntity. It has to * be part of the Document given as parent. @@ -441,13 +443,7 @@ public: AnnotationEntity(Manager &mgr, Handle parent, Handle descriptor, Handle start, Handle end, Variant attributes = {}, - std::string name = "") - : Node(mgr, std::move(name), parent), - DocumentEntity(this, descriptor, attributes), - start(acquire(start)), - end(acquire(end)) - { - } + std::string name = ""); /** * Returns the start Anchor of this AnnotationEntity. @@ -470,6 +466,9 @@ public: * document and the AnnotationEntities that span over Anchors in this Document. */ class Document : public Node { + +friend AnnotationEntity; + private: // TODO: Might there be several roots? E.g. metadata? Owned root; @@ -510,21 +509,6 @@ public: return annotations; } - /** - * Adds an AnnotationEntity to this document. The Anchors used as start and - * end of this AnnotationEntity have to be part of this document. - */ - void addAnnotation(Handle a) { annotations.push_back(a); } - /** - * Adds multiple AnnotationEntities to this document. The Anchors used as - * start and end of these AnnotationEntities have to be part of this - * document. - */ - void addAnnotations(const std::vector> &as) - { - annotations.insert(annotations.end(), as.begin(), as.end()); - } - /** * Returns a const reference to the NodeVector of Domains that are used * within this Document. -- cgit v1.2.3