summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/model/TestAdvanced.hpp22
-rw-r--r--test/core/model/TestDocumentBuilder.hpp13
-rw-r--r--test/core/model/TestDomain.hpp32
3 files changed, 32 insertions, 35 deletions
diff --git a/test/core/model/TestAdvanced.hpp b/test/core/model/TestAdvanced.hpp
index 769a0df..696fbed 100644
--- a/test/core/model/TestAdvanced.hpp
+++ b/test/core/model/TestAdvanced.hpp
@@ -60,9 +60,9 @@ static Rooted<Domain> constructHeadingDomain(Manager &mgr,
mgr, "heading", domain, card, {nullptr}, {nullptr}, true)};
// as field we actually want to refer to the field of paragraph.
Rooted<StructuredClass> p = resolveDescriptor(bookDomain, "paragraph");
- heading->getFieldDescriptors().push_back(p->getFieldDescriptors()[0]);
+ heading->addFieldDescriptor(p->getFieldDescriptors()[0]);
// add the class to the domain.
- domain->getStructureClasses().push_back(heading);
+ domain->addStructuredClass(heading);
// create a new field for headings in each section type.
std::vector<std::string> secclasses{"book", "section", "subsection",
"paragraph"};
@@ -70,8 +70,8 @@ static Rooted<Domain> constructHeadingDomain(Manager &mgr,
Rooted<StructuredClass> desc = resolveDescriptor(bookDomain, s);
Rooted<FieldDescriptor> heading_field{new FieldDescriptor(
mgr, desc, FieldDescriptor::FieldType::SUBTREE, "heading")};
- heading_field->getChildren().push_back(heading);
- desc->getFieldDescriptors().push_back(heading_field);
+ heading_field->addChild(heading);
+ desc->addFieldDescriptor(heading_field);
}
return domain;
}
@@ -94,18 +94,18 @@ static Rooted<Domain> constructListDomain(Manager &mgr,
// set up item StructuredClass;
Rooted<StructuredClass> item{new StructuredClass(
mgr, "item", domain, any, {nullptr}, {nullptr}, false)};
- domain->getStructureClasses().push_back(item);
+ domain->addStructuredClass(item);
// as field we actually want to refer to the field of paragraph.
- item->getFieldDescriptors().push_back(p->getFieldDescriptors()[0]);
+ item->addFieldDescriptor(p->getFieldDescriptors()[0]);
// set up list StructuredClasses.
std::vector<std::string> listTypes{"ol", "ul"};
for (auto &listType : listTypes) {
Rooted<StructuredClass> list{new StructuredClass(
mgr, listType, domain, any, {nullptr}, p, false)};
Rooted<FieldDescriptor> list_field{new FieldDescriptor(mgr, list)};
- list_field->getChildren().push_back(item);
- list->getFieldDescriptors().push_back(list_field);
- domain->getStructureClasses().push_back(list);
+ list_field->addChild(item);
+ list->addFieldDescriptor(list_field);
+ domain->addStructuredClass(list);
}
return domain;
}
@@ -122,10 +122,10 @@ static Rooted<Domain> constructEmphasisDomain(Manager &mgr,
// create AnnotationClasses
Rooted<AnnotationClass> em{
new AnnotationClass(mgr, "emphasized", domain, {nullptr})};
- domain->getAnnotationClasses().push_back(em);
+ domain->addAnnotationClass(em);
Rooted<AnnotationClass> strong{
new AnnotationClass(mgr, "strong", domain, {nullptr})};
- domain->getAnnotationClasses().push_back(strong);
+ domain->addAnnotationClass(strong);
return domain;
}
diff --git a/test/core/model/TestDocumentBuilder.hpp b/test/core/model/TestDocumentBuilder.hpp
index ed7a0ee..4662a28 100644
--- a/test/core/model/TestDocumentBuilder.hpp
+++ b/test/core/model/TestDocumentBuilder.hpp
@@ -165,8 +165,7 @@ Rooted<StructuredEntity> buildStructuredEntity(
fieldName + "!");
return {nullptr};
}
- NodeVector<StructuredEntity> &field = parent->getField(fieldName);
- field.push_back(entity);
+ parent->addStructuredEntity(entity, fieldName);
// and return it.
return entity;
@@ -205,8 +204,7 @@ Rooted<DocumentPrimitive> buildPrimitiveEntity(
fieldName + "!");
return {nullptr};
}
- NodeVector<StructuredEntity> &field = parent->getField(fieldName);
- field.push_back(entity);
+ parent->addStructuredEntity(entity, fieldName);
// and return it.
return entity;
}
@@ -244,8 +242,7 @@ Rooted<AnnotationEntity::Anchor> buildAnchor(Logger &logger,
fieldName + "!");
return {nullptr};
}
- NodeVector<StructuredEntity> &field = parent->getField(fieldName);
- field.push_back(anchor);
+ parent->addStructuredEntity(anchor, fieldName);
// and return it.
return anchor;
}
@@ -289,9 +286,9 @@ Rooted<AnnotationEntity> buildAnnotationEntity(
// Then construct the AnnotationEntity itself
Rooted<AnnotationEntity> anno{new AnnotationEntity(
document->getManager(), document, descriptor.cast<AnnotationClass>(),
- attributes, start, end, name)};
+ start, end, attributes, name)};
// append the new entity to the document
- document->getAnnotations().push_back(anno);
+ document->addAnnotation(anno);
// and return it.
return anno;
}
diff --git a/test/core/model/TestDomain.hpp b/test/core/model/TestDomain.hpp
index aa3096d..48db57a 100644
--- a/test/core/model/TestDomain.hpp
+++ b/test/core/model/TestDomain.hpp
@@ -44,53 +44,53 @@ static Rooted<Domain> constructBookDomain(Manager &mgr,
// Set up the "book" node.
Rooted<StructuredClass> book{new StructuredClass(
mgr, "book", domain, single, {nullptr}, {nullptr}, false, true)};
- domain->getStructureClasses().push_back(book);
+ domain->addStructuredClass(book);
// The structure field of it.
Rooted<FieldDescriptor> book_field{new FieldDescriptor(mgr, book)};
- book->getFieldDescriptors().push_back(book_field);
+ book->addFieldDescriptor(book_field);
// From there on the "section".
Rooted<StructuredClass> section{
new StructuredClass(mgr, "section", domain, any)};
- book_field->getChildren().push_back(section);
- domain->getStructureClasses().push_back(section);
+ book_field->addChild(section);
+ domain->addStructuredClass(section);
// And the field of it.
Rooted<FieldDescriptor> section_field{new FieldDescriptor(mgr, section)};
- section->getFieldDescriptors().push_back(section_field);
+ section->addFieldDescriptor(section_field);
// We also add the "paragraph", which is transparent.
Rooted<StructuredClass> paragraph{new StructuredClass(
mgr, "paragraph", domain, any, {nullptr}, {nullptr}, true)};
- section_field->getChildren().push_back(paragraph);
- book_field->getChildren().push_back(paragraph);
- domain->getStructureClasses().push_back(paragraph);
+ section_field->addChild(paragraph);
+ book_field->addChild(paragraph);
+ domain->addStructuredClass(paragraph);
// And the field of it.
Rooted<FieldDescriptor> paragraph_field{
new FieldDescriptor(mgr, paragraph)};
- paragraph->getFieldDescriptors().push_back(paragraph_field);
+ paragraph->addFieldDescriptor(paragraph_field);
// We append "subsection" to section.
Rooted<StructuredClass> subsection{
new StructuredClass(mgr, "subsection", domain, any)};
- section_field->getChildren().push_back(subsection);
- domain->getStructureClasses().push_back(subsection);
+ section_field->addChild(subsection);
+ domain->addStructuredClass(subsection);
// And the field of it.
Rooted<FieldDescriptor> subsection_field{
new FieldDescriptor(mgr, subsection)};
- subsection->getFieldDescriptors().push_back(subsection_field);
+ subsection->addFieldDescriptor(subsection_field);
// and we add the paragraph to subsections fields
- subsection_field->getChildren().push_back(paragraph);
+ subsection_field->addChild(paragraph);
// Finally we add the "text" node, which is transparent as well.
Rooted<StructuredClass> text{new StructuredClass(
mgr, "text", domain, any, {nullptr}, {nullptr}, true)};
- paragraph_field->getChildren().push_back(text);
- domain->getStructureClasses().push_back(text);
+ paragraph_field->addChild(text);
+ domain->addStructuredClass(text);
// ... and has a primitive field.
Rooted<FieldDescriptor> text_field{new FieldDescriptor(
mgr, text, domain->getTypesystems()[0]->getTypes()[0], "content",
false)};
- text->getFieldDescriptors().push_back(text_field);
+ text->addFieldDescriptor(text_field);
return domain;
}