From 821648607f5e0c6702eefbc206c0421d1a347bda Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 16 Jan 2015 17:33:56 +0100 Subject: first attempt on validation method for Document classes. --- src/core/model/Document.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/core/model/Document.hpp') diff --git a/src/core/model/Document.hpp b/src/core/model/Document.hpp index c70a6a3..b73e07d 100644 --- a/src/core/model/Document.hpp +++ b/src/core/model/Document.hpp @@ -108,6 +108,8 @@ #ifndef _OUSIA_MODEL_DOCUMENT_HPP_ #define _OUSIA_MODEL_DOCUMENT_HPP_ +#include + #include #include @@ -159,6 +161,8 @@ protected: fields[getFieldDescriptorIndex(fieldName, true)].push_back(s); } + bool doValidate(Logger &logger, std::set &visited) const; + public: /** * The constructor for a DocumentEntity. Node that this does not inherit @@ -256,8 +260,6 @@ public: return fields[getFieldDescriptorIndex(fieldDescriptor, true)]; } - bool validate(Logger& logger) const; - // TODO: Change this to move methods. // /** // * This adds a StructureNode to the field with the given name. If an @@ -343,6 +345,8 @@ public: * common superclass for StructuredEntity, Anchor and DocumentPrimitive. */ class StructureNode : public Node { + friend DocumentEntity; + public: /** * Constructor for a StructureNode at the root. @@ -364,6 +368,10 @@ public: * information please refer to the header documentation above. */ class StructuredEntity : public StructureNode, public DocumentEntity { +protected: + bool doValidate(Logger &logger, + std::set &visited) const override; + public: /** * Constructor for a StructuredEntity in the Structure Tree. @@ -505,6 +513,9 @@ class AnnotationEntity : public Node, public DocumentEntity { private: Owned start; Owned end; +protected: + bool doValidate(Logger &logger, + std::set &visited) const override; public: /** -- cgit v1.2.3