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.

Chris


Best of all, why not include suitable stream buffers derived from
std::streambuf in glibmm itself? If automatic code conversion is wanted
that can be done by providing a codecvt facet for the relevant locale and
imbue()ing that, although I have never come across a case where that was
useful.




Whatever you Wanadoo

This email has been checked for most known viruses - find out more here

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