[glibmm] giomm: Add the ZlibDecompressor and the CharsetConverter classes.
- From: Josà Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] giomm: Add the ZlibDecompressor and the CharsetConverter classes.
- Date: Tue, 4 Sep 2012 21:30:43 +0000 (UTC)
commit d62e14c530c0eaeab7436ad947b5bfcc5ed1c885
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Tue Sep 4 17:12:41 2012 -0400
giomm: Add the ZlibDecompressor and the CharsetConverter classes.
* gio/src/charsetconverter.{ccg,hg}:
* gio/src/zlibdecompressor.{ccg,hg}:
* gio/src/filelist.am: Add the new sources wrapping the C functions
and properties in the corresponding classes. Include the sources in
the build.
* gio/src/gio_signals.defs:
* tools/extra_defs_gen/generate_defs_gio.cc: Add the GTypes for the C
types in the property and signal generation utility and regenerate the
defs file so the properties of the new classes can be wrapped.
* gio/src/zlibcompressor.hg: Make the constructor protected and not
private (typo).
ChangeLog | 17 +++++++++
gio/src/charsetconverter.ccg | 30 ++++++++++++++++
gio/src/charsetconverter.hg | 55 +++++++++++++++++++++++++++++
gio/src/filelist.am | 2 +
gio/src/gio_signals.defs | 49 +++++++++++++++++++++++++
gio/src/zlibcompressor.hg | 1 +
gio/src/zlibdecompressor.ccg | 24 ++++++++++++
gio/src/zlibdecompressor.hg | 54 ++++++++++++++++++++++++++++
tools/extra_defs_gen/generate_defs_gio.cc | 2 +
9 files changed, 234 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cb22765..333b508 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2012-09-04 Josà Alburquerque <jaalburquerque gmail com>
+
+ giomm: Add the ZlibDecompressor and the CharsetConverter classes.
+
+ * gio/src/charsetconverter.{ccg,hg}:
+ * gio/src/zlibdecompressor.{ccg,hg}:
+ * gio/src/filelist.am: Add the new sources wrapping the C functions
+ and properties in the corresponding classes. Include the sources in
+ the build.
+ * gio/src/gio_signals.defs:
+ * tools/extra_defs_gen/generate_defs_gio.cc: Add the GTypes for the C
+ types in the property and signal generation utility and regenerate the
+ defs file so the properties of the new classes can be wrapped.
+
+ * gio/src/zlibcompressor.hg: Make the constructor protected and not
+ private (typo).
+
2012-09-03 Josà Alburquerque <jaalburquerque gmail com>
giomm: Add the ZlibCompressor class.
diff --git a/gio/src/charsetconverter.ccg b/gio/src/charsetconverter.ccg
new file mode 100644
index 0000000..967d9c3
--- /dev/null
+++ b/gio/src/charsetconverter.ccg
@@ -0,0 +1,30 @@
+/* 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
+{
+
+CharsetConverter::CharsetConverter(const Glib::ustring& to_charset,
+ const Glib::ustring& from_charset)
+: _CONSTRUCT("to-charset", to_charset.c_str(), "from-charset",
+ from_charset.c_str())
+{
+}
+
+} // namespace Gio
diff --git a/gio/src/charsetconverter.hg b/gio/src/charsetconverter.hg
new file mode 100644
index 0000000..331b9aa
--- /dev/null
+++ b/gio/src/charsetconverter.hg
@@ -0,0 +1,55 @@
+/* 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/object.h>
+#include <giomm/converter.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+/** CharsetConverter - Convert between charsets.
+ * CharsetConverter is an implementation of Converter based on GIConv.
+ * @newin{2,34}
+ */
+class CharsetConverter : public Glib::Object, public Converter
+{
+ _CLASS_GOBJECT(CharsetConverter, GCharsetConverter, G_CHARSET_CONVERTER, Glib::Object, GObject)
+ _IMPLEMENTS_INTERFACE(Converter)
+
+protected:
+ // Handwritten to ignore the final GError** parameter in the *_new()
+ // function.
+ explicit CharsetConverter(const Glib::ustring& to_charset, const Glib::ustring& from_charset);
+ _IGNORE(g_charset_converter_new)
+
+public:
+ _WRAP_METHOD_DOCS_ONLY(g_charset_converter_new)
+ _WRAP_CREATE(const Glib::ustring& to_charset, const Glib::ustring& from_charset)
+
+ _WRAP_METHOD(void set_use_fallback(bool use_fallback), g_charset_converter_set_use_fallback)
+ _WRAP_METHOD(bool get_use_fallback() const, g_charset_converter_get_use_fallback)
+ _WRAP_METHOD(guint get_num_fallbacks() const, g_charset_converter_get_num_fallbacks)
+
+ _WRAP_PROPERTY("from-charset", Glib::ustring)
+ _WRAP_PROPERTY("to-charset", Glib::ustring)
+ _WRAP_PROPERTY("use-fallback", bool)
+};
+
+} // namespace Gio
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 04ff1df..0f7e3eb 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 \
+ charsetconverter.hg \
converter.hg \
credentials.hg \
datainputstream.hg \
@@ -110,6 +111,7 @@ giomm_files_any_hg = \
themedicon.hg \
volume.hg \
volumemonitor.hg \
+ zlibdecompressor.hg \
zlibcompressor.hg
giomm_files_posix_hg = \
diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs
index 2929c0a..e45df18 100644
--- a/gio/src/gio_signals.defs
+++ b/gio/src/gio_signals.defs
@@ -220,6 +220,35 @@
(construct-only #f)
)
+;; From GCharsetConverter
+
+(define-property from-charset
+ (of-object "GCharsetConverter")
+ (prop-type "GParamString")
+ (docs "The character encoding to convert from")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property to-charset
+ (of-object "GCharsetConverter")
+ (prop-type "GParamString")
+ (docs "The character encoding to convert to")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property use-fallback
+ (of-object "GCharsetConverter")
+ (prop-type "GParamBoolean")
+ (docs "Use fallback (of form \<hexval>) for invalid bytes")
+ (readable #t)
+ (writable #t)
+ (construct-only #f)
+)
+
;; From GDataInputStream
(define-property byte-order
@@ -1133,6 +1162,26 @@
(construct-only #f)
)
+;; From GZlibDecompressor
+
+(define-property format
+ (of-object "GZlibDecompressor")
+ (prop-type "GParamEnum")
+ (docs "The format of the compressed data")
+ (readable #t)
+ (writable #t)
+ (construct-only #t)
+)
+
+(define-property file-info
+ (of-object "GZlibDecompressor")
+ (prop-type "GParamObject")
+ (docs "File info")
+ (readable #t)
+ (writable #f)
+ (construct-only #f)
+)
+
;; From GInetAddress
(define-property family
diff --git a/gio/src/zlibcompressor.hg b/gio/src/zlibcompressor.hg
index b6fd0a0..223b617 100644
--- a/gio/src/zlibcompressor.hg
+++ b/gio/src/zlibcompressor.hg
@@ -38,6 +38,7 @@ class ZlibCompressor : public Glib::Object, public Converter
_CLASS_GOBJECT(ZlibCompressor, GZlibCompressor, G_ZLIB_COMPRESSOR, Glib::Object, GObject)
_IMPLEMENTS_INTERFACE(Converter)
+protected:
_WRAP_CTOR(ZlibCompressor(ZlibCompressorFormat format, int level), g_zlib_compressor_new)
public:
diff --git a/gio/src/zlibdecompressor.ccg b/gio/src/zlibdecompressor.ccg
new file mode 100644
index 0000000..4366e58
--- /dev/null
+++ b/gio/src/zlibdecompressor.ccg
@@ -0,0 +1,24 @@
+/* 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>
+#include <giomm/fileinfo.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/zlibdecompressor.hg b/gio/src/zlibdecompressor.hg
new file mode 100644
index 0000000..7ae8166
--- /dev/null
+++ b/gio/src/zlibdecompressor.hg
@@ -0,0 +1,54 @@
+/* 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/object.h>
+#include <giomm/converter.h>
+#include <giomm/zlibcompressor.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+class FileInfo;
+
+/** ZlibDecompressor - Zlib decompressor.
+ * ZlibDecompressor is an implementation of Converter that decompresses data
+ * compressed with zlib.
+ * @newin{2,34}
+ */
+class ZlibDecompressor : public Glib::Object, public Converter
+{
+ _CLASS_GOBJECT(ZlibDecompressor, GZlibDecompressor, G_ZLIB_DECOMPRESSOR, Glib::Object, GObject)
+ _IMPLEMENTS_INTERFACE(Converter)
+
+protected:
+ _WRAP_CTOR(ZlibDecompressor(ZlibCompressorFormat format), g_zlib_decompressor_new)
+
+public:
+ _WRAP_METHOD_DOCS_ONLY(g_zlib_decompressor_new)
+ _WRAP_CREATE(ZlibCompressorFormat format)
+
+ _WRAP_METHOD(Glib::RefPtr<FileInfo> get_file_info(), g_zlib_decompressor_get_file_info)
+ _WRAP_METHOD(Glib::RefPtr<const FileInfo> get_file_info() const, g_zlib_decompressor_get_file_info, constversion)
+
+ _WRAP_PROPERTY("file-info", Glib::RefPtr<FileInfo>)
+ _WRAP_PROPERTY("format", ZlibCompressorFormat)
+};
+
+} // namespace Gio
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index 7285aa1..17556f4 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -44,6 +44,7 @@ int main(int, char**)
<< get_defs(G_TYPE_CANCELLABLE)
<< get_defs(G_TYPE_BUFFERED_INPUT_STREAM)
<< get_defs(G_TYPE_BUFFERED_OUTPUT_STREAM)
+ << get_defs(G_TYPE_CHARSET_CONVERTER)
<< get_defs(G_TYPE_DATA_INPUT_STREAM)
<< get_defs(G_TYPE_DATA_OUTPUT_STREAM)
<< get_defs(G_TYPE_DRIVE)
@@ -93,6 +94,7 @@ int main(int, char**)
<< get_defs(G_TYPE_VOLUME_MONITOR)
<< get_defs(G_TYPE_ZLIB_COMPRESSOR)
+ << get_defs(G_TYPE_ZLIB_DECOMPRESSOR)
// network IO classes
<< get_defs(G_TYPE_INET_ADDRESS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]