[glibmm] Gio::DataInputStream: Remove read_until*()
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Gio::DataInputStream: Remove read_until*()
- Date: Thu, 15 Feb 2018 14:37:31 +0000 (UTC)
commit 9e1be57fe01f8f62ea34378577b22e15633ffdf6
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Thu Feb 15 15:34:53 2018 +0100
Gio::DataInputStream: Remove read_until*()
g_data_input_stream_read_until(), _read_until_async() and
_read_until_finish() have been deprecated.
gio/src/datainputstream.ccg | 75 ---------------------------------------
gio/src/datainputstream.hg | 82 ++----------------------------------------
2 files changed, 4 insertions(+), 153 deletions(-)
---
diff --git a/gio/src/datainputstream.ccg b/gio/src/datainputstream.ccg
index 7ae9beb..d5b31b4 100644
--- a/gio/src/datainputstream.ccg
+++ b/gio/src/datainputstream.ccg
@@ -94,81 +94,6 @@ DataInputStream::read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::
}
bool
-DataInputStream::read_until(
- std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable)
-{
- GError* gerror = nullptr;
- char* c_str = g_data_input_stream_read_until(gobj(), stop_chars.c_str(),
- nullptr, // pass nullptr since we can easily determine the length from the returned std::string
- Glib::unwrap(cancellable), &gerror);
- if (gerror)
- ::Glib::Error::throw_exception(gerror);
- if (c_str)
- {
- data = c_str;
- g_free(c_str);
- return true;
- }
- // end of stream reached, return failure status
- return false;
-}
-
-/** non-cancellable version of read_until()
- */
-bool
-DataInputStream::read_until(std::string& data, const std::string& stop_chars)
-{
- GError* gerror = nullptr;
- char* c_str = g_data_input_stream_read_until(gobj(), stop_chars.c_str(),
- nullptr, // pass nullptr since we can easily determine the length from the returned std::string
- nullptr, &gerror);
- if (gerror)
- ::Glib::Error::throw_exception(gerror);
- if (c_str)
- {
- data = c_str;
- g_free(c_str);
- return true;
- }
- // end of stream reached, return failure status
- return false;
-}
-
-void
-DataInputStream::read_until_async(const std::string& stop_chars, 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.
- auto slot_copy = new SlotAsyncReady(slot);
-
- g_data_input_stream_read_until_async(gobj(), stop_chars.c_str(), io_priority,
- Glib::unwrap(cancellable), &SignalProxy_async_callback, slot_copy);
-}
-
-bool
-DataInputStream::read_until_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data)
-{
- GError* gerror = nullptr;
- gsize size = 0;
- gchar* buffer =
- g_data_input_stream_read_until_finish(gobj(), Glib::unwrap(result), &size, &(gerror));
- if (gerror)
- ::Glib::Error::throw_exception(gerror);
-
- bool retval = false;
- if (buffer && size)
- {
- retval = (buffer != nullptr);
- data = std::string(buffer, size);
- g_free(buffer);
- }
-
- return retval;
-}
-
-bool
DataInputStream::read_upto(
std::string& data, const std::string& stop_chars, const Glib::RefPtr<Cancellable>& cancellable)
{
diff --git a/gio/src/datainputstream.hg b/gio/src/datainputstream.hg
index ad89425..da15849 100644
--- a/gio/src/datainputstream.hg
+++ b/gio/src/datainputstream.hg
@@ -138,83 +138,11 @@ public:
*/
_WRAP_METHOD(void read_line_finish_utf8(const Glib::RefPtr<AsyncResult>& result{.}, std::string&
data{OUT}, gsize& length{.?}), g_data_input_stream_read_line_finish_utf8, errthrow)
- /** 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[out] 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_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 sometime after glib 2.30.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[out] data A string to fill with the read data.
- * @param stop_chars Characters to terminate the read.
- * @result true if the read succeeded without error.
- */
- bool read_until(std::string& data, const std::string& stop_chars);
-
- //TODO: This will be really deprecated sometime after glib 2.30.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 cancellable A cancellable object.
- * @param io_priority The I/O priority of the request.
- */
- 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 after glib 2.30.0.
- /** Finish an asynchronous call started by read_until_async().
- *
- * @param result The AsyncResult that was provided to the callback slot.
- * @param[out] data A string to fill with the read data.
- * @result true if the read succeeded without error.
- */
- 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 <em>not</em> consume the stop character. You have
- * to use read_byte() to get it before calling
- * read_upto() again.
+ * This method does <em>not</em> consume the stop character. You have
+ * to use read_byte() to get it before calling %read_upto() again.
*
* @param[out] data A string to fill with the read data.
* @param stop_chars Characters to terminate the read.
@@ -236,10 +164,8 @@ public:
/** 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 <em>not</em> consume the stop character. You have
- * to use read_byte() to get it before calling
- * read_upto() again.
+ * This method does <em>not</em> consume the stop character. You have
+ * to use read_byte() to get it before calling %read_upto_async() again.
*
* @param stop_chars Characters to terminate the read.
* @param slot The slot to call when the request is satisfied.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]