1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Filtering Streams and Stream Buffers
</TITLE>
5 <LINK REL=
"stylesheet" href=
"../../../../boost.css">
6 <LINK REL=
"stylesheet" href=
"../theme/iostreams.css">
8 .caption_code { font: bold
8pt monospace }
15 <H1 CLASS=
"title">User's Guide
</H1>
23 <A HREF='generic_streams.html'
><IMG BORDER=
0 WIDTH=
19 HEIGHT=
19 SRC='../../../../doc/src/images/prev.png'
></A>
24 <A HREF='guide.html'
><IMG BORDER=
0 WIDTH=
19 HEIGHT=
19 SRC='../../../../doc/src/images/up.png'
></A>
25 <A HREF='code_conversion.html'
><IMG BORDER=
0 WIDTH=
19 HEIGHT=
19 SRC='../../../../doc/src/images/next.png'
></A>
30 <A NAME=
"overview"></A>
31 <H2>3.4 Filtering Streams and Stream Buffers
</H2>
33 <HR STYLE=
"margin-top:1em">
36 The class templates
<A href=
"../classes/filtering_streambuf.html"><CODE>filtering_streambuf
</CODE></A> and
<A href=
"../classes/filtering_stream.html"><CODE>filtering_stream
</CODE></A> are the fundamental components provided by the Iostreams library for filtering data. Each
<CODE>filtering_streambuf
</CODE> or
<CODE>filtering_stream
</CODE> contains a chain of zero or more
<A HREF=
"../concepts/filter.html">Filters
</A> followed by an optional
<A HREF=
"../concepts/device.html">Device
</A>, accessed with an interface similar to that of
<CODE>std::stack
</CODE>. These chains are represented by of the class template
<A HREF=
"../classes/chain.html"><CODE>chain
</CODE></A>. If the chain ends with a Device it is called
<SPAN CLASS=
"term">complete
</SPAN> and may be used to perform i/o.
39 The
<A HREF=
"modes.html">mode
</A> of each
<CODE>stream_buffer
</CODE> in the chain must refine the mode of the
<CODE>filtering_streambuf
</CODE> or
<CODE>filtering_stream
</CODE>. For example, one cannot use a Filter or Device having mode
<A HREF=
"modes.html#output">output
</A> with a
<CODE>filtering_streambuf
</CODE> having mode
<A HREF=
"modes.html#input">input
</A>.
42 If a
<CODE>filtering_streambuf
</CODE> or
<CODE>filtering_stream
</CODE> has mode
<A HREF=
"modes.html#input">input
</A>, data flows from the chain's end to its beginning
— starting at a
<A href=
"../concepts/source.html">Source
</A> and passing through zero or more
<A href=
"../concepts/input_filter.html">InputFilters
</A>. If it has mode
<A HREF=
"modes.html#output">output
</A>, data flows in the opposite direction
— from the beginning of the chain, through zero or more
<A href=
"../concepts/output_filter.html">OutputFilters
</A>, towards
<A href=
"../concepts/source.html">Sink
</A> at the end of the chain. If a
<CODE>filtering_streambuf
</CODE> or
<CODE>filtering_stream
</CODE> performs both input and output, data flows in both directions.
46 <HR STYLE=
"margin-top:1em">
48 <P CLASS=
"copyright">© Copyright
2008 <a href=
"http://www.coderage.com/" target=
"_top">CodeRage, LLC
</a><br/>© Copyright
2004-
2007 <a href=
"http://www.coderage.com/turkanis/" target=
"_top">Jonathan Turkanis
</a></P>
50 Distributed under the Boost Software License, Version
1.0. (See accompanying file LICENSE_1_0.txt or copy at
<A HREF=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt
</A>)