summaryrefslogtreecommitdiff
path: root/src/core/model/Document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model/Document.cpp')
-rw-r--r--src/core/model/Document.cpp26
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});