[glibmm] giomm: Add the PollableInputStream interface.
- From: Josà Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] giomm: Add the PollableInputStream interface.
- Date: Thu, 20 Sep 2012 22:28:53 +0000 (UTC)
commit d6e8b1013e2184990c4502e4eaac009edf248c57
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date: Thu Sep 20 17:45:09 2012 -0400
giomm: Add the PollableInputStream interface.
* gio/src/pollableinputstream.{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: Mention the new object in this file
to avoid the gmmproc documentation warnings.
* gio/src/gio_vfuncs.defs: Add the new interface virtual functions but
alphabetize the existing entries by class name.
ChangeLog | 12 ++
gio/src/filelist.am | 1 +
gio/src/gio_extra_objects.defs | 6 +
gio/src/gio_vfuncs.defs | 296 +++++++++++++++++++++------------------
gio/src/pollableinputstream.ccg | 26 ++++
gio/src/pollableinputstream.hg | 61 ++++++++
6 files changed, 269 insertions(+), 133 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 712fb61..150113a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-20 Josà Alburquerque <jaalburquerque gmail com>
+
+ giomm: Add the PollableInputStream interface.
+
+ * gio/src/pollableinputstream.{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: Mention the new object in this file
+ to avoid the gmmproc documentation warnings.
+ * gio/src/gio_vfuncs.defs: Add the new interface virtual functions but
+ alphabetize the existing entries by class name.
+
2012-09-19 Josà Alburquerque <jaalburquerque gmail com>
_WRAP_VFUNC: Prepend @throws clause to vfuncs that throw errors.
diff --git a/gio/src/filelist.am b/gio/src/filelist.am
index 0f7e3eb..3832bd8 100644
--- a/gio/src/filelist.am
+++ b/gio/src/filelist.am
@@ -86,6 +86,7 @@ giomm_files_any_hg = \
networkaddress.hg \
networkservice.hg \
outputstream.hg \
+ pollableinputstream.hg \
proxy.hg \
proxyaddress.hg \
proxyresolver.hg \
diff --git a/gio/src/gio_extra_objects.defs b/gio/src/gio_extra_objects.defs
index 5e4dd2b..4b7822f 100644
--- a/gio/src/gio_extra_objects.defs
+++ b/gio/src/gio_extra_objects.defs
@@ -145,6 +145,12 @@
(gtype-id "G_TYPE_MENU_ITEM")
)
+(define-object PollableInputStream
+ (in-module "Gio")
+ (c-name "GPollableInputStream")
+ (gtype-id "G_TYPE_POLLABLE_INPUT_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 28c5bea..c4b9918 100644
--- a/gio/src/gio_vfuncs.defs
+++ b/gio/src/gio_vfuncs.defs
@@ -150,6 +150,122 @@
)
)
+; GAppInfo
+
+(define-vfunc dup
+ (of-object "GAppInfo")
+ (return-type "GAppInfo*")
+)
+
+(define-vfunc equal
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GAppInfo*" "appinfo2")
+ )
+)
+
+(define-vfunc get_id
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_name
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_description
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_executable
+ (of-object "GAppInfo")
+ (return-type "const-char*")
+)
+
+(define-vfunc get_icon
+ (of-object "GAppInfo")
+ (return-type "GIcon*")
+)
+
+(define-vfunc launch
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "filenames")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc supports_uris
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc supports_files
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc launch_uris
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("GList*" "uris")
+ '("GAppLaunchContext*" "launch_context")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc should_show
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc set_as_default_for_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc set_as_default_for_extension
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "extension")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc add_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc can_remove_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+)
+
+(define-vfunc remove_supports_type
+ (of-object "GAppInfo")
+ (return-type "gboolean")
+ (parameters
+ '("const-char*" "content_type")
+ '("GError**" "error")
+ )
+)
+
; GApplication
(define-vfunc local_command_line
@@ -229,6 +345,39 @@
(return-type "GObject*")
)
+; GBufferedInputStream
+
+(define-vfunc fill
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+ '("gssize" "count")
+ '("GCancellable*" "cancellable")
+ '("GError**" "error")
+ )
+)
+
+(define-vfunc fill_async
+ (of-object "GBufferedInputStream")
+ (return-type "void")
+ (parameters
+ '("gssize" "count")
+ '("int" "io_priority")
+ '("GCancellable*" "cancellable")
+ '("GAsyncReadyCallback" "callback")
+ '("gpointer" "user_data")
+ )
+)
+
+(define-vfunc fill_finish
+ (of-object "GBufferedInputStream")
+ (return-type "gssize")
+ (parameters
+ '("GAsyncResult*" "result")
+ '("GError**" "error")
+ )
+)
+
; GConverter
(define-vfunc convert
@@ -458,155 +607,36 @@
)
)
-; GAppInfo
-
-(define-vfunc dup
- (of-object "GAppInfo")
- (return-type "GAppInfo*")
-)
-
-(define-vfunc equal
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("GAppInfo*" "appinfo2")
- )
-)
-
-(define-vfunc get_id
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_name
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_description
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
+; GPollableInputStream
-(define-vfunc get_executable
- (of-object "GAppInfo")
- (return-type "const-char*")
-)
-
-(define-vfunc get_icon
- (of-object "GAppInfo")
- (return-type "GIcon*")
-)
-
-(define-vfunc launch
- (of-object "GAppInfo")
+(define-vfunc can_poll
+ (of-object "GPollableInputStream")
(return-type "gboolean")
- (parameters
- '("GList*" "filenames")
- '("GAppLaunchContext*" "launch_context")
- '("GError**" "error")
- )
)
-(define-vfunc supports_uris
- (of-object "GAppInfo")
+(define-vfunc is_readable
+ (of-object "GPollableInputStream")
(return-type "gboolean")
)
-(define-vfunc supports_files
- (of-object "GAppInfo")
- (return-type "gboolean")
-)
-
-(define-vfunc launch_uris
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("GList*" "uris")
- '("GAppLaunchContext*" "launch_context")
- '("GError**" "error")
- )
-)
-
-(define-vfunc should_show
- (of-object "GAppInfo")
- (return-type "gboolean")
-)
-
-(define-vfunc set_as_default_for_type
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("const-char*" "content_type")
- '("GError**" "error")
- )
-)
-
-(define-vfunc set_as_default_for_extension
- (of-object "GAppInfo")
- (return-type "gboolean")
+(define-vfunc create_source
+ (of-object "GPollableInputStream")
+ (return-type "GSource*")
(parameters
- '("const-char*" "extension")
- '("GError**" "error")
- )
-)
-
-(define-vfunc add_supports_type
- (of-object "GAppInfo")
- (return-type "gboolean")
- (parameters
- '("const-char*" "content_type")
- '("GError**" "error")
+ '("GCancellable*" "cancellable")
)
)
-(define-vfunc can_remove_supports_type
- (of-object "GAppInfo")
- (return-type "gboolean")
-)
-
-(define-vfunc remove_supports_type
- (of-object "GAppInfo")
- (return-type "gboolean")
+(define-vfunc read_nonblocking
+ (of-object "GPollableInputStream")
+ (return-type "gssize")
(parameters
- '("const-char*" "content_type")
+ '("void*" "buffer")
+ '("gsize" "count")
'("GError**" "error")
)
)
-; GBufferedInputStream
-
-(define-vfunc fill
- (of-object "GBufferedInputStream")
- (return-type "gssize")
- (parameters
- '("gssize" "count")
- '("GCancellable*" "cancellable")
- '("GError**" "error")
- )
-)
-
-(define-vfunc fill_async
- (of-object "GBufferedInputStream")
- (return-type "void")
- (parameters
- '("gssize" "count")
- '("int" "io_priority")
- '("GCancellable*" "cancellable")
- '("GAsyncReadyCallback" "callback")
- '("gpointer" "user_data")
- )
-)
-
-(define-vfunc fill_finish
- (of-object "GBufferedInputStream")
- (return-type "gssize")
- (parameters
- '("GAsyncResult*" "result")
- '("GError**" "error")
- )
-)
-
; GRemoteActionGroup
(define-vfunc activate_action_full
diff --git a/gio/src/pollableinputstream.ccg b/gio/src/pollableinputstream.ccg
new file mode 100644
index 0000000..8e0aacb
--- /dev/null
+++ b/gio/src/pollableinputstream.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/pollableinputstream.hg b/gio/src/pollableinputstream.hg
new file mode 100644
index 0000000..cda87bd
--- /dev/null
+++ b/gio/src/pollableinputstream.hg
@@ -0,0 +1,61 @@
+// -*- 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 _GPollableInputStreamInterface GPollableInputStreamInterface;
+#endif /* DOXYGEN_SHOULD_SKIP_THIS */
+
+namespace Gio
+{
+
+class Cancellable;
+
+/** PollableInputStream - Interface for pollable input streams.
+ * PollableInputStream is implemented by InputStreams that can be polled for
+ * readiness to read. 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 PollableInputStream : public Glib::Interface
+{
+ _CLASS_INTERFACE(PollableInputStream, GPollableInputStream, G_POLLABLE_INPUT_STREAM, GPollableInputStreamInterface)
+
+public:
+ _WRAP_METHOD(bool can_poll() const, g_pollable_input_stream_can_poll)
+ _WRAP_METHOD(bool is_readable() const, g_pollable_input_stream_is_readable)
+
+ //TODO: _WRAP_METHOD(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), g_pollable_input_stream_create_source)
+
+ _WRAP_METHOD(gssize read_nonblocking(void* buffer, gsize count, const Glib::RefPtr<Cancellable>& cancellable{?}), g_pollable_input_stream_read_nonblocking, errthrow)
+
+ _WRAP_VFUNC(bool can_poll() const, "can_poll")
+ _WRAP_VFUNC(bool is_readable() const, "is_readable")
+
+ //TODO: _WRAP_VFUNC(Glib::RefPtr<Source> create_source(const Glib::RefPtr<Cancellable>& cancellable), "create_source")
+
+ _WRAP_VFUNC(gssize read_nonblocking(void* buffer, gsize count), "read_nonblocking", errthrow)
+};
+
+} // namespace Gio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]