summaryrefslogtreecommitdiff
path: root/src/core/common/Property.hpp
diff options
context:
space:
mode:
authorAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-14 02:44:09 +0100
committerAndreas Stöckel <astoecke@techfak.uni-bielefeld.de>2015-01-14 02:44:09 +0100
commit7d1b3c5df2eab1d42179332d467d5756aefed587 (patch)
tree6a44220ea0781a686d6c7b513ca914ba1ce6e919 /src/core/common/Property.hpp
parent92c1f8d9c933d13a8f038565587c83abae28711e (diff)
Implemented attaching Methods and Property information to Types (this will later allow script engines to access these methods).
Diffstat (limited to 'src/core/common/Property.hpp')
-rw-r--r--src/core/common/Property.hpp28
1 files changed, 14 insertions, 14 deletions
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> 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<PropertyType> type;
/**
* Object used to read the value of the property.
*/
- std::unique_ptr<GetterFunction> getter;
+ std::shared_ptr<GetterFunction> 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<SetterFunction> setter;
+ std::shared_ptr<SetterFunction> 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<GetterFunction> getter,
- std::unique_ptr<SetterFunction> setter);
+ std::shared_ptr<GetterFunction> getter,
+ std::shared_ptr<SetterFunction> 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<T> &getter, const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{},
- std::unique_ptr<GetterFunction>{new Getter<T>{getter}},
- std::unique_ptr<SetterFunction>{new Setter<T>{setter}})
+ std::make_shared<Getter<T>>(getter),
+ std::make_shared<Setter<T>>(setter))
{
}
@@ -458,8 +458,8 @@ public:
const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{type},
- std::unique_ptr<GetterFunction>{new Getter<T>{getter}},
- std::unique_ptr<SetterFunction>{new Setter<T>{setter}})
+ std::make_shared<Getter<T>>(getter),
+ std::make_shared<Setter<T>>(setter))
{
}
@@ -481,8 +481,8 @@ public:
const Getter<T> &getter, const Setter<T> &setter = Setter<T>{})
: PropertyDescriptor(
PropertyType{type, innerType},
- std::unique_ptr<GetterFunction>{new Getter<T>{getter}},
- std::unique_ptr<SetterFunction>{new Setter<T>{setter}})
+ std::make_shared<Getter<T>>(getter),
+ std::make_shared<Setter<T>>(setter))
{
}