Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-06-11 21:26:34


Jonathan D. Turkanis wrote:
> I've thought a little
> more about composition, and I think I see what your getting at. Composing
> streambufs is easy if the conversion facilities you want to use are
> expressed as codecvts. A wrapper around the code I posted could be used to
> generate streambufs like so:
>
> template<typename Codecvt, typename SrcOrSink>
> struct compose { }; // Derives from basic_streambuf<.., ..>
>
> You could then chain this operation: compose<Compress, compose<Escape,
> compose<Decrypt, File> > >. But the interface of std::codevt is complicated
> by the need to make the member functions const and pass the state as an

The code in files/col_io/test_fwd_streambuf.zip shows another way.
The fwd_ostreambuf simply implements a linked list of streambuf*
each of which forwards the streambuf::overflow arg to the next
link in the chain.

The marg_ostreambuf in that zip file prototypes a simplification of
the marg_ostreambuf in the col_io.zip.


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