summaryrefslogtreecommitdiff
path: root/gio
diff options
context:
space:
mode:
authorJosé Alburquerque <jaalburqu@svn.gnome.org>2012-09-04 17:12:41 -0400
committerJosé Alburquerque <jaalburqu@svn.gnome.org>2012-09-04 17:18:56 -0400
commitd62e14c530c0eaeab7436ad947b5bfcc5ed1c885 (patch)
tree44165cbe624aea12f42242f32447b13b2c56123b /gio
parentd18411d611bf9b1f0b33cbefe361f54e97909949 (diff)
downloadglibmm-d62e14c530c0eaeab7436ad947b5bfcc5ed1c885.tar.gz
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).
Diffstat (limited to 'gio')
-rw-r--r--gio/src/charsetconverter.ccg30
-rw-r--r--gio/src/charsetconverter.hg55
-rw-r--r--gio/src/filelist.am2
-rw-r--r--gio/src/gio_signals.defs49
-rw-r--r--gio/src/zlibcompressor.hg1
-rw-r--r--gio/src/zlibdecompressor.ccg24
-rw-r--r--gio/src/zlibdecompressor.hg54
7 files changed, 215 insertions, 0 deletions
diff --git a/gio/src/charsetconverter.ccg b/gio/src/charsetconverter.ccg
new file mode 100644
index 00000000..967d9c3e
--- /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 00000000..331b9aa1
--- /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 04ff1dfb..0f7e3ebc 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 2929c0a0..e45df18e 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 b6fd0a03..223b6172 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 00000000..4366e58a
--- /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 00000000..7ae81669
--- /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