From 05e5a4ab340d0f9f3490e7db9c8e42f70cc471da Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Sun, 8 Feb 2015 19:49:08 +0100 Subject: added check for name attribute in Descriptor. --- src/core/model/Domain.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/core/model') diff --git a/src/core/model/Domain.cpp b/src/core/model/Domain.cpp index 62ee65d..20a9d42 100644 --- a/src/core/model/Domain.cpp +++ b/src/core/model/Domain.cpp @@ -153,9 +153,22 @@ bool Descriptor::doValidate(Logger &logger) const } else { valid = valid & validateName(logger); } + // ensure that no attribute with the key "name" exists. + if (attributesDescriptor == nullptr) { + logger.error("This Descriptor has no Attribute specification!"); + valid = false; + } else { + if (attributesDescriptor->hasAttribute("name")) { + logger.error( + "This Descriptor has an attribute \"name\" which is a reserved " + "word!"); + valid = false; + } + valid = valid & attributesDescriptor->validate(logger); + } + // check attributes and the FieldDescriptors - return valid & attributesDescriptor->validate(logger) & - continueValidationCheckDuplicates(fieldDescriptors, logger); + return valid & continueValidationCheckDuplicates(fieldDescriptors, logger); } std::vector> Descriptor::pathTo( -- cgit v1.2.3