blob: 4e0dde1abc17987f64ec618ba225f291ab772cb3 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Class Template basic_stdio_filter</TITLE>
<LINK REL="stylesheet" HREF="../../../../boost.css">
<LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>
<!-- Begin Banner -->
<H1 CLASS="title">Class Template <CODE>basic_stdio_filter</CODE></H1>
<HR CLASS="banner">
<!-- End Banner -->
<DL class="page-index">
<DT><A href="#description">Description</A></DT>
<DT><A href="#headers">Headers</A></DT>
<DT><A href="#reference">Reference</A></DT>
<DT><A href="#example">Example</A></DT>
</DL>
<HR>
<A NAME="description"></A>
<H2>Description</H2>
<P>
The class template <CODE>basic_stdio_filter</CODE> is a <A HREF='../concepts/dual_use_filter.html'>DualUseFilter</A> for use as a base class by Filters which read unfiltered data from standard input and write filtered data to standard output.
</P>
<P>
<CODE>basic_stdio_filter</CODE> is implemented by redirecting <CODE>std::cin</CODE> and <CODE>std::cout</CODE> (or <CODE>std::wcin</CODE> and <CODE>std::wcout</CODE>). Before <CODE>do_filter</CODE> is invoked, the entire stream of unfiltered data is read and stored in memory. As a result, <CODE>basic_stdio_filter</CODE> is unsuitable for use in low-memory environments or in conjunction with streams of data that have no natural end, such as stock tickers. Because of these limitations, <CODE>basic_stdio_filter</CODE> is best used as an aid to those learning to use the Iostreams library.
</P>
<A NAME="headers"></A>
<H2>Headers</H2>
<DL class="page-index">
<DT><A CLASS="header" HREF="../../../../boost/iostreams/filter/stdio.hpp"><CODE>&lt;boost/iostreams/filter/stdio.hpp&gt;</CODE></A></DT>
</DL>
<A NAME="reference"></A>
<H2>Reference</H2>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
<SPAN CLASS='keyword'>template</SPAN>&lt;<SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='#template_params'>Ch</A>&gt;
<SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#template_params'>basic_stdio_filter</A> {
<SPAN CLASS='keyword'>public:</SPAN>
<SPAN CLASS='keyword'>typedef</SPAN> Ch char_type;
<SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>[implementation-defined]</SPAN> category;
<SPAN CLASS='keyword'>protected:</SPAN>
basic_stdio_filter();
<SPAN CLASS='keyword'>public:</SPAN>
<SPAN CLASS='keyword'>virtual</SPAN> ~basic_stdio_filter();
<SPAN CLASS='keyword'>private:</SPAN>
<SPAN CLASS='keyword'>virtual</SPAN> <SPAN CLASS='keyword'>void</SPAN> <A CLASS='documented' HREF='#do_filter'>do_filter</A>() <SPAN CLASS='numeric_literal'>= 0</SPAN>;
};
<SPAN CLASS='keyword'>typedef</SPAN> basic_stdio_filter&lt;<SPAN CLASS='keyword'>char</SPAN>&gt; <SPAN CLASS='defined'>stdio_filter</SPAN>;
<SPAN CLASS='keyword'>typedef</SPAN> basic_stdio_filter&lt;<SPAN CLASS='keyword'>wchar_t</SPAN>&gt; <SPAN CLASS='defined'>wstdio_filter</SPAN>;
} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
<A NAME="template_params"></A>
<H4>Template parameters</H4>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>The <A HREF='../guide/traits.html#char_type'>character type</A></TD>
</TR>
</TABLE>
<A NAME="do_filter"></A>
<H4><CODE>counter::do_filter</CODE></H4>
<PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>virtual</SPAN> <SPAN CLASS='keyword'>void</SPAN> do_filter() <SPAN CLASS='numeric_literal'>= 0</SPAN>;</PRE>
<P>Reads from standard input and writes to standard output until standard input is exhausted. If <CODE>Ch</CODE> is <CODE>char</CODE>, uses <CODE>std::cin</CODE> and <CODE>std::cout</CODE>; if <CODE>Ch</CODE> is <CODE>wchar_t</CODE>, uses <CODE>std::wcin</CODE> and <CODE>std::wcout</CODE>.</P>
<A NAME="example"></A>
<H2>Example</H2>
<P>Five examples of <CODE>stdio_filter</CODE>s are presented in the <A HREF="../tutorial/writing_filters.html">Tutorial</A>.</P>
<!-- Begin Footer -->
<HR>
<P CLASS="copyright">Revised 02 Feb 2008</P>
<P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="http://www.coderage.com/turkanis/" target="_top">Jonathan Turkanis</a></P>
<P CLASS="copyright">
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>)
</P>
<!-- End Footer -->
</BODY>