[glibmm] Add Gio::SimpleIOStream



commit c4da3d8666ffaf048581f20ef92a501999841ed2
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Fri Apr 10 19:01:22 2015 +0200

    Add Gio::SimpleIOStream
    
    * gio/giomm.h: Add simpleiostream.h.
    * gio/src/filelist.am: Add simpleiostream.hg.
    * gio/src/gio_signals.defs: Regenerated.
    * tools/extra_defs_gen/generate_defs_gio.cc: Add G_TYPE_SIMPLE_IO_STREAM.
    * gio/src/simpleiostream.[hg|ccg]: New files.

 gio/giomm.h                               |    1 +
 gio/src/filelist.am                       |    1 +
 gio/src/gio_signals.defs                  |   20 ++++++++
 gio/src/simpleiostream.ccg                |   17 +++++++
 gio/src/simpleiostream.hg                 |   75 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gio.cc |    1 +
 6 files changed, 115 insertions(+), 0 deletions(-)
---
diff --git a/gio/giomm.h b/gio/giomm.h
index b6d07b0..e778d36 100644
--- a/gio/giomm.h
+++ b/gio/giomm.h
@@ -116,6 +116,7 @@
 #include <giomm/settings.h>
 #include <giomm/simpleaction.h>
 #include <giomm/simpleactiongroup.h>
+#include <giomm/simpleiostream.h>
 #include <giomm/simplepermission.h>
 #include <giomm/socket.h>
 #include <giomm/socketaddress.h>
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index f2a18bb..71e4fe0 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -103,6 +103,7 @@ giomm_files_any_hg =                        \
        settings.hg                     \
        simpleaction.hg                 \
        simpleactiongroup.hg            \
+       simpleiostream.hg               \
        simplepermission.hg             \
        socket.hg                       \
        socketaddress.hg                \
diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs
index 71d966a..289e676 100644
--- a/gio/src/gio_signals.defs
+++ b/gio/src/gio_signals.defs
@@ -1160,6 +1160,26 @@
   (construct-only #f)
 )
 
+;; From GSimpleIOStream
+
+(define-property input-stream
+  (of-object "GSimpleIOStream")
+  (prop-type "GParamObject")
+  (docs "The GInputStream to read from")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
+(define-property output-stream
+  (of-object "GSimpleIOStream")
+  (prop-type "GParamObject")
+  (docs "The GOutputStream to write to")
+  (readable #t)
+  (writable #t)
+  (construct-only #t)
+)
+
 ;; From GSubprocess
 
 (define-property flags
diff --git a/gio/src/simpleiostream.ccg b/gio/src/simpleiostream.ccg
new file mode 100644
index 0000000..528d468
--- /dev/null
+++ b/gio/src/simpleiostream.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2015 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gio/gio.h>
diff --git a/gio/src/simpleiostream.hg b/gio/src/simpleiostream.hg
new file mode 100644
index 0000000..a556fbb
--- /dev/null
+++ b/gio/src/simpleiostream.hg
@@ -0,0 +1,75 @@
+/* Copyright (C) 2015 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <giomm/iostream.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/iostream_p.h)
+
+namespace Gio
+{
+/** A wrapper around an input and an output stream.
+ *
+ * SimpleIOStream creates an IOStream from an arbitrary InputStream and
+ * OutputStream. This allows any pair of input and output streams to be used
+ * with IOStream methods.
+ *
+ * This is useful when you obtained an InputStream and an OutputStream
+ * by other means, for instance creating them with platform specific methods
+ * such as Gio::UnixInputStream::create(), and you want
+ * to take advantage of the methods provided by IOStream.
+ *
+ * @ingroup Streams
+ *
+ * @newin{2,46}
+ */
+class SimpleIOStream : public Gio::IOStream
+{
+  _CLASS_GOBJECT(SimpleIOStream, GSimpleIOStream, G_SIMPLE_IO_STREAM, Gio::IOStream, GIOStream)
+
+protected:
+  /** Creates a new SimpleIOStream wrapping @a input_stream and @a output_stream.
+   *
+   * @see IOStream
+   *
+   * @newin{2,46}
+   *
+   * @param input_stream An InputStream.
+   * @param output_stream An OutputStream.
+   * @returns A new SimpleIOStream instance.
+        */
+  _WRAP_CTOR(SimpleIOStream(const Glib::RefPtr<InputStream>& input_stream, const Glib::RefPtr<OutputStream>& 
output_stream), g_simple_io_stream_new)
+
+public:
+  /** Creates a new SimpleIOStream wrapping @a input_stream and @a output_stream.
+   *
+   * @see IOStream
+   *
+   * @newin{2,46}
+   *
+   * @param input_stream An InputStream.
+   * @param output_stream An OutputStream.
+   * @returns A new SimpleIOStream instance.
+        */
+  _WRAP_CREATE(const Glib::RefPtr<InputStream>& input_stream, const Glib::RefPtr<OutputStream>& 
output_stream)
+
+  _WRAP_PROPERTY("input-stream", Glib::RefPtr<InputStream>)
+  _WRAP_PROPERTY("output-stream", Glib::RefPtr<OutputStream>)
+
+  // SimpleIOStream has no methods other than create(), signals nor vfuncs.
+};
+
+} // namespace Gio
diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc
index cec799a..373e3de 100644
--- a/tools/extra_defs_gen/generate_defs_gio.cc
+++ b/tools/extra_defs_gen/generate_defs_gio.cc
@@ -93,6 +93,7 @@ int main(int, char**)
             << get_defs(G_TYPE_SETTINGS_BACKEND)
             << get_defs(G_TYPE_SIMPLE_ASYNC_RESULT)
             << get_defs(G_TYPE_SIMPLE_ACTION)
+            << get_defs(G_TYPE_SIMPLE_IO_STREAM)
             << get_defs(G_TYPE_SUBPROCESS)
             << get_defs(G_TYPE_SUBPROCESS_LAUNCHER)
             << get_defs(G_TYPE_THEMED_ICON)


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