summaryrefslogtreecommitdiff
path: root/src/core/model/Document.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-04-15 20:40:01 +0200
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2016-04-25 22:24:19 +0200
commit2a5b3632fb49452adb6ecedb9c678909341ef662 (patch)
tree3d54fc827e584194b36f889d789ba83261676647 /src/core/model/Document.hpp
parent1d0c7f590c8bd42d1daf81ec304b1cf013aa58f9 (diff)
Derive structure entities and annotation entities from common base class to allow resolution for both
Diffstat (limited to 'src/core/model/Document.hpp')
-rw-r--r--src/core/model/Document.hpp33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp
index 1ac913d..b2691c0 100644
--- a/src/core/model/Document.hpp
+++ b/src/core/model/Document.hpp
@@ -172,6 +172,8 @@ private:
protected:
bool doValidate(Logger &logger) const;
+ std::vector<NodeVector<StructureNode>> &getFields() { return fields; }
+
public:
/**
* The constructor for a DocumentEntity. Node that this does not inherit
@@ -498,10 +500,19 @@ public:
};
/**
+ * The DocumentNode class is a dummy class for being capable of selecting
+ * all nodes in the document graph e.g. when resolving element names.
+ */
+class DocumentNode : public Node {
+public:
+ using Node::Node;
+};
+
+/**
* A StructureNode is a Node of the StructureTree of the document. This is a
* common superclass for StructuredEntity, Anchor and DocumentPrimitive.
*/
-class StructureNode : public Node {
+class StructureNode : public DocumentNode {
friend DocumentEntity;
protected:
@@ -524,10 +535,7 @@ public:
* Constructor for an empty StructureNode.
*/
StructureNode(Manager &mgr, std::string name = "",
- Handle<Node> parent = nullptr)
- : Node(mgr, std::move(name), parent)
- {
- }
+ Handle<Node> parent = nullptr);
};
/**
@@ -541,6 +549,7 @@ private:
bool transparent = false;
protected:
+ void doResolve(ResolutionState &state) override;
bool doValidate(Logger &logger) const override;
public:
@@ -675,6 +684,7 @@ public:
: StructureNode(mgr, "", parent, fieldName), content(content)
{
}
+
/**
* Constructor for a DocumentPrimitive.
*
@@ -697,11 +707,18 @@ public:
}
/**
+ * Returns the content of this DocumentPrimitive as a const reference.
+ *
+ * @return the content of this DocumentPrimitive.
+ */
+ const Variant &getContent() const { return content; }
+
+ /**
* Returns the content of this DocumentPrimitive.
*
* @return the content of this DocumentPrimitive.
*/
- Variant getContent() const { return content; }
+ Variant &getContent() { return content; }
/**
* Sets the content of this DocumentPrimitive to the given Variant.
@@ -828,7 +845,7 @@ public:
* the two text exerpts "emphasized" and "and" separately.
*
*/
-class AnnotationEntity : public Node, public DocumentEntity {
+class AnnotationEntity : public DocumentNode, public DocumentEntity {
friend DocumentEntity;
friend Document;
@@ -837,6 +854,7 @@ private:
Owned<Anchor> end;
protected:
+ void doResolve(ResolutionState &state) override;
bool doValidate(Logger &logger) const override;
public:
@@ -1081,6 +1099,7 @@ public:
namespace RttiTypes {
extern const Rtti Document;
+extern const Rtti DocumentNode;
extern const Rtti DocumentEntity;
extern const Rtti AnnotationEntity;
extern const Rtti StructureNode;