From 3f08a14a7228adf5540adbc4e84074979a27d47a Mon Sep 17 00:00:00 2001 From: Murray Cumming Date: Wed, 16 Mar 2011 12:07:01 +0100 Subject: Gio::Variant: Add some get() method overloads. * glib/src/variant.[hg|ccg]: Variant: Add a get(VariantBase&) along with the existing VariantBase get(). VariantContainerBase: Added a VariantBase get() to match the existing get(VariantBase&). Both seem useful, particularly now that we can cast_dynamic them. VariantContainerBase::get() should maybe be renamed to get_child() too. --- ChangeLog | 12 ++++++++++++ glib/src/variant.ccg | 6 ++++++ glib/src/variant.hg | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/ChangeLog b/ChangeLog index cbb30a38..eca20cd0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2011-03-16 Murray Cumming + + Gio::Variant: Add some get() method overloads. + + * glib/src/variant.[hg|ccg]: Variant: Add a get(VariantBase&) + along with the existing VariantBase get(). + VariantContainerBase: Added a VariantBase get() to match the existing + get(VariantBase&). Both seem useful, particularly now that we can + cast_dynamic them. + + VariantContainerBase::get() should maybe be renamed to get_child() too. + 2011-03-16 Murray Cumming Dbus::Proxy: properties_changed signal: Avoid namespace qualifiers in header. diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg index 07cc5186..39b88e04 100644 --- a/glib/src/variant.ccg +++ b/glib/src/variant.ccg @@ -152,6 +152,12 @@ Variant Variant::create(const VariantBase& data) return result; } +void Variant::get(Glib::VariantBase& variant) const +{ + GVariant* const gvariant = g_variant_get_variant(gobject_); + variant.init(gvariant); +} + // static const VariantType& Variant::variant_type() { diff --git a/glib/src/variant.hg b/glib/src/variant.hg index 9cb1a9e9..7ed7d803 100644 --- a/glib/src/variant.hg +++ b/glib/src/variant.hg @@ -263,6 +263,8 @@ public: void get(Glib::VariantBase& child, gsize index = 0) const; _IGNORE(g_variant_get_child, g_variant_get_child_value) + _WRAP_METHOD(VariantBase get(gsize index = 0), g_variant_get_child_value) + /* TODO?: /// A get() method to return the contents of the variant in the container. template @@ -349,6 +351,9 @@ public: static Variant create(const Glib::VariantBase& data); _IGNORE(g_variant_new_variant) + //TODO: Documentation + void get(Glib::VariantBase& variant) const; + _WRAP_METHOD(VariantBase get() const, g_variant_get_variant) }; -- cgit v1.2.1