From 9249dbedc1a778cf02203a1bcb14880c9bdb0b4e Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Wed, 4 Feb 2015 22:40:40 +0100 Subject: allowed actual field descriptor references. --- src/core/model/Domain.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/core/model/Domain.cpp') diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index 9368005..f8c0779 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -155,19 +155,6 @@ bool Descriptor::doValidate(Logger &logger) const } else { valid = valid & validateName(logger); } - // check if all FieldDescriptors have this Descriptor as parent. - for (Handle fd : fieldDescriptors) { - if (fd->getParent() != this) { - logger.error(std::string("Descriptor \"") + getName() + - "\" has " - "field \"" + - fd->getName() + - "\" as child but the field does not " - "have the Descriptor as parent.", - *this); - valid = false; - } - } // check the FieldDescriptors themselves. return valid & continueValidationCheckDuplicates(fieldDescriptors, logger); } @@ -248,7 +235,20 @@ bool Descriptor::continuePath(Handle target, return found; } + void Descriptor::addFieldDescriptor(Handle fd) +{ + // only add it if we need to. + if (fieldDescriptors.find(fd) == fieldDescriptors.end()) { + invalidate(); + fieldDescriptors.push_back(fd); + } + if (fd->getParent() == nullptr) { + fd->setParent(this); + } +} + +void Descriptor::moveFieldDescriptor(Handle fd) { // only add it if we need to. if (fieldDescriptors.find(fd) == fieldDescriptors.end()) { -- cgit v1.2.3