[glibmm] DataInputStream: Add read_line_utf8() and read_line_finish_utf8().



commit bde7c569a73494cbf83a315ff028a1931de381aa
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Oct 11 16:34:24 2011 -0400

    DataInputStream: Add read_line_utf8() and read_line_finish_utf8().
    
    	* gio/src/datainputstream.hg: Add the two methods and their overloads
    	using the new gmmproc parameter reordering, optional parameter
    	signaling and output parameter signaling functionality.  It's not
    	difficult to write the _INITIALIZATION and _WRAP_METHOD macros but
    	they may not be readily understandable.  I think they are, but I could
    	be wrong.

 ChangeLog                  |   11 +++++++++++
 gio/src/datainputstream.hg |    9 +++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bfa5805..6c147f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-10-11  Josà Alburquerque  <jaalburqu svn gnome org>
 
+	DataInputStream: Add read_line_utf8() and read_line_finish_utf8().
+
+	* gio/src/datainputstream.hg: Add the two methods and their overloads
+	using the new gmmproc parameter reordering, optional parameter
+	signaling and output parameter signaling functionality.  It's not
+	difficult to write the _INITIALIZATION and _WRAP_METHOD macros but
+	they may not be readily understandable.  I think they are, but I could
+	be wrong.
+
+2011-10-11  Josà Alburquerque  <jaalburqu svn gnome org>
+
 	gmmproc: _WRAP_METHOD: Use {OUT} instead of {RET} for output params.
 
 	* tools/pm/Output.pm: Use {OUT} instead of {RET} to signify that a
diff --git a/gio/src/datainputstream.hg b/gio/src/datainputstream.hg
index 412eb08..9a9a910 100644
--- a/gio/src/datainputstream.hg
+++ b/gio/src/datainputstream.hg
@@ -114,6 +114,13 @@ public:
    */
   bool read_line(std::string& line);
 
+// The below initialization is unusual because it stores the return in a 'tmp'
+// variable, sets the output parameter and then frees the return.  If this is
+// too weird, the methods can probably be just handwritten.
+# _INITIALIZATION(`std::string&',`return-char*',`char* tmp = $4; $3 = tmp; g_free(tmp)')
+
+  _WRAP_METHOD(void read_line_utf8(std::string& line{OUT}, const Glib::RefPtr<Cancellable>& cancellable{.?}, gsize& length{.?}), g_data_input_stream_read_line_utf8, errthrow)
+
   /** The asynchronous version of read_until(). It is
    * an error to have two outstanding calls to this function.
    *
@@ -134,6 +141,8 @@ public:
   bool read_line_finish(const Glib::RefPtr<AsyncResult>& result, std::string& data);
   _IGNORE(g_data_input_stream_read_line_finish)
 
+  _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.
    *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]