filtering_streams.html 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Filtering Streams and Stream Buffers</TITLE>
  5. <LINK REL="stylesheet" href="../../../../boost.css">
  6. <LINK REL="stylesheet" href="../theme/iostreams.css">
  7. <STYLE>
  8. .caption_code { font: bold 8pt monospace }
  9. </STYLE>
  10. </HEAD>
  11. <BODY>
  12. <!-- Begin Banner -->
  13. <H1 CLASS="title">User's Guide</H1>
  14. <HR CLASS="banner">
  15. <!-- End Banner -->
  16. <!-- Begin Nav -->
  17. <DIV CLASS='nav'>
  18. <A HREF='generic_streams.html'><IMG BORDER=0 WIDTH=19 HEIGHT=19 SRC='../../../../doc/src/images/prev.png'></A>
  19. <A HREF='guide.html'><IMG BORDER=0 WIDTH=19 HEIGHT=19 SRC='../../../../doc/src/images/up.png'></A>
  20. <A HREF='code_conversion.html'><IMG BORDER=0 WIDTH=19 HEIGHT=19 SRC='../../../../doc/src/images/next.png'></A>
  21. </DIV>
  22. <!-- End Nav -->
  23. <A NAME="overview"></A>
  24. <H2>3.4 Filtering Streams and Stream Buffers</H2>
  25. <HR STYLE="margin-top:1em">
  26. <P>
  27. 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.
  28. </P>
  29. <P>
  30. 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>.
  31. </P>
  32. <P>
  33. 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 &#8212; 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 &#8212; 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.
  34. <!-- Begin Footer -->
  35. <HR STYLE="margin-top:1em">
  36. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  37. <P CLASS="copyright">
  38. 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>)
  39. </P>
  40. <!-- End Footer -->
  41. </BODY>