Maxim Egorushkin wrote:
"Larry Evans" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

[snip]


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
different purposes.

Thanks very much. I hadn't realized col_io (or more particularly the code in test_marg_ostreambuf.zip) was a decorator pattern. However, I see now that the correspondence with the "Structure" secion on p. 177 of the GOF '95 _Design Patterns_ book. More precisely:

   Component -> streambuf
   ConcreteComponent -> the streambuf from the original ostream
   Decorator -> fwd_ostreambuf
   Decorator::Operation -> fwd_ostreambuf::overflow
   ConcreteDecoratorA -> marg_ostreambuf
   ConcreteDecoratorA::addedState -> marg_put

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.

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

OK.


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to