[glibmm] wrap Gio::IOStream



commit d9fdab38ce4e0bc6fe634ed0f10588b2f6a62c1e
Author: Jonathon Jongsma <jonathon quotidian org>
Date:   Mon May 18 22:16:24 2009 -0500

    wrap Gio::IOStream
---
 ChangeLog                               |    8 +++
 gio/src/Makefile_list_of_hg.am_fragment |    2 +-
 gio/src/iostream.ccg                    |   80 +++++++++++++++++++++++++++++++
 gio/src/iostream.hg                     |   58 ++++++++++++++++++++++
 4 files changed, 147 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7edfd84..5cc03fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-05-18  Jonathon Jongsma  <jonathon quotidian org>
 
+	Wrap the new Gio::IOStream class
+
+	* gio/src/Makefile_list_of_hg.am_fragment:
+	* gio/src/iostream.ccg: Added.
+	* gio/src/iostream.hg: Added.
+
+2009-05-18  Jonathon Jongsma  <jonathon quotidian org>
+
 	* gio/src/gio_docs_override.xml:add an override for
 	get_activation_root() since the documentation contains /* comments
 	*/ that mess up the documetation comments
diff --git a/gio/src/Makefile_list_of_hg.am_fragment b/gio/src/Makefile_list_of_hg.am_fragment
index 45b17ee..8638971 100644
--- a/gio/src/Makefile_list_of_hg.am_fragment
+++ b/gio/src/Makefile_list_of_hg.am_fragment
@@ -8,7 +8,7 @@ files_win32_hg =
 files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg emblem.hg emblemedicon.hg error.hg file.hg fileattributeinfo.hg \
 				   fileattributeinfolist.hg fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg \
 				   filemonitor.hg filterinputstream.hg filteroutputstream.hg filenamecompleter.hg \
-				   icon.hg inputstream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \
+				   icon.hg inputstream.hg iostream.hg loadableicon.hg memoryoutputstream.hg mount.hg mountoperation.hg outputstream.hg \
 				   seekable.hg volume.hg volumemonitor.hg bufferedinputstream.hg \
 				   bufferedoutputstream.hg datainputstream.hg dataoutputstream.hg enums.hg \
 				   memoryinputstream.hg themedicon.hg
diff --git a/gio/src/iostream.ccg b/gio/src/iostream.ccg
new file mode 100644
index 0000000..e86d6e7
--- /dev/null
+++ b/gio/src/iostream.ccg
@@ -0,0 +1,80 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 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/asyncresult.h>
+#include "slot_async.h"
+
+namespace Gio
+{
+
+
+
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+bool IOStream::close()
+#else
+bool IOStream::close(std::auto_ptr<Glib::Error>& error)
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+{
+  GError* gerror = 0;
+  bool retvalue = g_io_stream_close(gobj(), NULL, &(gerror));
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+#else
+  if(gerror)
+    error = ::Glib::Error::throw_exception(gerror);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+  return retvalue;
+}
+
+
+void
+IOStream::close_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority)
+{
+  // Create a copy of the slot.
+  // A pointer to it will be passed through the callback's data parameter
+  // and deleted in the callback.
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_io_stream_close_async(gobj(),
+                          io_priority,
+                          cancellable->gobj(),
+                          &SignalProxy_async_callback,
+                          slot_copy);
+}
+
+void
+IOStream::close_async(const SlotAsyncReady& slot, int io_priority)
+{
+  // Create a copy of the slot.
+  // A pointer to it will be passed through the callback's data parameter
+  // and deleted in the callback.
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_io_stream_close_async(gobj(),
+                          io_priority,
+                          NULL,
+                          &SignalProxy_async_callback,
+                          slot_copy);
+}
+
+
+} // namespace Gio
diff --git a/gio/src/iostream.hg b/gio/src/iostream.hg
new file mode 100644
index 0000000..7bef039
--- /dev/null
+++ b/gio/src/iostream.hg
@@ -0,0 +1,58 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2007 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/inputstream.h>
+#include <giomm/outputstream.h>
+#include <giomm/asyncresult.h>
+#include <giomm/cancellable.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace Gio
+{
+
+/**
+ *
+ * @ingroup Streams
+ *
+ * @newin2p22
+ */
+class IOStream : public Glib::Object
+{
+  _CLASS_GOBJECT(IOStream, GIOStream, G_IO_STREAM, Glib::Object, GObject)
+
+public:
+  _WRAP_METHOD(Glib::RefPtr<InputStream> get_input_stream(), g_io_stream_get_input_stream)
+  _WRAP_METHOD(Glib::RefPtr<OutputStream> get_output_stream(), g_io_stream_get_output_stream)
+  _WRAP_METHOD(bool close(const Glib::RefPtr<Cancellable>& cancellable), g_io_stream_close, errthrow)
+  bool close();
+  void close_async(const SlotAsyncReady&slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority=Glib::PRIORITY_DEFAULT);
+  void close_async(const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT);
+  _IGNORE(g_io_stream_close_async)
+  _WRAP_METHOD(bool close_finish(const Glib::RefPtr<AsyncResult>& result), g_io_stream_close_finish, errthrow)
+  _WRAP_METHOD(bool is_closed() const, g_io_stream_is_closed)
+  _WRAP_METHOD(bool has_pending() const, g_io_stream_has_pending)
+  _WRAP_METHOD(bool set_pending(), g_io_stream_set_pending, errthrow)
+  _WRAP_METHOD(void clear_pending(), g_io_stream_clear_pending)
+};
+
+} // namespace Gio



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