filtering_streambuffiltering_stream<boost/iostreams/filtering_streambuf.hpp><boost/iostreams/filtering_stream.hpp>namespace boost { namespace iostreams { template< typename Mode, typename Ch = char, typename Tr = std::char_traits<Ch>, typename Alloc = std::allocator<Ch> > class filtering_streambuf; template< typename Mode, typename Ch = char, typename Tr = std::char_traits<Ch>, typename Alloc = std::allocator<Ch> > class filtering_streambuf; } } // End namespace boost::io
The class templates filtering_streambuf and filtering_stream are the fundamental components provided by the Iostreams Library for filtering data. Each filtering_streambuf or filtering_stream contains a chain of instances of streambuf_facade, accessed with an interface similar to that of std::stack. Each streambuf_facade in the chain is based on Filter — except possibly the last, which may be based on Device. If the chain ends with a Device it is called complete and may be used to perform i/o.
The i/o mode of each streambuf_facade in the chain must refine the mode of the filtering_streambuf or filtering_stream. For example, one cannot use a Filter or Device having mode output with a filtering_streambuf having mode input.
If a filtering_streambuf or filtering_stream has io_mode input, data flows from the chain's end to its beginning — starting at a streambuf_facade based on a Source and passing through zero or more streambuf_facades based on InputFilters (see Figure 3). If it has mode output, data flows in the opposite direction — from the beginning of the chain, through zero or more streambuf_facades based on OutputFilters, towards a streambuf_facade based on a Sink at the end of the chain (see Figure 4). If a filtering_streambuf or filtering_stream performs both input and output, data flows in both directions (see Figure 5 and Figure 6).
Revised 20 May, 2004
© Copyright Jonathan Turkanis, 2004
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)