Re: Re: Gtkmm-forge digest, Vol 1 #824 - 7 msgs



In fact it occurs to me that automatic codeset conversion, whether via Glib::IOChannel or a codecvt facet, would be positively wrong in this case, as the stream operators << and >> for Glib::ustring already carry out codeset conversion before the stream buffer is reached.  This is a nuisance and makes the proposal below rather less attractive.

Chris

========================================
Message date : Dec 09 2004, 11:25 AM
>From : "Chris Vine" 
To : murrayc murrayc com
Copy to : gtkmm-list gnome org
Subject : Re: Gtkmm-forge digest, Vol 1 #824 - 7 msgs

On further thought it would be relatively straightforward to implement a compliant C++ stream buffer for reading to and writing from file descriptors in terms of a Glib::IOChannel.  This could use the Glib::IOChannel buffer for the outstream (write) buffer, and would be trivial.  The instream (read) buffer would be more complicated: it would be necessary to provide an internal buffer in the stream buffer class (the one deriving from std::streambuf) rather than use the Glib::IOChannel read buffer, as otherwise it would be necessary to override uflow() and pbackfail() as well as underflow(), and Glib::IOChannel does not provide sufficient access to its read buffer to do this.

The simplest solution for the instream (read) buffer would therefore be to turn the IOChannel buffer off, but according to the documentation that requires automatic codeset conversion also to be turned off.  Otherwise it would be necessary to use double buffering - not a big problem but a little less efficient.  However, since automatic codeset conversion is intended to be dealt with in C++ through a codecvt facet, turning it off seems the correct approach anyway.

If you would be interested in including something like this in glibmm, let me know and I will prepare something for comment.


-- 

Whatever you Wanadoo:
http://www.wanadoo.co.uk/time/

This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm



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