From: Maxim Egorushkin (e-maxim_at_[hidden])
Date: 2003-06-14 08:04:41
"Larry Evans" <jcampbell3_at_[hidden]> wrote in message
> I had a brief look and it looks promising. However, I'm wondering
> if some of the complexity can be avoided. I had a hard time figuring
> out just how to get marg_ostreambuf in files/col_io/col_io.zip to work
> with buffered input. After thinking some more, I thought about just
> using overflow and sputc to "pipe" the output to the next streambuf.
> This greatly simplified the code. Would something similar work with
> your code. In particular, can you create an equivalent to marg_ostream
> from files/col_io/col_io.zip by using your, I guess, stream buffer
> redirectors? I'd like to see that. Maybe Reece Dunn would also since
> he's "interested in indentation facilities."
I've examined col_io. At a high point of view it is the decorator pattern -
you extend basic_ostream<> interface with identation capabilities. The code
I posted, particulary input/output_buffer classes, is the adapter pattern -
it adds basic_streambuf<> interface to a sequence. So, this patterns have
If I get you right you want to see how one can add identation capabilites to
a buffer using the adapters. Well, it could be done but it would be somewhat
onerous. One would have to wrap an existing buffer with a developed sequence
model class that will transform the input and put it in the wrapped buffer.
And then wrap the sequence model with the output_buffer class. I think it is
not worth an effort.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk