summaryrefslogtreecommitdiff
path: root/gio/src/datainputstream.hg
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2010-11-10 10:13:02 +0100
committerMurray Cumming <murrayc@murrayc.com>2010-11-10 10:13:02 +0100
commit396dab7df3fa2892eaf04503edbfb0876a2ef776 (patch)
tree9850c3f1a9f8287e4b6c75bdf4a2c500d0d6d0f4 /gio/src/datainputstream.hg
parent9e5bbca892880705695f92434c3b25ef92d6fe56 (diff)
downloadglibmm-396dab7df3fa2892eaf04503edbfb0876a2ef776.tar.gz
Gio: Added some methods.
* gio/src/gio_methods.defs: * glib/src/glib_functions.defs: * glib/src/gobject_functions.defs: Regenerated with h2defs.py. * gio/src/application.hg: Added open(). Notice that I have used std::vector instead of ArrayHandle, because that is what we should use for all new API, after we decided that the intermediate types are too awkward for people to understand. * gio/src/actiongroup.[hg|ccg]: Added list_actions, though we need to use a std::vector here instead. * gio/src/datainputstream.[hg|ccg]: Added read_upto(), read_upto_async() and read_upto_finish(). Updated the read_until*() documentation to discourage their use (apparently they will be properly deprecated eventually). * gio/src/settings.hg: Added range_check(). * gio/src/socketclient.[hg|ccg]: Addef connect_to_uri(), connect_to_uri_async() and connect_to_uri_finish().
Diffstat (limited to 'gio/src/datainputstream.hg')
-rw-r--r--gio/src/datainputstream.hg109
1 files changed, 98 insertions, 11 deletions
diff --git a/gio/src/datainputstream.hg b/gio/src/datainputstream.hg
index 21e5c471..a2e966f0 100644
--- a/gio/src/datainputstream.hg
+++ b/gio/src/datainputstream.hg
@@ -95,10 +95,10 @@ public:
//Note that we return a bool because we can't use std::string to distinguish between an empty string and a NULL.
/** Reads a line from the data input stream.
- *
- * The operation can be cancelled by triggering the cancellable object from
+ *
+ * The operation can be cancelled by triggering the cancellable object from
* another thread. If the operation
- * was cancelled, a Gio::Error with CANCELLED will be thrown.
+ * was cancelled, a Gio::Error with CANCELLED will be thrown.
*
* @param data A string to fill with the read data (without the newlines).
* @param cancellable A cancellable object.
@@ -114,12 +114,12 @@ public:
*/
bool read_line(std::string& line);
- /** The asynchronous version of read_until(). It is
+ /** The asynchronous version of read_until(). It is
* an error to have two outstanding calls to this function.
*
- * @param slot The slot to call when the request is satisfied.
+ * @param slot The slot to call when the request is satisfied.
* @param cancellable A cancellable object.
- * @param io_priority The I/O priority of the request.
+ * @param io_priority The I/O priority of the request.
* @result true if the read succeeded without error.
*/
void read_line_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
@@ -134,9 +134,18 @@ public:
bool read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
_IGNORE(g_data_input_stream_read_line_finish)
- /** Reads a string from the data input stream, up to the first
+ /** Reads a string from the data input stream, up to the first
* occurrence of any of the stop characters.
*
+ * Note that, in contrast to read_until_async(),
+ * this function consumes the stop character that it finds.
+ *
+ * Don't use this function in new code. Its functionality is
+ * inconsistent with read_until_async(). Both
+ * functions will be marked as deprecated in a future release. Use
+ * read_upto() instead, but note that that method
+ * does not consume the stop character.
+ *
* @param data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
* @param cancellable A cancellable object.
@@ -145,25 +154,48 @@ public:
bool read_until(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
_IGNORE(g_data_input_stream_read_until)
+ //TODO: This will be really deprecated sometime, maybe even before glib 2.28.0.
/** A non-cancellable version of read_until().
+ *
+ * Note that, in contrast to read_until_async(),
+ * this function consumes the stop character that it finds.
+ *
+ * Don't use this function in new code. Its functionality is
+ * inconsistent with read_until_async(). Both
+ * functions will be marked as deprecated in a future release. Use
+ * read_upto() instead, but note that that method
+ * does not consume the stop character.
+ *
* @param stop_chars Characters to terminate the read.
* @param data A string to fill with the read data.
* @result true if the read succeeded without error.
*/
bool read_until(std::string& data, const std::string& stop_chars);
- /** The asynchronous version of read_until(). It is
+ //TODO: This will be really deprecated sometime, maybe even before glib 2.28.0.
+ /** The asynchronous version of read_until(). It is
* an error to have two outstanding calls to this function.
*
+ * Note that, in contrast to ead_until(),
+ * this function does not consume the stop character that it finds. You
+ * must read it for yourself.
+ *
+ *
+ * Don't use this function in new code. Its functionality is
+ * inconsistent with read_until(). Both functions
+ * will be marked as deprecated in a future release. Use
+ * read_upto_async() instead.
+ *
* @param stop_chars Characters to terminate the read.
- * @param slot The slot to call when the request is satisfied.
+ * @param slot The slot to call when the request is satisfied.
* @param cancellable A cancellable object.
- * @param io_priority The I/O priority of the request.
+ * @param io_priority The I/O priority of the request.
* @result true if the read succeeded without error.
*/
void read_until_async(const std::string& stop_chars, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
_IGNORE(g_data_input_stream_read_until_async)
+ //TODO: This will be really deprecated sometime, maybe even before glib 2.28.0.
/** Finish an asynchronous call started by read_until_async().
*
* @param result The AsyncResult that was provided to the callback slot.
@@ -173,9 +205,64 @@ public:
bool read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
_IGNORE(g_data_input_stream_read_until_finish)
+
+ /** Reads a string from the data input stream, up to the first
+ * occurrence of any of the stop characters.
+ *
+ * In contrast to read_until(), this method
+ * does <emphasis>not</emphasis> consume the stop character. You have
+ * to use read_byte() to get it before calling
+ * read_upto() again.
+ *
+ * @param data A string to fill with the read data.
+ * @param stop_chars Characters to terminate the read.
+ * @param cancellable A cancellable object.
+ * @result true if the read succeeded without error.
+ */
+ bool read_upto(std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable);
+ _IGNORE(g_data_input_stream_read_upto)
+
+ /** A non-cancellable version of read_upto().
+ * @param stop_chars Characters to terminate the read.
+ * @param data A string to fill with the read data.
+ * @result true if the read succeeded without error.
+ */
+ bool read_upto(std::string& data, const std::string& stop_chars);
+
+ //TODO: Add a version that takes the stop_chars length, to allow a 0 in the middle?
+
+ /** The asynchronous version of read_upto(). It is
+ * an error to have two outstanding calls to this function.
+ *
+ * In contrast to read_until(), this method
+ * does <emphasis>not</emphasis> consume the stop character. You have
+ * to use read_byte() to get it before calling
+ * read_upto() again.
+ *
+ * @param stop_chars Characters to terminate the read.
+ * @param slot The slot to call when the request is satisfied.
+ * @param cancellable A cancellable object.
+ * @param io_priority The I/O priority of the request.
+ * @result true if the read succeeded without error.
+ */
+ void read_upto_async(const std::string& stop_chars, const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, int io_priority = Glib::PRIORITY_DEFAULT);
+ _IGNORE(g_data_input_stream_read_upto_async)
+
+ /** Finish an asynchronous call started by read_upto_async().
+ *
+ * Note that this function does <emphasis>not</emphasis> consume the
+ * stop character. You have to use read_byte() to
+ * get it before calling read_upto_async() again.
+ *
+ * @param result The AsyncResult that was provided to the callback slot.
+ * @param data A string to fill with the read data.
+ * @result true if the read succeeded without error.
+ */
+ bool read_upto_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
+ _IGNORE(g_data_input_stream_read_upto_finish)
+
_WRAP_PROPERTY("byte-order", DataStreamByteOrder)
_WRAP_PROPERTY("newline-type", DataStreamNewlineType)
};
} // namespace Gio
-