summaryrefslogtreecommitdiff
path: root/src/core/model/Document.hpp
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-20 15:14:28 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2014-12-20 15:14:28 +0100
commitf77ec7ae614810bc317c23138279e115f930aa06 (patch)
treebbd57ad043f124b2bdf6aeebd9c5fda91e4ca679 /src/core/model/Document.hpp
parentf93c95dbd4aab6ebbccc647da5d1d2da437417ce (diff)
Introduced global type variables for model classes and used them in the Domain resolve test, which makes it much easier to understand.
Diffstat (limited to 'src/core/model/Document.hpp')
-rw-r--r--src/core/model/Document.hpp38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp
index a660da7..0e0a416 100644
--- a/src/core/model/Document.hpp
+++ b/src/core/model/Document.hpp
@@ -188,6 +188,11 @@ public:
};
/**
+ * A global variable for the ManagedType of a DocumentEntity.
+ */
+static ManagedType DocumentEntityType{"DocumentEntity", typeid(DocumentEntity)};
+
+/**
* A StructuredEntity is a node in the Structure Tree of a document. For more
* information please refer to the header documentation above.
*/
@@ -260,6 +265,12 @@ public:
};
/**
+ * A global variable for the ManagedType of a StructuredEntity.
+ */
+static ManagedType StructuredEntityType{
+ "StructuredEntity", typeid(StructuredEntity), {&DocumentEntityType}};
+
+/**
* This is a wrapper for primitive types (Variants) inside the document graph.
* The most straightforward example for this is the actual document text, e.g.
* inside a paragraph. In that case this would represent a mere string.
@@ -292,11 +303,17 @@ public:
* contain a StructuredClass with the given name.
*/
static Rooted<DocumentPrimitive> buildEntity(
- Handle<DocumentEntity> parent,
- Variant content, const std::string &fieldName = "");
+ Handle<DocumentEntity> parent, Variant content,
+ const std::string &fieldName = "");
};
/**
+ * A global variable for the ManagedType of a DocumentPrimitive.
+ */
+static ManagedType DocumentPrimitiveType{
+ "DocumentPrimitive", typeid(DocumentPrimitive), {&StructuredEntityType}};
+
+/**
* An AnnotationEntity is a span-like instance that is not bound by the elements
* of the Structure Tree. An annotation may very well overlap and cross the
* limits of StructureEntities. A typical example for AnnotationEntities are
@@ -360,6 +377,18 @@ public:
};
/**
+ * A global variable for the ManagedType of an Anchor.
+ */
+static ManagedType AnchorType{
+ "Anchor", typeid(AnnotationEntity::Anchor), {&StructuredEntityType}};
+
+/**
+ * A global variable for the ManagedType of an AnnotationEntity.
+ */
+static ManagedType AnnotationEntityType{
+ "AnnotationEntity", typeid(AnnotationEntity), {&DocumentEntityType}};
+
+/**
* A Document is mainly a wrapper for the Root structure node of the Document
* Graph.
*/
@@ -378,6 +407,11 @@ public:
Rooted<StructuredEntity> getRoot() const { return root; }
};
+
+/**
+ * A global variable for the ManagedType of a Document.
+ */
+static ManagedType DocumentType{"Document", typeid(Document)};
}
}