diff options
author | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-21 00:30:28 +0100 |
---|---|---|
committer | Benjamin Paassen <bpaassen@techfak.uni-bielefeld.de> | 2015-01-21 00:30:28 +0100 |
commit | 6f1954eb9eed34aa1b5836bd1a2d153470cf3d59 (patch) | |
tree | c578e1b9de54fcd364165b5020bed771fcdef319 /src/core/model/Domain.hpp | |
parent | 497e39289191b7759f95605bc5f2c1eb5069666c (diff) |
introduced Domain validation functionality and a Unit test for it.
Diffstat (limited to 'src/core/model/Domain.hpp')
-rw-r--r-- | src/core/model/Domain.hpp | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp index e4a6967..e485171 100644 --- a/src/core/model/Domain.hpp +++ b/src/core/model/Domain.hpp @@ -271,13 +271,9 @@ private: Owned<Type> primitiveType; bool optional; - /* - * TODO: doValidate with: - * # primitive and primitiveType set and no children XOR other FieldType and - * no primitive type set - * # namecheck - * # parent typecheck - */ +protected: + bool doValidate(Logger &logger) const override; + public: /** * This is the constructor for primitive fields. The type is automatically @@ -348,6 +344,17 @@ public: } /** + * Removes the given StructuredClass from the list of children of this + * FieldDescriptor. + * + * @param c some StructuredClass that shan't be a child of this + * FieldDescriptor anymore. + * @return true if the FieldDescriptor contained this child and false if it + * did not. + */ + bool removeChild(Handle<StructuredClass> c); + + /** * Returns the type of this field (not to be confused with the primitive * type of this field). * @@ -451,14 +458,8 @@ private: protected: void doResolve(ResolutionState &state) override; - /* - * TODO: doValidate with: - * # namecheck - * # FieldDescriptor name uniqueness - * # do all FieldDescriptors have this Descriptor as parent? - * # is the parent a domain? - * # is the attributes descriptor either not set or a StructType? - */ + + bool doValidate(Logger &logger) const override; public: Descriptor(Manager &mgr, std::string name, Handle<Domain> domain, @@ -584,12 +585,12 @@ public: */ typedef RangeSet<size_t> Cardinality; - /** * This is the default cardinality. */ -static Cardinality createAny(){ +static Cardinality createAny() +{ Cardinality any; any.merge(Range<size_t>::typeRangeFrom(0)); return std::move(any); @@ -685,14 +686,8 @@ private: NodeVector<FieldDescriptor> ¤t, std::set<std::string> &overriddenFields) const; - - - /* - * TODO: doValidate with - * # does the subclasses have this class as superclass? - * # are the subclasses and the superclass valid? - * # is this a valid descriptor? - */ +protected: + bool doValidate(Logger &logger) const override; public: /** @@ -883,6 +878,8 @@ protected: * # are all annotationclasses valid and have a unique name? * # are all typesystems valid? */ + bool doValidate(Logger &logger) const override; + public: /** * The constructor for a new domain. Note that this is an empty Domain and |