diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-15 12:13:18 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-15 12:13:18 +0100 |
commit | 496c4e527852d0fd64a24bd5ac2506e50ba0afc7 (patch) | |
tree | dfcd496dd09e203849d0c4a557f48f355fbfc9c4 /src/core/model/Document.cpp | |
parent | 86885e5a63c10d264bac822cb054607c27c0f734 (diff) |
supported more automatic registration behaviour, checked for internal name consistency regarding FieldDescriptors, AnnotationClasses and StructuredClasses and made adding methods for automatically registered references protected.
Diffstat (limited to 'src/core/model/Document.cpp')
-rw-r--r-- | src/core/model/Document.cpp | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index 022b91c..eca24e7 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -58,7 +58,8 @@ int DocumentEntity::getFieldDescriptorIndex(const std::string &fieldName, } } if (enforce) { - throw OusiaException("No field for the given name exists!"); + throw OusiaException(descriptor->getName() + + " has no field with name " + fieldName); } else { return -1; } @@ -80,15 +81,27 @@ int DocumentEntity::getFieldDescriptorIndex( f++; } if (enforce) { - throw OusiaException( - "The given FieldDescriptor is not specified in the Descriptor of " - "this " - "node."); + throw OusiaException(descriptor->getName() + + " has no field with name " + + fieldDescriptor->getName()); } else { return -1; } } +/* Class AnnotationEntity */ + +AnnotationEntity::AnnotationEntity(Manager &mgr, Handle<Document> parent, + Handle<AnnotationClass> descriptor, Handle<Anchor> start, + Handle<Anchor> end, Variant attributes, std::string name) + : Node(mgr, std::move(name), parent), + DocumentEntity(this, descriptor, attributes), + start(acquire(start)), + end(acquire(end)) +{ + parent->annotations.push_back(this); +} + /* Class Document */ void Document::continueResolve(ResolutionState &state) @@ -109,8 +122,7 @@ const Rtti<model::Document> Document = const Rtti<model::StructureNode> StructureNode = RttiBuilder("StructureNode").parent(&Node); const Rtti<model::AnnotationEntity> AnnotationEntity = - RttiBuilder("AnnotationEntity").parent(&Node).composedOf( - &StructureNode); + RttiBuilder("AnnotationEntity").parent(&Node).composedOf(&StructureNode); const Rtti<model::StructuredEntity> StructuredEntity = RttiBuilder("StructuredEntity").parent(&StructureNode).composedOf( {&StructureNode}); |