[glibmm] Gio::Variant: Add some get() method overloads.



commit 3f08a14a7228adf5540adbc4e84074979a27d47a
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Mar 16 12:07:01 2011 +0100

    Gio::Variant: Add some get() method overloads.
    
    * glib/src/variant.[hg|ccg]: Variant<VariantBase>: 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(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cbb30a3..eca20cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2011-03-16  Murray Cumming  <murrayc murrayc com>
 
+	Gio::Variant: Add some get() method overloads.
+
+	* glib/src/variant.[hg|ccg]: Variant<VariantBase>: 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  <murrayc murrayc com>
+
 	Dbus::Proxy: properties_changed signal: Avoid namespace qualifiers in header.
 
 	* gio/src/dbusproxy.[h|ccg]: Add a typedef to the .ccg file to help the
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index 07cc518..39b88e0 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -152,6 +152,12 @@ Variant<VariantBase> Variant<VariantBase>::create(const VariantBase& data)
   return result;
 }
 
+void Variant<VariantBase>::get(Glib::VariantBase& variant) const
+{
+  GVariant* const gvariant = g_variant_get_variant(gobject_);
+  variant.init(gvariant);
+}
+
 // static
 const VariantType& Variant<Glib::ustring>::variant_type()
 {
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 9cb1a9e..7ed7d80 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 <class DataType>
@@ -349,6 +351,9 @@ public:
   static Variant<VariantBase> 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)
 };
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]