Boost logo

Boost :

From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-06-14 13:12:13

Maxim Egorushkin wrote:
> "Larry Evans" <jcampbell3_at_[hidden]> wrote in message
>>I'll soon upload a commented an simplified version of marg_ostreambuf
>>and maybe a templatized version to parameterize the addedState. I may
>>rename it too to decorated_ostreambuf or something similar.
> I think there is no need for marg_ostream at all. Why reinvent a bicycle if

The only reason is to avoid passing 2 objects, i.e. the ostream& and the
accompanying indent_decorator. Of course, you can get the
indent_decorator from the ostream with rdbuf and a cast; however, this
was demonstrated by the marg_ostreambuf.cpp in the which I uploaded yesterday.

> one can use original std::basic_ostream<>. And it would be great if
> marg_ostreambuf were parameterized by char and traits types like original
> std::basic_streambuf<>.


> Here is the code for decorator.

This looks pretty much the same as marg_ostreambuf in the, except the indent_decorator is not
derived from ostreambuf and uses marg_ostreambuf as a member
variable. Also, it's not unbuffered. Making it unbuffered
allowed simplification of marg_ostreambuf, as you can see by
comparing the marg_ostreambuf's in and Also, I was thinking that
using the you might want to string together the fwd_ostreambuf's
much like a unix pipe. For example, you could provide a
lineno_ostreambuf which numbers each line followed by the
marg_ostreambuf which indents you code.

Boost list run by bdawes at, gregod at, cpdaniel at, john at