diff options
author | Murray Cumming <murrayc@src.gnome.org> | 2005-06-08 16:07:56 +0000 |
---|---|---|
committer | Murray Cumming <murrayc@src.gnome.org> | 2005-06-08 16:07:56 +0000 |
commit | 6f1a5a4f19fed4f0e0b571e160928a2e22211424 (patch) | |
tree | 830b3511456877d773cec93c09931049837ea888 | |
parent | 2f1e54c81ed24b4d58da7c9f95bdee94665745ee (diff) | |
download | glibmm-2-4.tar.gz |
2005-06-08 Murray Cumming <murrayc@murrayc.comglibmm-2-4
* glib/glibmm/propertyproxy.h:
PropertyProxy_ReadOnly<>::get_value(),
PropertyProxy_WriteOnly<>::set_value(): Add implementations
instead of casting to unrelated PropertyProxy() and calling it
there. The AIX compiler did not like this hack. Bug #301610
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | glib/glibmm/propertyproxy.h | 40 |
2 files changed, 36 insertions, 12 deletions
@@ -1,3 +1,11 @@ +2005-06-08 Murray Cumming <murrayc@murrayc.com + + * glib/glibmm/propertyproxy.h: + PropertyProxy_ReadOnly<>::get_value(), + PropertyProxy_WriteOnly<>::set_value(): Add implementations + instead of casting to unrelated PropertyProxy() and calling it + there. The AIX compiler did not like this hack. Bug #301610 + 2005-02-18 Murray Cumming <murrayc@murrayc.com> * glib/glibmm/interface.cc: Interface_Class:add_interface(), used by diff --git a/glib/glibmm/propertyproxy.h b/glib/glibmm/propertyproxy.h index bfba5516..e21c4b25 100644 --- a/glib/glibmm/propertyproxy.h +++ b/glib/glibmm/propertyproxy.h @@ -86,12 +86,7 @@ public: /** Set the value of this property. * @param data The new value for the property. */ - void set_value(const PropertyType& data) - { - PropertyProxy_Base& base = *this; - // The downcast to PropertyProxy<T> is safe, and avoids code duplication. - static_cast<PropertyProxy<T>&>(base).set_value(data); - } + void set_value(const PropertyType& data); /** Set the value of this property back to its default value */ @@ -118,12 +113,7 @@ public: /** Get the value of this property. * @result The current value of the property. */ - PropertyType get_value() const - { - const PropertyProxy_Base& base = *this; - // The downcast to PropertyProxy<T> is safe, and avoids code duplication. - return static_cast<const PropertyProxy<T>&>(base).get_value(); - } + PropertyType get_value() const; operator PropertyType() const { return this->get_value(); } @@ -154,6 +144,32 @@ T PropertyProxy<T>::get_value() const return value.get(); } +//We previously just static_cast<> PropertyProxy_WriteOnly<> to PropertyProxy<> to call its set_value(), +//to avoid code duplication. +//But the AIX compiler does not like that hack. +template <class T> +void PropertyProxy_WriteOnly<T>::set_value(const T& data) +{ + Glib::Value<T> value; + value.init(Glib::Value<T>::value_type()); + + value.set(data); + set_property_(value); +} + +//We previously just static_cast<> PropertyProxy_WriteOnly<> to PropertyProxy<> to call its set_value(), +//to avoid code duplication. +//But the AIX compiler does not like that hack. +template <class T> +T PropertyProxy_ReadOnly<T>::get_value() const +{ + Glib::Value<T> value; + value.init(Glib::Value<T>::value_type()); + + get_property_(value); + return value.get(); +} + #endif /* DOXYGEN_SHOULD_SKIP_THIS */ } // namespace Glib |