[glibmm] Added VariantIter source files that I forget to git add before.



commit da51cc09e268cb3812257f2c28c442495a11808e
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 14 09:26:58 2010 +0200

    Added VariantIter source files that I forget to git add before.
    
    * glib/src/variantiter.[hg|ccg]: Added missing files to git.

 ChangeLog                |    6 ++++++
 glib/src/variantiter.ccg |   41 +++++++++++++++++++++++++++++++++++++++++
 glib/src/variantiter.hg  |   44 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 91 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dcb612b..d23e27c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-14  Murray Cumming  <murrayc murrayc com>
+
+	Added VariantIter source files that I forget to git add before.
+
+	* glib/src/variantiter.[hg|ccg]: Added missing files to git.
+
 2010-09-13  José Alburquerque  <jaalburqu svn gnome org>
 
 	giomm: DBusConnection: Wrap async constructors and create methods.
diff --git a/glib/src/variantiter.ccg b/glib/src/variantiter.ccg
new file mode 100644
index 0000000..bf3502c
--- /dev/null
+++ b/glib/src/variantiter.ccg
@@ -0,0 +1,41 @@
+/* Copyright(C) 2010 The glibmm Development Team
+ *
+ * This library is free software, ) you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, ) either
+ * version 2.1 of the License, or(at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, ) without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library, ) if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+namespace Glib
+{
+
+VariantIter::VariantIter(const VariantBase& variant)
+: gobject_(g_variant_iter_new(const_cast<GVariant*>(variant.gobj())))
+{
+}
+
+bool VariantIter::next_value(VariantBase& value)
+{
+  GVariant* const g_value =
+    g_variant_iter_next_value(gobj());
+
+  if(g_value)
+  {
+    value.init(g_value); // g_value is already referenced.
+    return true;
+  }
+  else
+    return false;
+}
+
+} //namespace Glib
diff --git a/glib/src/variantiter.hg b/glib/src/variantiter.hg
new file mode 100644
index 0000000..bbd1a2a
--- /dev/null
+++ b/glib/src/variantiter.hg
@@ -0,0 +1,44 @@
+/* Copyright(C) 2010 The glibmm Development Team
+ *
+ * This library is free software, ) you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, ) either
+ * version 2.1 of the License, or(at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY, ) without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library, ) if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <glibmm/variant.h>
+
+_DEFS(glibmm,glib)
+
+namespace Glib
+{
+
+//This can't be like a real iterator (like Gtk::TextIter),
+//because g_iter_value_get_next_value() both gets a value and changes the iterator.
+//GtkTextIter allows us to go forward and then separately get the current value.
+/** TODO: Documentation.
+ */
+class VariantIter
+{
+  _CLASS_OPAQUE_COPYABLE(VariantIter, GVariantIter, NONE, g_variant_iter_copy, g_variant_iter_free)
+public:
+  explicit VariantIter(const VariantBase& variant);
+  _IGNORE(g_variant_iter_new)
+
+  _WRAP_METHOD(gsize get_n_children() const, g_variant_iter_n_children)
+
+  bool next_value(VariantBase& value);
+  _IGNORE(g_variant_iter_next_value)
+
+};
+
+} // namespace Glib



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