Re: giomm API question



On Wed, Feb 20, 2008 at 7:24 PM, Jonathon Jongsma
<jonathon quotidian org> wrote:
> Right now, the Gio::InputStream class has a read function which takes
>  a standard C data buffer:
>
>  gssize InputStream::read(void* buffer, gsize count);
>
>  Since we use C++, it might be nice to be able to read data into a
>  std::string instead of a C data buffer, so I was going to add a
>  overloaded convenience function to do so:
>
>  gssize InputStream::read(std::string& buffer, gsize count);
[snip]

I am not sure if such a method would be appropriate.
InputStream is an interface, while a std::string-ed read() would
cover a specific case of reading text files. Maybe I'm being
conservative though. It's just that somehow putting this one
function, which for instance would not do anything good in
case of reading a binary file, along all the other general-purpose
stuff, would not look right to me.

OTOH operators << and >> would be very nice but we do
not really have the time for them now. Also if the goal is to ease
text processing then why not go with something complete like
Qt's QTextStream [1] for instance. Although that would fit
a utility library (ahem) better.

    Marko

[1] http://doc.trolltech.com/4.3/qtextstream.html


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