[glibmm] VariantContainerBase::create: Don't use pointers to pass the children.



commit af4e26329cb5dbd09dd3db948c0a6214570d7247
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Thu Dec 30 22:22:59 2010 -0500

    VariantContainerBase::create: Don't use pointers to pass the children.
    
    	* glib/src/variant.{ccg,hg} (VariantContainerBase::create): Don't use
    	pointers to the variant children to pass the array of variants, but
    	instead use copies which might be more intuitive for new programmers.
    	It is not clear whether this method should remain or not.  We'll have
    	to wait for the example to be written.

 ChangeLog            |   10 ++++++++++
 glib/src/variant.ccg |    6 +++---
 glib/src/variant.hg  |    2 +-
 3 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 45f407f..737cbb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2010-12-30  José Alburquerque  <jaalburqu svn gnome org>
 
+	VariantContainerBase::create: Don't use pointers to pass the children.
+
+	* glib/src/variant.{ccg,hg} (VariantContainerBase::create): Don't use
+	pointers to the variant children to pass the array of variants, but
+	instead use copies which might be more intuitive for new programmers.
+	It is not clear whether this method should remain or not.  We'll have
+	to wait for the example to be written.
+
+2010-12-30  José Alburquerque  <jaalburqu svn gnome org>
+
 	VariantContainerBase: Add a create() method from an array of variants.
 
 	* glib/src/variant.{ccg,hg}: (VariantContainerBase::create): Add this
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index b6babe8..249e469 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -61,7 +61,7 @@ void VariantStringBase::create_signature(VariantStringBase& output,
 //static
 void VariantContainerBase::create(VariantContainerBase& output,
   const Glib::VariantType& container_type,
-  const std::vector<const VariantBase*>& children)
+  const std::vector<VariantBase>& children)
 {
   g_return_if_fail(container_type.is_container());
 
@@ -69,11 +69,11 @@ void VariantContainerBase::create(VariantContainerBase& output,
   // Variant< std::map<K, V> >::create() method.
   GVariantBuilder* builder = g_variant_builder_new(container_type.gobj());
 
-  for(std::vector<const VariantBase*>::const_iterator iter = children.begin();
+  for(std::vector<VariantBase>::const_iterator iter = children.begin();
     iter < children.end(); iter++)
   {
     g_variant_builder_add_value(builder,
-      const_cast<GVariant*>((*iter)->gobj()));
+      const_cast<GVariant*>((*iter).gobj()));
   }
 
   GVariant* result = g_variant_new(
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 80d3462..9086e99 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -218,7 +218,7 @@ public:
    */
   static void create(VariantContainerBase& output,
     const Glib::VariantType& container_type,
-    const std::vector<const VariantBase*>& children);
+    const std::vector<VariantBase>& children);
 
   _WRAP_METHOD(gsize get_n_children() const, g_variant_n_children)
 



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