[haiku-development] Re: RFC: BDataIO::Print(), PrintToStream(BDataIO&)

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Mon, 29 Jun 2009 19:36:30 +0200 CEST

Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> * Added BDataIO::[V]Print() methods for convenient printf() style 
> printing 
> to BDataIOs.

That could also be solved by a BFormattedIO class that you can wrap 
around any other class.
If one would also add parsing functionality, I think this would be the 
preferred way to go.

> * Added experimental BFdIO and BFileIO, which are BPositionIO 
> implementations wrapping a given file descriptor respectively FILE*.

I don't like the BFdIO name, but I don't have a good idea for a 
replacement either - or have only BFileIO, and have it accept an fd as 
well (the FILE* version could flush the stream, and directly write to 
its fd, for example).

> * Added PrintToStream(BDataIO&) versions to BPoint, BRect, BRegion, 
> BMessage.

Very welcome.

> The new BDataIO methods eat up virtual slots. I suppose Print() could 
> actually be non-virtual -- at least I can't imagine why any derived 
> class 
> would want to do anything other than the default implementation (i.e. 
> construct a va_list and call VPrint()).
> 
> The name for VPrint() is "inspired" by the C/POSIX API names. Another 
> option would be something more descriptive like PrintVarArgs().

I wouldn't mind either way.

I think we could also add the Meta{Read|Write|...}() functions to 
BDataIO, they should be useful, too.

Bye,
   Axel.


Other related posts: