diff options
author | Daniel Boles <dboles@src.gnome.org> | 2019-06-11 23:25:25 +0100 |
---|---|---|
committer | Daniel Boles <dboles@src.gnome.org> | 2019-06-11 23:42:48 +0100 |
commit | 199a6aab97f3a44fc627cddd6cfeb1f477d1ff85 (patch) | |
tree | f2ec0540b674846dd4ead9fbe6675f315466f68f /glib/glibmm | |
parent | bfe785f44dffd7fcd4457f96b7b927092d08ee55 (diff) | |
download | glibmm-199a6aab97f3a44fc627cddd6cfeb1f477d1ff85.tar.gz |
Property: Add const get_proxy() returning ReadOnly
We could only get_proxy() if non-const and with a read/write Proxy. This
resolves that so that we can get a read-only proxy from a const Property
(without having to construct manually from the instance/name as before).
Close https://gitlab.gnome.org/GNOME/glibmm/issues/44
Diffstat (limited to 'glib/glibmm')
-rw-r--r-- | glib/glibmm/property.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h index 86105d83..fbd485f7 100644 --- a/glib/glibmm/property.h +++ b/glib/glibmm/property.h @@ -169,6 +169,7 @@ private: * Glib::Property<bool> property_mybool; * // or private, and combined with Glib::PropertyProxy<>. * Glib::PropertyProxy<int> property_myint() { return property_myint_.get_proxy(); } + * Glib::PropertyProxy_ReadOnly<int> property_myint() const { return property_myint_.get_proxy(); } * * private: * Glib::Property<int> property_myint_; @@ -227,6 +228,10 @@ public: /** Returns a proxy object that can be used to read or write this property. */ inline Glib::PropertyProxy<T> get_proxy(); + + /** Returns a proxy object that can be used to read this property. + */ + inline Glib::PropertyProxy_ReadOnly<T> get_proxy() const; }; /** See Property. @@ -405,6 +410,13 @@ Property<T>::get_proxy() return Glib::PropertyProxy<T>(object_, get_name_internal()); } +template <class T> +inline Glib::PropertyProxy_ReadOnly<T> +Property<T>::get_proxy() const +{ + return Glib::PropertyProxy_ReadOnly<T>(object_, get_name_internal()); +} + /**** Glib::Property_ReadOnly<T> ****************************************************/ template <class T> |