[glibmm] ByteArray: Add a Glib::Value<> template specialization for it.



commit ce16d7bb5f6b0a70e9b76f808f2f0aa6490042de
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Apr 2 00:37:49 2013 -0400

    ByteArray: Add a Glib::Value<> template specialization for it.
    
        * glib/src/bytearray.{ccg,hg}: Add the specialization for ByteArray so
        that getting/setting properties of that type work.  Also added a
        Glib::ByteArray::get_type() method required for the specialization to
        compile.

 ChangeLog              |    9 +++++++++
 glib/src/bytearray.ccg |    5 +++++
 glib/src/bytearray.hg  |   16 ++++++++++++++++
 3 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d9db708..2a595f0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-04-02  José Alburquerque  <jaalburquerque gmail com>
+
+       ByteArray: Add a Glib::Value<> template specialization for it.
+
+       * glib/src/bytearray.{ccg,hg}: Add the specialization for ByteArray so
+       that getting/setting properties of that type work.  Also added a
+       Glib::ByteArray::get_type() method required for the specialization to
+       compile.
+
 This is the master branch for glibmm 2.37/8.
 See also the glibmm-2-36 branch.
 
diff --git a/glib/src/bytearray.ccg b/glib/src/bytearray.ccg
index 71a0d5f..db3585f 100644
--- a/glib/src/bytearray.ccg
+++ b/glib/src/bytearray.ccg
@@ -43,4 +43,9 @@ Glib::RefPtr<Glib::ByteArray> ByteArray::create()
   return Glib::wrap(array);
 }
 
+GType ByteArray::get_type()
+{
+  return g_byte_array_get_type();
+}
+
 } // namespace Glib
diff --git a/glib/src/bytearray.hg b/glib/src/bytearray.hg
index 8cd6555..a9e2312 100644
--- a/glib/src/bytearray.hg
+++ b/glib/src/bytearray.hg
@@ -39,6 +39,7 @@ class ByteArray
 {
   _CLASS_OPAQUE_REFCOUNTED(ByteArray, GByteArray, NONE, g_byte_array_ref, g_byte_array_unref)
   _IGNORE(g_byte_array_ref, g_byte_array_unref)
+
 public:
   /** A Slot type to compare two elements in the array.  The slot should return
    * -1 if the first value is less than the second, 0 if they are equal and 1
@@ -65,6 +66,21 @@ public:
   _IGNORE(g_byte_array_sort)
 
   _WRAP_METHOD(Glib::RefPtr<ByteArray> set_size(guint length), g_byte_array_set_size)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+  static GType get_type() G_GNUC_CONST;
+#endif
+};
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+template <>
+class Value< Glib::RefPtr<Glib::ByteArray> > : public ValueBase_Boxed
+{
+public:
+  static GType value_type() { return Glib::ByteArray::get_type(); }
+  void set(const Glib::RefPtr<Glib::ByteArray>& array) { set_boxed(Glib::unwrap(array)); }
+  Glib::RefPtr<Glib::ByteArray> get()                  { return 
Glib::RefPtr<Glib::ByteArray>(reinterpret_cast<Glib::ByteArray*>(get_boxed())); }
 };
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
 
 } // namespace Glib


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