diff options
author | Murray Cumming <murrayc@murrayc.com> | 2012-07-10 11:08:22 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2012-07-10 11:08:22 +0200 |
commit | 2d760935013ed77eec2b225643536af0d37d175e (patch) | |
tree | a9f4e32985cf465787ceaf7bedae195a9254dfc1 /gio/src/inputstream.ccg | |
parent | 746d38bc4c38ec27127afca017728e2782399530 (diff) | |
download | glibmm-2d760935013ed77eec2b225643536af0d37d175e.tar.gz |
Added Glib::Bytes and Gio::InputStream::read_bytes().
* glib/src/bytes.[hg|ccg]:
* glib/src/filelist.am:
* tools/m4/convert_glib.m4: Added a simple GBytes wrapper.
* gio/src/inputstream.[hg|ccg]: Added read_bytes(), read_bytes_async()
and read_bytes_finish() using the new Glib::Bytes type.
Diffstat (limited to 'gio/src/inputstream.ccg')
-rw-r--r-- | gio/src/inputstream.ccg | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gio/src/inputstream.ccg b/gio/src/inputstream.ccg index 8cdd3ff8..b2eb22da 100644 --- a/gio/src/inputstream.ccg +++ b/gio/src/inputstream.ccg @@ -100,6 +100,38 @@ InputStream::read_async(void* buffer, gsize count, const SlotAsyncReady& slot, i slot_copy); } +void +InputStream::read_bytes_async(gsize count, 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_input_stream_read_bytes_async(gobj(), + count, + io_priority, + Glib::unwrap(cancellable), + &SignalProxy_async_callback, + slot_copy); +} + +void +InputStream::read_bytes_async(gsize count, 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_input_stream_read_bytes_async(gobj(), + count, + io_priority, + 0, + &SignalProxy_async_callback, + slot_copy); +} + void InputStream::skip_async(gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority) |