summaryrefslogtreecommitdiff
path: root/src/core/model/Domain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/model/Domain.cpp')
-rw-r--r--src/core/model/Domain.cpp26
1 files changed, 13 insertions, 13 deletions
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<FieldDescriptor> 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,6 +235,7 @@ bool Descriptor::continuePath(Handle<StructuredClass> target,
return found;
}
+
void Descriptor::addFieldDescriptor(Handle<FieldDescriptor> fd)
{
// only add it if we need to.
@@ -255,6 +243,18 @@ void Descriptor::addFieldDescriptor(Handle<FieldDescriptor> fd)
invalidate();
fieldDescriptors.push_back(fd);
}
+ if (fd->getParent() == nullptr) {
+ fd->setParent(this);
+ }
+}
+
+void Descriptor::moveFieldDescriptor(Handle<FieldDescriptor> fd)
+{
+ // only add it if we need to.
+ if (fieldDescriptors.find(fd) == fieldDescriptors.end()) {
+ invalidate();
+ fieldDescriptors.push_back(fd);
+ }
Handle<Managed> par = fd->getParent();
if (par != this) {
if (par != nullptr) {