[glibmm/wip/dboles/property-proxy-const: 2/2] Property: Add const get_proxy() returning ReadOnly
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm/wip/dboles/property-proxy-const: 2/2] Property: Add const get_proxy() returning ReadOnly
- Date: Tue, 11 Jun 2019 22:43:19 +0000 (UTC)
commit 199a6aab97f3a44fc627cddd6cfeb1f477d1ff85
Author: Daniel Boles <dboles src gnome org>
Date: Tue Jun 11 23:25:25 2019 +0100
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 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]