summaryrefslogtreecommitdiff
path: root/gio/src/bufferedinputstream.hg
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@src.gnome.org>2008-02-02 17:41:05 +0000
committerJonathon Jongsma <jjongsma@src.gnome.org>2008-02-02 17:41:05 +0000
commit88553b487c01ff7bb1645793361890f29b6db7d6 (patch)
tree6974a6f808f8665c5d5a42455d40796c903aaa9c /gio/src/bufferedinputstream.hg
parent426f4be640703e9830d9790c228efe6b4eb5a049 (diff)
downloadglibmm-88553b487c01ff7bb1645793361890f29b6db7d6.tar.gz
add BufferedInputStream class
* gio/src/gio_vfuncs.defs: * gio/src/Makefile_list_of_hg.am_fragment: * gio/src/bufferedinputstream.ccg: * gio/src/bufferedinputstream.hg: add BufferedInputStream class * gio/giomm/slot_async.cc: * gio/giomm/slot_async.h: split out the SlotProxy_async_callback so it doesn't have to be implemented in every file * gio/src/drive.ccg: * gio/src/file.ccg: * gio/src/file.hg: * gio/src/fileenumerator.ccg: * gio/src/fileinputstream.ccg: * gio/src/fileoutputstream.ccg: * gio/src/inputstream.ccg: * gio/src/mount.ccg: * gio/src/outputstream.ccg: * gio/src/volume.ccg: use the common SlotProxy_async_callback function in all of these files * tools/m4/convert_gio.m4: add conversion for Cancellable * gio/giomm/Makefile.am: indenting changes svn path=/trunk/; revision=560
Diffstat (limited to 'gio/src/bufferedinputstream.hg')
-rw-r--r--gio/src/bufferedinputstream.hg90
1 files changed, 90 insertions, 0 deletions
diff --git a/gio/src/bufferedinputstream.hg b/gio/src/bufferedinputstream.hg
new file mode 100644
index 00000000..08749669
--- /dev/null
+++ b/gio/src/bufferedinputstream.hg
@@ -0,0 +1,90 @@
+// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+
+/* Copyright (C) 2008 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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 <glibmm/object.h>
+
+_DEFS(giomm,gio)
+_PINCLUDE(giomm/private/filterinputstream_p.h)
+
+namespace Gio
+{
+
+class BufferedInputStream : public Gio::FilterInputStream
+{
+ _CLASS_GOBJECT(BufferedInputStream, GBufferedInputStream, G_BUFFERED_INPUT_STREAM, Gio::FilterInputStream, GFilterInputStream)
+protected:
+ _WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream), g_buffered_input_stream_new)
+ _WRAP_CTOR(BufferedInputStream(const Glib::RefPtr<InputStream>& base_stream, gsize size), g_buffered_input_stream_new_sized)
+public:
+ _WRAP_CREATE(const Glib::RefPtr<InputStream>& base_stream)
+ static Glib::RefPtr<BufferedInputStream> create_sized(const Glib::RefPtr<InputStream>& base_stream, gsize size);
+
+ _WRAP_METHOD(gsize get_buffer_size() const, g_buffered_input_stream_get_buffer_size)
+ _WRAP_METHOD(void set_buffer_size(gsize size), g_buffered_input_stream_set_buffer_size)
+ _WRAP_METHOD(gsize get_available() const, g_buffered_input_stream_get_available)
+ _WRAP_METHOD(gsize peek(void* buffer, gsize offset, gsize count) const, g_buffered_input_stream_peek)
+ _WRAP_METHOD(const void* peek_buffer(gsize& count) const, g_buffered_input_stream_peek_buffer)
+ _WRAP_METHOD(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_fill, errthrow)
+ /** non-cancellable version of fill()
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ gssize fill(gssize count);
+#else
+ gssize fill(gssize count, std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+/**
+ * Reads data into @stream's buffer asynchronously, up to @count size.
+ * @io_priority can be used to prioritize reads. For the synchronous version of
+ * this function, see fill().
+ *
+ * @param slot A #GAsyncReadyCallback.
+ * @param count: the number of bytes to read
+ * @param io_priority the I/O priority of the request.
+ * @param cancellable Cancellable object
+ **/
+ void fill_async(const SlotAsyncReady& slot,
+ gssize count,
+ const Glib::RefPtr<Cancellable>& cancellable,
+ int io_priority=G_PRIORITY_DEFAULT);
+
+ /** non-cancellable version of fill_async()
+ */
+ void fill_async(const SlotAsyncReady& slot,
+ gssize count,
+ int io_priority=G_PRIORITY_DEFAULT);
+
+ _WRAP_METHOD(gssize fill_finish(const Glib::RefPtr<AsyncResult>& result), g_buffered_input_stream_fill_finish, errthrow)
+
+ _WRAP_METHOD(int read_byte(const Glib::RefPtr<Cancellable>& cancellable), g_buffered_input_stream_read_byte, errthrow)
+ /** non-cancellable version of read_byte
+ */
+#ifdef GLIBMM_EXCEPTIONS_ENABLED
+ int read_byte();
+#else
+ int read_byte(std::auto_ptr<Glib::Error>& error);
+#endif //GLIBMM_EXCEPTIONS_ENABLED
+
+ protected:
+ _WRAP_VFUNC(gssize fill(gssize count, const Glib::RefPtr<Cancellable>& cancellable, GError** error), "fill")
+ // TODO: wrap async vfuncs
+};
+
+} // namespace Gio