[glibmm] giomm: Add the PollableOutputStream interface.



commit e7913200f48195737cc4c5750e3a86ff13d7a624
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Thu Sep 20 18:24:00 2012 -0400

    giomm: Add the PollableOutputStream interface.
    
    	* gio/src/pollableoutputstream.{ccg,hg}:
    	* gio/src/filelist.am: Add the sources adding the new interface
    	methods and virtual functions and include the sources in the build.
    	* gio/src/gio_extra_objects.defs: Add the new object in this file to
    	avoid a gmmproc documentation warning.
    	* gio/src/gio_vfuncs.defs: Add the new interface virtual functions.

 ChangeLog                        |   11 +++++++
 gio/src/filelist.am              |    1 +
 gio/src/gio_extra_objects.defs   |    6 ++++
 gio/src/gio_vfuncs.defs          |   30 ++++++++++++++++++
 gio/src/pollableoutputstream.ccg |   26 ++++++++++++++++
 gio/src/pollableoutputstream.hg  |   62 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 136 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 150113a..b628c5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2012-09-20  Josà Alburquerque  <jaalburquerque gmail com>
 
+	giomm: Add the PollableOutputStream interface.
+
+	* gio/src/pollableoutputstream.{ccg,hg}:
+	* gio/src/filelist.am: Add the sources adding the new interface
+	methods and virtual functions and include the sources in the build.
+	* gio/src/gio_extra_objects.defs: Add the new object in this file to
+	avoid a gmmproc documentation warning.
+	* gio/src/gio_vfuncs.defs: Add the new interface virtual functions.
+
+2012-09-20  Josà Alburquerque  <jaalburquerque gmail com>
+
 	giomm: Add the PollableInputStream interface.
 
 	* gio/src/pollableinputstream.{ccg,hg}:
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 3832bd8..6b87306 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -87,6 +87,7 @@ giomm_files_any_hg =			\
 	networkservice.hg		\
 	outputstream.hg			\
 	pollableinputstream.hg		\
+	pollableoutputstream.hg		\
 	proxy.hg 			\
 	proxyaddress.hg 		\
 	proxyresolver.hg 		\
diff --git a/gio/src/gio_extra_objects.defs b/gio/src/gio_extra_objects.defs
index 4b7822f..4be8ea2 100644
--- a/gio/src/gio_extra_objects.defs
+++ b/gio/src/gio_extra_objects.defs
@@ -151,6 +151,12 @@
   (gtype-id "G_TYPE_POLLABLE_INPUT_STREAM")
 )
 
+(define-object PollableOutputStream
+  (in-module "Gio")
+  (c-name "GPollableOutputStream")
+  (gtype-id "G_TYPE_POLLABLE_OUTPUT_STREAM")
+)
+
 (define-object Proxy
   (in-module "Gio")
   (c-name "GProxy")
diff --git a/gio/src/gio_vfuncs.defs b/gio/src/gio_vfuncs.defs
index c4b9918..31acf6f 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -637,6 +637,36 @@
   )
 )
 
+; GPollableOutputStream
+
+(define-vfunc can_poll
+  (of-object "GPollableOutputStream")
+  (return-type "gboolean")
+)
+
+(define-vfunc is_writable
+  (of-object "GPollableOutputStream")
+  (return-type "gboolean")
+)
+
+(define-vfunc create_source
+  (of-object "GPollableOutputStream")
+  (return-type "GSource*")
+  (parameters
+   '("GCancellable*" "cancellable")
+  )
+)
+
+(define-vfunc write_nonblocking
+  (of-object "GPollableOutputStream")
+  (return-type "gssize")
+  (parameters
+   '("const-void*" "buffer")
+   '("gsize" "count")
+   '("GError**" "error")
+  )
+)
+
 ; GRemoteActionGroup
 
 (define-vfunc activate_action_full
diff --git a/gio/src/pollableoutputstream.ccg b/gio/src/pollableoutputstream.ccg
new file mode 100644
index 0000000..8e0aacb
--- /dev/null
+++ b/gio/src/pollableoutputstream.ccg
@@ -0,0 +1,26 @@
+// -*- 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>
+#include <giomm/cancellable.h>
+
+namespace Gio
+{
+
+} // namespace Gio
diff --git a/gio/src/pollableoutputstream.hg b/gio/src/pollableoutputstream.hg
new file mode 100644
index 0000000..79c5cfe
--- /dev/null
+++ b/gio/src/pollableoutputstream.hg
@@ -0,0 +1,62 @@
+// -*- 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 _GPollableOutputStreamInterface GPollableOutputStreamInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+class Cancellable;
+
+/** PollableOutputStream - Interface for pollable output streams.
+ * PollableOutputStream is implemented by OutputStreams that can be polled for
+ * readiness to write. This can be used when interfacing with a non-GIO API
+ * that expects UNIX-file-descriptor-style asynchronous I/O rather than
+ * GIO-style.
+ * @newin{2,34}
+ */
+class PollableOutputStream : public Glib::Interface
+{
+  _CLASS_INTERFACE(PollableOutputStream, GPollableOutputStream, G_POLLABLE_OUTPUT_STREAM, GPollableOutputStreamInterface)
+
+public:
+  _WRAP_METHOD(bool can_poll() const, g_pollable_output_stream_can_poll)
+  _WRAP_METHOD(bool is_writable() const, g_pollable_output_stream_is_writable)
+
+  //TODO: _WRAP_METHOD(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), g_pollable_output_stream_create_source)
+
+  _WRAP_METHOD(gssize write_nonblocking(const void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}), g_pollable_output_stream_write_nonblocking, errthrow)
+
+  _WRAP_VFUNC(bool can_poll() const, "can_poll")
+  _WRAP_VFUNC(bool is_writable() const, "is_writable")
+
+  //TODO:_WRAP_VFUNC(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), "create_source")
+
+  _WRAP_VFUNC(gssize write_nonblocking(const void* buffer, gsize count), "write_nonblocking", errthrow)
+};
+
+} // namespace Gio



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