From 7d1b3c5df2eab1d42179332d467d5756aefed587 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Wed, 14 Jan 2015 02:44:09 +0100 Subject: Implemented attaching Methods and Property information to Types (this will later allow script engines to access these methods). --- src/core/common/Property.hpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/core/common/Property.hpp') diff --git a/src/core/common/Property.hpp b/src/core/common/Property.hpp index 5957e40..72dff71 100644 --- a/src/core/common/Property.hpp +++ b/src/core/common/Property.hpp @@ -129,13 +129,13 @@ protected: * @param valid specifies whether a callback function was given or not. */ PropertyFunction(bool valid) - : valid(valid), propertyType(&PropertyType::None){}; + : valid(valid), propertyType(nullptr){}; public: /** * Returns the type associated with the property function. */ - PropertyType const *propertyType; + std::shared_ptr propertyType; /** * Returns true if a callback function was given, false otherwise. @@ -354,18 +354,18 @@ private: * Description of the type of the property, consisting of an inner and an * outer type. */ - const PropertyType type; + std::shared_ptr type; /** * Object used to read the value of the property. */ - std::unique_ptr getter; + std::shared_ptr getter; /** * Object used to write values of the property. The setter may be invalid * in which case the property is read only. */ - std::unique_ptr setter; + std::shared_ptr setter; protected: /** @@ -379,8 +379,8 @@ protected: * setter function may be invalid, in which case the property is readonly. */ PropertyDescriptor(const PropertyType &type, - std::unique_ptr getter, - std::unique_ptr setter); + std::shared_ptr getter, + std::shared_ptr setter); public: /** @@ -396,7 +396,7 @@ public: * * @return the PropertyType instance describing the type of this property. */ - const PropertyType &getType() const { return type; } + const PropertyType &getType() const { return *type; } /** * Returns the value of the property for the given object. @@ -438,8 +438,8 @@ public: Property(const Getter &getter, const Setter &setter = Setter{}) : PropertyDescriptor( PropertyType{}, - std::unique_ptr{new Getter{getter}}, - std::unique_ptr{new Setter{setter}}) + std::make_shared>(getter), + std::make_shared>(setter)) { } @@ -458,8 +458,8 @@ public: const Setter &setter = Setter{}) : PropertyDescriptor( PropertyType{type}, - std::unique_ptr{new Getter{getter}}, - std::unique_ptr{new Setter{setter}}) + std::make_shared>(getter), + std::make_shared>(setter)) { } @@ -481,8 +481,8 @@ public: const Getter &getter, const Setter &setter = Setter{}) : PropertyDescriptor( PropertyType{type, innerType}, - std::unique_ptr{new Getter{getter}}, - std::unique_ptr{new Setter{setter}}) + std::make_shared>(getter), + std::make_shared>(setter)) { } -- cgit v1.2.3