|
Boost : |
From: Daryle Walker (dwalker07_at_[hidden])
Date: 2003-06-27 00:40:25
For the past few weeks, some posters were talking about streambufs that
can decorate another stream buffer. I wrote up a general class at
<http://groups.yahoo.com/group/boost/files/filter_stream.hpp>.
The non-virtual filter functions act as a pass-through (i.e. no change)
filter/monitor at the moment. We would need to figure out the points
of customizing before adding the virtual filter functions. For
instance, "doing_imbue" could have a virtual "do_postonly_imbue" that
only lets the filter do its own adjusting for locale changes after the
main stream buffer has already done its adjustments. The "doing_sync"
method could have a virtual "do_preonly_sync" that is called before the
main stream buffer's syncing, and the virtual method could return a
Boolean determining if the main buffer should continue. The other
"doings" could have pre- and post-actions (no "only," of course).
One difficulty would be if the reading and/or writing overrides need
to store extra characters. Maybe I could add reserve space in the
filtering stream buffer....
Daryle
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk