[glibmm/glibmm-2-62] Property: Add const get_proxy() returning ReadOnly
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/glibmm-2-62] Property: Add const get_proxy() returning ReadOnly
- Date: Mon, 16 Sep 2019 12:44:00 +0000 (UTC)
commit eea964ac3ac6aa57fdc6f4d348fad3e94fd624de
Author: Daniel Boles <dboles src gnome org>
Date: Mon Sep 16 14:40:35 2019 +0200
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
glib/glibmm/property.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
---
diff --git a/glib/glibmm/property.h b/glib/glibmm/property.h
index a370d3c9..190b10c9 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.
@@ -410,6 +415,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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]