summaryrefslogtreecommitdiff
path: root/test/core/model/TestAdvanced.hpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-15 14:18:07 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-15 14:18:07 +0100
commita1245cf2ad80cba0a71ffb184966ee77a7e166cc (patch)
tree98c593f0277743df25e9b57638c254da8ca0a3cb /test/core/model/TestAdvanced.hpp
parent2194293a5e33cc97a4cb91055ff75425ad14c3d0 (diff)
Further simplified document buildup by doing the addition to parents of StructureNodes in the constructor and refactored Anchor as standalone class instead of AnnotationEntity child. This made some changes in the test bench necessary as well.
Diffstat (limited to 'test/core/model/TestAdvanced.hpp')
-rw-r--r--test/core/model/TestAdvanced.hpp28
1 files changed, 7 insertions, 21 deletions
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index 15a4042..f8585d1 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -115,11 +115,9 @@ static Rooted<Domain> constructEmphasisDomain(Manager &mgr,
// set up domain node.
Rooted<Domain> domain{new Domain(mgr, sys, "emphasis")};
// create AnnotationClasses
- Rooted<AnnotationClass> em{
- new AnnotationClass(mgr, "emphasized", domain)};
+ Rooted<AnnotationClass> em{new AnnotationClass(mgr, "emphasized", domain)};
- Rooted<AnnotationClass> strong{
- new AnnotationClass(mgr, "strong", domain)};
+ Rooted<AnnotationClass> strong{new AnnotationClass(mgr, "strong", domain)};
return domain;
}
@@ -135,12 +133,8 @@ static bool addText(Logger &logger, Handle<Document> doc,
}
// And the primitive content
Variant content_var{content.c_str()};
- Rooted<DocumentPrimitive> primitive =
- buildPrimitiveEntity(logger, text, content_var, "content");
- if (primitive.isNull()) {
- return false;
- }
-
+ Rooted<DocumentPrimitive> primitive{new DocumentPrimitive(
+ parent->getManager(), text, content_var, "content")};
return true;
}
@@ -167,19 +161,12 @@ static bool addAnnotation(Logger &logger, Handle<Document> doc,
Handle<StructuredEntity> parent,
const std::string &text, const std::string &annoClass)
{
- Rooted<AnnotationEntity::Anchor> start =
- buildAnchor(logger, parent, std::to_string(annoIdx++));
- if (start.isNull()) {
- return false;
- }
+ Manager& mgr = parent->getManager();
+ Rooted<Anchor> start{new Anchor(mgr, std::to_string(annoIdx++), parent)};
if (!addText(logger, doc, parent, text)) {
return false;
}
- Rooted<AnnotationEntity::Anchor> end =
- buildAnchor(logger, parent, std::to_string(annoIdx++));
- if (end.isNull()) {
- return false;
- }
+ Rooted<Anchor> end{new Anchor(mgr, std::to_string(annoIdx++), parent)};
Rooted<AnnotationEntity> anno =
buildAnnotationEntity(doc, logger, {annoClass}, start, end);
if (anno.isNull()) {
@@ -191,7 +178,6 @@ static bool addAnnotation(Logger &logger, Handle<Document> doc,
/**
* This constructs a more advanced book document using not only the book
* domain but also headings, emphasis and lists.
- * TODO: insert emphasis and lists.
*/
static Rooted<Document> constructAdvancedDocument(Manager &mgr, Logger &logger,
Handle<Domain> bookDom,