[glibmm] Glib::ObjectBase: overload get_property()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Glib::ObjectBase: overload get_property()
- Date: Thu, 24 Nov 2016 14:17:22 +0000 (UTC)
commit 722f9c1cf7998baf33d4f9d7110f6ad6c4f1858c
Author: Marcin Kolny <marcin kolny gmail com>
Date: Thu Nov 24 15:15:07 2016 +0100
Glib::ObjectBase: overload get_property()
* glib/glibmm/objectbase.h: add convenient overload of get_property(),
which gives a property value as a return value, not as an output
parameter.
https://bugzilla.gnome.org/show_bug.cgi?id=771782
glib/glibmm/objectbase.h | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/glib/glibmm/objectbase.h b/glib/glibmm/objectbase.h
index 6cbc767..c1aabbe 100644
--- a/glib/glibmm/objectbase.h
+++ b/glib/glibmm/objectbase.h
@@ -120,6 +120,10 @@ public:
template <class PropertyType>
void get_property(const Glib::ustring& property_name, PropertyType& value) const;
+ /// You probably want to use a specific property_*() accessor method instead.
+ template <class PropertyType>
+ PropertyType get_property(const Glib::ustring& property_name) const;
+
// TODO: At the next ABI break, delete connect_property_changed_with_return()
// and let connect_property_changed() return sigc::connection.
/** You can use the signal_changed() signal of the property proxy instead.
@@ -294,6 +298,16 @@ ObjectBase::get_property(const Glib::ustring& property_name, PropertyType& value
value = property_value.get();
}
+template <class PropertyType>
+inline PropertyType
+ObjectBase::get_property(const Glib::ustring& property_name) const
+{
+ PropertyType value;
+ get_property(property_name, value);
+
+ return value;
+}
+
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
bool _gobject_cppinstance_already_deleted(GObject* gobject);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]