diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-19 20:51:04 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-19 20:51:04 +0100 |
commit | 7c64a0770a4800d80c5a53eea2243c46301f7749 (patch) | |
tree | d952136ff67dcf8ac53493fa32cfc9760345b537 /src/core/model/Document.cpp | |
parent | 5f5858d503640286c9e5d23634f9f3a8de6a2091 (diff) |
reintroduced some setters in Domain, but probably not enough yet.
Diffstat (limited to 'src/core/model/Document.cpp')
-rw-r--r-- | src/core/model/Document.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp index a329392..66b36b0 100644 --- a/src/core/model/Document.cpp +++ b/src/core/model/Document.cpp @@ -156,7 +156,7 @@ bool DocumentEntity::doValidate(Logger &logger) const FieldDescriptor::FieldType::PRIMITIVE) { switch (fields[f].size()) { case 0: - if (!fieldDescs[f]->optional) { + if (!fieldDescs[f]->isOptional()) { logger.error(std::string("Primitive Field \"") + fieldDescs[f]->getName() + "\" had no content!"); @@ -180,7 +180,7 @@ bool DocumentEntity::doValidate(Logger &logger) const // we can do a faster check if this field is empty. if (fields[f].size() == 0) { // if this field is optional, an empty field is valid anyways. - if (fieldDescs[f]->optional) { + if (fieldDescs[f]->isOptional()) { continue; } /* @@ -212,6 +212,13 @@ bool DocumentEntity::doValidate(Logger &logger) const // iterate over every actual child of this DocumentEntity for (auto &rc : fields[f]) { + // check if the parent reference is correct. + if (rc->getParent() != subInst) { + logger.error(std::string("A child of field \"") + + fieldDescs[f]->getName() + + "\" has the wrong parent reference!"); + valid = false; + } if (rc->isa(RttiTypes::Anchor)) { // Anchors are uninteresting and can be ignored. continue; @@ -453,7 +460,9 @@ bool Document::doValidate(Logger &logger) const valid = false; } else { // check if the root is allowed to be a root. - if (!root->getDescriptor().cast<StructuredClass>()->root) { + if (!root->getDescriptor() + .cast<StructuredClass>() + ->hasRootPermission()) { logger.error(std::string("A node of type \"") + root->getDescriptor()->getName() + "\" is not allowed to be the Document root!"); |