|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2004-08-31 23:36:32
"Larry Evans" <cppljevans_at_[hidden]> wrote in:
>
> I haven't thought deeply about this, but could this message idea and
> stack of streambuf's be used to implement a part of the upper layers
> of the OSI model:
>
> http://www.geocities.com/SiliconValley/Monitor/3131/ne/osimodel.html
>
> ? For example, each layer would correspond to an element in the stack
> of streambufs, and each streambuf could have a state associated with it.
> For example, the state could be a complex fsm, as with TCP:
>
>
http://www.tcpipguide.com/free/t_TCPOperationalOverviewandtheTCPFiniteStateMachineF.htm
This is getting pretty far afield, isn't it, Larry? ;-)
>
> In another application, indenting output to reflect code structure, the
> state could be a simple flag, bol (beginning-of-line), to indicate the
> next character output will be the first on the line, and a length, to
> indicate the width of the current margin. An example of a streambuf
> with such a simple state is:
>
>
http://cvs.sourceforge.net/viewcvs.py/boost-sandbox/boost-sandbox/boost/io/filters/ofilter_leftmargin_adjustable.hpp?view=markup
>
> Jonathan, I'll be trying to rewrite the above code with IOStreams.
> looks like it'll be very easy. I'll just have to add the same member
> variables in the above code to that in your example:
>
> toupper_output_filter;
>
> and rename it, of course, and change the put to check the bol flag and
> print the margin before outputing the character. Then add a method
> to adjust the margin length.
I look forward to this. Maybe I can make it one of the examples, or part of the
library in the 'text-processing' category.
> BTW, Jonathan, the documentation looks very good. I'll use it as a
> model if I ever try to get anything submitted.
Thanks!
BTW, I hope you can find time to submit a review.
Best Regards,
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk