[glibmm] giomm: Add the Converter interface.



commit 4e23540c6d971ba910f0e6c14f2f374213533436
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Sun Sep 2 23:42:32 2012 -0400

    giomm: Add the Converter interface.
    
    	* gio/src/converter.{ccg,hg}: Add the source files wrapping the C
    	functions as methods and wrapping the virtual functions.
    	* gio/src/filelist.am: Include the sources in the build.
    	* gio/src/gio_vfuncs.defs: Add the necessary virtual function
    	definitions so the virtual functions can be wrapped.
    	* tools/m4/convert_gio.m4: Add the new enum and flag conversions.

 ChangeLog               |   11 ++++++++
 gio/src/converter.ccg   |   25 ++++++++++++++++++++
 gio/src/converter.hg    |   59 +++++++++++++++++++++++++++++++++++++++++++++++
 gio/src/filelist.am     |    1 +
 gio/src/gio_vfuncs.defs |   22 +++++++++++++++++
 tools/m4/convert_gio.m4 |    2 +
 6 files changed, 120 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6f0f736..b218589 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-09-02  Josà Alburquerque  <jaalburquerque gmail com>
+
+	giomm: Add the Converter interface.
+
+	* gio/src/converter.{ccg,hg}: Add the source files wrapping the C
+	functions as methods and wrapping the virtual functions.
+	* gio/src/filelist.am: Include the sources in the build.
+	* gio/src/gio_vfuncs.defs: Add the necessary virtual function
+	definitions so the virtual functions can be wrapped.
+	* tools/m4/convert_gio.m4: Add the new enum and flag conversions.
+
 2012-09-01  Murray Cumming  <murrayc murrayc com>
 
         Avoid warnings from documenation generation.
diff --git a/gio/src/converter.ccg b/gio/src/converter.ccg
new file mode 100644
index 0000000..b80d676
--- /dev/null
+++ b/gio/src/converter.ccg
@@ -0,0 +1,25 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm 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 <gio/gio.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/converter.hg b/gio/src/converter.hg
new file mode 100644
index 0000000..c34d13d
--- /dev/null
+++ b/gio/src/converter.hg
@@ -0,0 +1,59 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2012 The giomm 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/interface.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/interface_p.h)
+_PINCLUDE(gio/gio.h)
+
+#ifndef DOXYGEN_SHOULD_SKIP_THIS
+typedef struct _GConverterIface GConverterIface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+_WRAP_ENUM(ConverterResult, GConverterResult)
+_WRAP_ENUM(ConverterFlags, GConverterFlags)
+
+/** Converter - Data conversion interface.
+ * Converter is implemented by objects that convert binary data in various
+ * ways. The conversion can be stateful and may fail at any place.
+ *
+ * Some example conversions are: character set conversion, compression,
+ * decompression and regular expression replace. 
+ *
+ * @newin{2,34}
+ */
+class Converter : public Glib::Interface
+{
+  _CLASS_INTERFACE(Converter, GConverter, G_CONVERTER, GConverterIface)
+
+public:
+  _WRAP_METHOD(ConverterResult convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, ConverterFlags flags, gsize& bytes_read, gsize& bytes_written), g_converter_convert, errthrow)
+  _WRAP_METHOD(void reset(), g_converter_reset)
+
+#m4 _CONVERSION(`gsize*',`gsize&',`*($3)')
+  _WRAP_VFUNC(ConverterResult convert(const void* inbuf, gsize inbuf_size, void* outbuf, gsize outbuf_size, ConverterFlags flags, gsize& bytes_read, gsize& bytes_written, GError** error), "convert")
+
+  _WRAP_VFUNC(void reset(), "reset")
+};
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 33a674d..7871ba7 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -25,6 +25,7 @@ giomm_files_any_hg =			\
 	bufferedinputstream.hg		\
 	bufferedoutputstream.hg		\
 	cancellable.hg			\
+	converter.hg			\
 	credentials.hg			\
 	datainputstream.hg		\
 	dataoutputstream.hg		\
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index 8d9c566..28c5bea 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -229,6 +229,28 @@
   (return-type "GObject*")
 )
 
+; GConverter
+
+(define-vfunc convert
+  (of-object "GConverter")
+  (return-type "GConverterResult")
+  (parameters
+   '("const-void*" "inbuf")
+   '("gsize" "inbuf_size")
+   '("void*" "outbuf")
+   '("gsize" "outbuf_size")
+   '("GConverterFlags" "flags")
+   '("gsize*" "bytes_read")
+   '("gsize*" "bytes_written")
+   '("GError**" "error")
+  )
+)
+
+(define-vfunc reset
+  (of-object "GConverter")
+  (return-type "void")
+)
+
 ; GDBusInterface
 
 (define-vfunc get_info
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 96604f9..c6b681f 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -2,6 +2,8 @@ _CONV_ENUM(G,AppInfoCreateFlags)
 _CONV_ENUM(G,ApplicationFlags)
 _CONV_ENUM(G,AskPasswordFlags)
 _CONV_ENUM(G,BusType)
+_CONV_ENUM(G,ConverterFlags)
+_CONV_ENUM(G,ConverterResult)
 _CONV_ENUM(G,CredentialsType)
 _CONV_ENUM(G,DataStreamByteOrder)
 _CONV_ENUM(G,DataStreamNewlineType)



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