diff options
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | gio/src/converterinputstream.ccg | 25 | ||||
-rw-r--r-- | gio/src/converterinputstream.hg | 56 | ||||
-rw-r--r-- | gio/src/converteroutputstream.ccg | 25 | ||||
-rw-r--r-- | gio/src/converteroutputstream.hg | 56 | ||||
-rw-r--r-- | gio/src/filelist.am | 2 | ||||
-rw-r--r-- | gio/src/gio_signals.defs | 22 | ||||
-rw-r--r-- | tools/extra_defs_gen/generate_defs_gio.cc | 2 | ||||
-rw-r--r-- | tools/m4/convert_gio.m4 | 4 |
9 files changed, 207 insertions, 0 deletions
@@ -1,3 +1,18 @@ +2012-09-24 José Alburquerque <jaalburquerque@gmail.com> + + giomm: Add the Converter[Input|Output]Stream classes. + + * gio/src/converterinputstream.{ccg,hg}: + * gio/src/converteroutputstream.{ccg,hg}: + * gio/src/filelist.am: Add the new sources adding the constructors, + create methods, the methods and properties of the new classes. Add + the sources to the build. + * gio/src/gio_signals.defs: + * tools/extra_defs_gen/generate_defs_gio.cc: Add the two new GTypes to + the extra defs generation utility and regenerate the signal and + property defs file to get the properties of the new classes. + * tools/m4/convert_gio.m4: Add the necessary Converter conversions. + 2012-09-20 José Alburquerque <jaalburquerque@gmail.com> giomm: Add the PollableOutputStream interface. diff --git a/gio/src/converterinputstream.ccg b/gio/src/converterinputstream.ccg new file mode 100644 index 00000000..4f46d64e --- /dev/null +++ b/gio/src/converterinputstream.ccg @@ -0,0 +1,25 @@ +/* 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/converter.h> +#include <giomm/inputstream.h> + +namespace Gio +{ + +} // namespace Gio diff --git a/gio/src/converterinputstream.hg b/gio/src/converterinputstream.hg new file mode 100644 index 00000000..749e99d7 --- /dev/null +++ b/gio/src/converterinputstream.hg @@ -0,0 +1,56 @@ +/* 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 <giomm/filterinputstream.h> +#include <giomm/pollableinputstream.h> + +_DEFS(giomm,gio) +_PINCLUDE(giomm/private/filterinputstream_p.h) + +namespace Gio +{ + +class Converter; +class InputStream; + +/** ConverterInputstream - Converter Input Stream. + * Converter input stream implements InputStream and allows conversion of data + * of various types during reading. ConverterInputStream also implements the + * PollableInputStream interface. + * @newin{2,34} + */ +class ConverterInputStream : public FilterInputStream, + public PollableInputStream +{ + _CLASS_GOBJECT(ConverterInputStream, GConverterInputStream, G_CONVERTER_INPUT_STREAM, FilterInputStream, GFilterInputStream) + _IMPLEMENTS_INTERFACE(PollableInputStream) + +protected: + _WRAP_CTOR(ConverterInputStream(const Glib::RefPtr<InputStream>& base_stream, const Glib::RefPtr<Converter>& converter), g_converter_input_stream_new) + +public: + _WRAP_METHOD_DOCS_ONLY(g_converter_input_stream_new) +_WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream, const Glib::RefPtr<Converter>& converter) + + // The C function returns an unreffed private member. + _WRAP_METHOD(Glib::RefPtr<Converter> get_converter(), g_converter_input_stream_get_converter, refreturn) + _WRAP_METHOD(Glib::RefPtr<const Converter> get_converter() const, g_converter_input_stream_get_converter, constversion) + + _WRAP_PROPERTY("converter", Glib::RefPtr<Converter>) +}; + +} // namespace Gio diff --git a/gio/src/converteroutputstream.ccg b/gio/src/converteroutputstream.ccg new file mode 100644 index 00000000..b122ac38 --- /dev/null +++ b/gio/src/converteroutputstream.ccg @@ -0,0 +1,25 @@ +/* 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/converter.h> +#include <giomm/outputstream.h> + +namespace Gio +{ + +} // namespace Gio diff --git a/gio/src/converteroutputstream.hg b/gio/src/converteroutputstream.hg new file mode 100644 index 00000000..0775e8ed --- /dev/null +++ b/gio/src/converteroutputstream.hg @@ -0,0 +1,56 @@ +/* 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 <giomm/filteroutputstream.h> +#include <giomm/pollableoutputstream.h> + +_DEFS(giomm,gio) +_PINCLUDE(giomm/private/filteroutputstream_p.h) + +namespace Gio +{ + +class Converter; +class OutputStream; + +/** ConverterOutputstream - Converter Output Stream. + * Converter output stream implements OutputStream and allows conversion of + * data of various types during reading. ConverterOutputStream also implements + * the PollableOutputStream interface. + * @newin{2,34} + */ +class ConverterOutputStream : public FilterOutputStream, + public PollableOutputStream +{ + _CLASS_GOBJECT(ConverterOutputStream, GConverterOutputStream, G_CONVERTER_OUTPUT_STREAM, FilterOutputStream, GFilterOutputStream) + _IMPLEMENTS_INTERFACE(PollableOutputStream) + +protected: +_WRAP_CTOR(ConverterOutputStream(const Glib::RefPtr<OutputStream>& base_stream, const Glib::RefPtr<Converter>& converter), g_converter_output_stream_new) + +public: + _WRAP_METHOD_DOCS_ONLY(g_converter_output_stream_new) +_WRAP_CREATE(const Glib::RefPtr<OutputStream>& base_stream, const Glib::RefPtr<Converter>& converter) + + // The C function returns an unreffed private member. + _WRAP_METHOD(Glib::RefPtr<Converter> get_converter(), g_converter_output_stream_get_converter, refreturn) + _WRAP_METHOD(Glib::RefPtr<const Converter> get_converter() const, g_converter_output_stream_get_converter, constversion) + + _WRAP_PROPERTY("converter", Glib::RefPtr<Converter>) +}; + +} // namespace Gio diff --git a/gio/src/filelist.am b/gio/src/filelist.am index 6b87306f..db061b15 100644 --- a/gio/src/filelist.am +++ b/gio/src/filelist.am @@ -27,6 +27,8 @@ giomm_files_any_hg = \ cancellable.hg \ charsetconverter.hg \ converter.hg \ + converterinputstream.hg \ + converteroutputstream.hg \ credentials.hg \ datainputstream.hg \ dataoutputstream.hg \ diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index e45df18e..097b027a 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -249,6 +249,28 @@ (construct-only #f) ) +;; From GConverterInputStream + +(define-property converter + (of-object "GConverterInputStream") + (prop-type "GParamObject") + (docs "The converter object") + (readable #t) + (writable #t) + (construct-only #t) +) + +;; From GConverterOutputStream + +(define-property converter + (of-object "GConverterOutputStream") + (prop-type "GParamObject") + (docs "The converter object") + (readable #t) + (writable #t) + (construct-only #t) +) + ;; From GDataInputStream (define-property byte-order diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc index 17556f4e..e56622af 100644 --- a/tools/extra_defs_gen/generate_defs_gio.cc +++ b/tools/extra_defs_gen/generate_defs_gio.cc @@ -45,6 +45,8 @@ int main(int, char**) << get_defs(G_TYPE_BUFFERED_INPUT_STREAM) << get_defs(G_TYPE_BUFFERED_OUTPUT_STREAM) << get_defs(G_TYPE_CHARSET_CONVERTER) + << get_defs(G_TYPE_CONVERTER_INPUT_STREAM) + << get_defs(G_TYPE_CONVERTER_OUTPUT_STREAM) << get_defs(G_TYPE_DATA_INPUT_STREAM) << get_defs(G_TYPE_DATA_OUTPUT_STREAM) << get_defs(G_TYPE_DRIVE) diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4 index 28ff537c..fc6a98fa 100644 --- a/tools/m4/convert_gio.m4 +++ b/tools/m4/convert_gio.m4 @@ -75,6 +75,10 @@ _CONVERSION(`const Glib::RefPtr<Gio::Cancellable>&',`GCancellable*',__CONVERT_CO _CONVERSION(`GCancellable*', `Glib::RefPtr<Cancellable>', `Glib::wrap($3)') _CONVERSION(`GCancellable*', `const Glib::RefPtr<Cancellable>&', `Glib::wrap($3)') +# Converter +_CONVERSION(`const Glib::RefPtr<Converter>&',`GConverter*',`Glib::unwrap($3)') +_CONVERSION(`GConverter*',`Glib::RefPtr<Converter>',`Glib::wrap($3)') + # Credentials _CONVERSION(`const Glib::RefPtr<Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials)) _CONVERSION(`const Glib::RefPtr<const Credentials>&',`GCredentials*',__CONVERT_CONST_REFPTR_TO_P_SUN(Gio::Credentials)) |