From f236e4d7401d55d18707ac3374f913ada41e5b7b Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Thu, 9 Apr 2015 16:02:21 +0200 Subject: added serialization support for attributes descriptors. --- src/core/model/Typesystem.cpp | 8 ++++++++ src/core/model/Typesystem.hpp | 26 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'src/core/model') 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 StructType::getOwnAttributes() const +{ + NodeVector 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 &getAttributes() const { return attributes; }; + const NodeVector &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 getOwnAttributes() const; /** * Returns the index of the given attribute in a data array representing -- cgit v1.2.3