summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-08 17:20:56 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-01-08 17:20:56 +0100
commit7269e0e232c7971248ffa47aa2ae44786f3d303a (patch)
treeeabdb8a545efd86a3aab3f63deb806e33f08d7a0 /src/core
parent33b92b72ed160f22dc627e841d5f84de4ebc0c6c (diff)
slight changes to Domain and Document. Started to add a more advanced test document creation function as well as the respective domain creation functions. The DemoOutputTest for it looks good so far.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/model/Document.cpp6
-rw-r--r--src/core/model/Domain.hpp12
2 files changed, 9 insertions, 9 deletions
diff --git a/src/core/model/Document.cpp b/src/core/model/Document.cpp
index b700ba4..073f728 100644
--- a/src/core/model/Document.cpp
+++ b/src/core/model/Document.cpp
@@ -100,10 +100,8 @@ static Rooted<StructuredClass> resolveDescriptor(
}
// Otherwise take the first valid result.
for (auto &r : resolved) {
- Managed *m = &(*r);
- StructuredClass *c = dynamic_cast<StructuredClass *>(m);
- if (c != nullptr) {
- return Rooted<StructuredClass>(c);
+ if(r->isa(typeOf<StructuredClass>())){
+ return r.cast<StructuredClass>();
}
}
}
diff --git a/src/core/model/Domain.hpp b/src/core/model/Domain.hpp
index 6995d14..96e13c7 100644
--- a/src/core/model/Domain.hpp
+++ b/src/core/model/Domain.hpp
@@ -261,6 +261,11 @@ protected:
VisitorSet &visited) override;
public:
+ /**
+ * Note, that this flag will always be set to "false" for non-primitive
+ * FieldDescriptors, because in that case the cardinalities regulate
+ * whether children have to be inserted or not.
+ */
const bool optional;
// TODO: What about the name of default fields?
@@ -300,18 +305,15 @@ public:
* TREE for the main or default structure or SUBTREE
* for supporting structures.
* @param name is the name of this field.
- * @param optional should be set to 'false' is this field needs to be
- * filled in order for an instance of the parent
- * Descriptor to be valid.
*/
FieldDescriptor(Manager &mgr, Handle<Descriptor> parent,
FieldType fieldType = FieldType::TREE,
- std::string name = "", bool optional = false)
+ std::string name = "")
: Node(mgr, std::move(name), parent),
children(this),
fieldType(fieldType),
// TODO: What would be a wise initialization of the primitiveType?
- optional(optional)
+ optional(false)
{
}