summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-04-09 16:02:21 +0200
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2016-04-25 22:19:35 +0200
commitf236e4d7401d55d18707ac3374f913ada41e5b7b (patch)
tree7770f397b4ce2487ae19ed11143583f7d44e3af2 /src/core
parentf98526eb42909efbc8b2b4f85dfbfd588e25f515 (diff)
added serialization support for attributes descriptors.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/model/Typesystem.cpp8
-rw-r--r--src/core/model/Typesystem.hpp26
-rw-r--r--src/core/parser/stack/OntologyHandler.cpp2
3 files changed, 26 insertions, 10 deletions
diff --git a/src/core/model/Typesystem.cpp b/src/core/model/Typesystem.cpp
index df2b9fb..688cb60 100644
--- a/src/core/model/Typesystem.cpp
+++ b/src/core/model/Typesystem.cpp
@@ -618,6 +618,14 @@ bool StructType::cast(Variant &data, Logger &logger) const
return buildFromArrayOrMap(data, logger, NullMagicCallback, true);
}
+NodeVector<Attribute> StructType::getOwnAttributes() const
+{
+ NodeVector<Attribute> res;
+ res.insert(res.end(), attributes.begin() + attributeStart,
+ attributes.end());
+ return res;
+}
+
ssize_t StructType::indexOf(const std::string &name) const
{
size_t res;
diff --git a/src/core/model/Typesystem.hpp b/src/core/model/Typesystem.hpp
index 559a74c..193726d 100644
--- a/src/core/model/Typesystem.hpp
+++ b/src/core/model/Typesystem.hpp
@@ -64,20 +64,20 @@ public:
*/
enum class MagicCallbackResult {
/**
- * A magic value with the given name could not be resolved.
- */
+ * A magic value with the given name could not be resolved.
+ */
NOT_FOUND,
/**
- * A magic value with the given name could be resolved, but is of the
- * wrong type.
- */
+ * A magic value with the given name could be resolved, but is of the
+ * wrong type.
+ */
FOUND_INVALID,
/**
- * A magic value with the given name could be resolved and is of the
- * correct type.
- */
+ * A magic value with the given name could be resolved and is of the
+ * correct type.
+ */
FOUND_VALID
};
@@ -953,7 +953,15 @@ public:
*
* @return a const reference pointing at the attribute list.
*/
- const NodeVector<Attribute> &getAttributes() const { return attributes; };
+ const NodeVector<Attribute> &getAttributes() const { return attributes; }
+
+ /**
+ * Returns a vector of all attributes that belong to this StructType itself,
+ * excluding the attributes of the parent structure.
+ *
+ * @return a vector of all attributes that belong to this StructType itself.
+ */
+ NodeVector<Attribute> getOwnAttributes() const;
/**
* Returns the index of the given attribute in a data array representing
diff --git a/src/core/parser/stack/OntologyHandler.cpp b/src/core/parser/stack/OntologyHandler.cpp
index 0a33c97..0cd8140 100644
--- a/src/core/parser/stack/OntologyHandler.cpp
+++ b/src/core/parser/stack/OntologyHandler.cpp
@@ -108,7 +108,7 @@ void OntologyAnnotationHandler::end() { scope().pop(logger()); }
bool OntologyAttributesHandler::startCommand(Variant::mapType &args)
{
- // Fetch the current typesystem and create the struct node
+ // Fetch the current descriptor and add the attributes descriptor
Rooted<Descriptor> parent = scope().selectOrThrow<Descriptor>();
Rooted<StructType> attrDesc = parent->getAttributesDescriptor();