diff options
author | Marcin Kolny <marcin.kolny@gmail.com> | 2015-08-08 14:45:12 +0200 |
---|---|---|
committer | Marcin Kolny <marcin.kolny@gmail.com> | 2015-08-08 14:45:59 +0200 |
commit | 0d5f63b18f5766760cf39e82ee11482984e0a938 (patch) | |
tree | e3f74b9b37e7618c92840024077dff43e6d08f0d /gio/src/outputstream.hg | |
parent | dce7a844e48a582e42eb2b60eef5c1f2527540ac (diff) | |
parent | d94115843f38967b5e883f5f7d8057882ae364cb (diff) | |
download | glibmm-0d5f63b18f5766760cf39e82ee11482984e0a938.tar.gz |
Merge branch 'master' into glibmm-gir-gmmprocglibmm-gir-gmmproc
Diffstat (limited to 'gio/src/outputstream.hg')
-rw-r--r-- | gio/src/outputstream.hg | 99 |
1 files changed, 96 insertions, 3 deletions
diff --git a/gio/src/outputstream.hg b/gio/src/outputstream.hg index d13992f6..afbf1e8b 100644 --- a/gio/src/outputstream.hg +++ b/gio/src/outputstream.hg @@ -1,5 +1,3 @@ -// -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 2 -*- - /* Copyright (C) 2007 The gtkmm Development Team * * This library is free software; you can redistribute it and/or @@ -39,7 +37,6 @@ _WRAP_ENUM(OutputStreamSpliceFlags, GOutputStreamSpliceFlags, NO_GTYPE) class OutputStream : public Glib::Object { _CLASS_GOBJECT(OutputStream, GOutputStream, G_OUTPUT_STREAM, Glib::Object, GObject) - _IGNORE(g_output_stream_async_write_is_via_threads) dnl// private method public: @@ -256,6 +253,11 @@ public: * For the synchronous, blocking version of this function, see * write(). * + * Note that no copy of @a buffer will be made, so it must stay valid + * until @a slot is called. See write_bytes_async() + * for a Glib::Bytes version that will automatically hold a reference to + * the contents (without copying) for the duration of the call. + * * @param buffer The buffer containing the data to write. * @param count The number of bytes to write * @param slot Callback slot to call when the request is satisfied. @@ -290,6 +292,11 @@ public: * * For the synchronous, blocking version of this function, see * write(). + + * Note that no copy of @a buffer will be made, so it must stay valid + * until @a slot is called. See write_bytes_async() + * for a Glib::Bytes version that will automatically hold a reference to + * the contents (without copying) for the duration of the call. * * @param buffer The buffer containing the data to write. * @param count The number of bytes to write @@ -303,6 +310,92 @@ public: g_output_stream_write_finish, errthrow) + + /** Request an asynchronous write of @a count bytes from @a buffer into + * the stream. When the operation is finished @a slot will be called. + * You can then call write_all_finish() to get the result of the + * operation. + * + * This is the asynchronous version of write_all(). + * + * During an async request no other sync and async calls are allowed, + * and will result in Gio::Error with PENDING being thrown. + * + * A value of @a count larger than MAXSSIZE will cause a Gio::Error with + * INVALID_ARGUMENT to be thrown. + * + * On success, the number of bytes written will be passed to the + * callback @a slot. It is not an error if this is not the same as the + * requested size, as it can happen e.g. on a partial I/O error, + * but generally we try to write as many bytes as requested. + * + * Any outstanding I/O request with higher priority (lower numerical + * value) will be executed before an outstanding request with lower + * priority. Default priority is Glib::PRIORITY_DEFAULT. + * + * The asyncronous methods have a default fallback that uses threads + * to implement asynchronicity, so they are optional for inheriting + * classes. However, if you override one you must override all. + * + * For the synchronous, blocking version of this function, see + * write(). + * + * Note that no copy of @a buffer will be made, so it must stay valid + * until @a slot is called. + * + * @param buffer The buffer containing the data to write. + * @param count The number of bytes to write + * @param slot Callback slot to call when the request is satisfied. + * @param cancellable Cancellable object. + * @param io_priority The io priority of the request. + */ + void write_all_async(const void* buffer, gsize count, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT); + + /** Request an asynchronous write of @a count bytes from @a buffer into + * the stream. When the operation is finished @a slot will be called. + * You can then call write_finish() to get the result of the + * operation. + * + * This is the asynchronous version of write_all(). + * + * During an async request no other sync and async calls are allowed, + * and will result in Gio::Error with PENDING being thrown. + * + * A value of @a count larger than MAXSSIZE will cause a Gio::Error with + * INVALID_ARGUMENT to be thrown. + * + * On success, the number of bytes written will be passed to the + * callback @a slot. It is not an error if this is not the same as the + * requested size, as it can happen e.g. on a partial I/O error, + * but generally we try to write as many bytes as requested. + * + * Any outstanding I/O request with higher priority (lower numerical + * value) will be executed before an outstanding request with lower + * priority. Default priority is Glib::PRIORITY_DEFAULT. + * + * The asyncronous methods have a default fallback that uses threads + * to implement asynchronicity, so they are optional for inheriting + * classes. However, if you override one you must override all. + * + * For the synchronous, blocking version of this function, see + * write(). + * + * Note that no copy of @a buffer will be made, so it must stay valid + * until @a slot is called. + * + * @param buffer The buffer containing the data to write. + * @param count The number of bytes to write + * @param slot Callback slot to call when the request is satisfied. + * @param io_priority The io priority of the request. + */ + void write_all_async(const void* buffer, gsize count, const SlotAsyncReady& slot, int io_priority = Glib::PRIORITY_DEFAULT); + _IGNORE(g_output_stream_write_all_async) + + _WRAP_METHOD(bool write_all_finish(const Glib::RefPtr<AsyncResult>& result, gsize& bytes_written), + g_output_stream_write_all_finish, + errthrow) + + /** Splices a stream asynchronously. * When the operation is finished @a slot will be called. * You can then call splice_finish() to get the result of the |