Boost logo

Boost :

From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2007-11-30 19:33:36


Sebastian,

> Back in June I posted some thoughts about what I'd expect
> from a properly done I/O library.[1] Based on the ensuing
> discussion I then designed such a library. Over the last
> months, I've worked hard at implementing the thing.
>
> It is with quite a bit of pride, then, that I announce the
> IOChain preview release 1.

This looks really nice and modular allowing to have flexible IO components
readily available.

One (probably unrelated) thought I had when looking at the documentation
was, that it might be useful to allow integration with the new Spirit2
library (consisting out of parser and generator subsystems), allowing to do
IO of structured data. I'm not sure if this has to be done on the device or
filter level, but the essence would be to be able to read and write
arbitrarily formatted data, where the formatting is independent from the
data.

We did such an integration with the exising iostreams (I'm mentioning this
here just to explain what I mean), allowing to write:

    os << karma::format(
              stream % ", ", // format description
              c // data
          );

where stream invokes an existing operator<< for every element of the data
stored in the container 'c' (essentially any container, such as vector,
string, iterator_range etc.) and comma separates these elements. The
equivalent input looks very similar:

    is >> qi::parse(
              stream % ", ", // format description
              c // data
          );

this time 'stream' uses the operator>> to 'parse' the data into the
container 'c'.

Regards Hartmut


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk