1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Class Template basic_stdio_filter
</TITLE>
5 <LINK REL=
"stylesheet" HREF=
"../../../../boost.css">
6 <LINK REL=
"stylesheet" HREF=
"../theme/iostreams.css">
12 <H1 CLASS=
"title">Class Template
<CODE>basic_stdio_filter
</CODE></H1>
17 <DL class=
"page-index">
18 <DT><A href=
"#description">Description
</A></DT>
19 <DT><A href=
"#headers">Headers
</A></DT>
20 <DT><A href=
"#reference">Reference
</A></DT>
21 <DT><A href=
"#example">Example
</A></DT>
26 <A NAME=
"description"></A>
30 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.
33 <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.
36 <A NAME=
"headers"></A>
39 <DL class=
"page-index">
40 <DT><A CLASS=
"header" HREF=
"../../../../boost/iostreams/filter/stdio.hpp"><CODE><boost/iostreams/filter/stdio.hpp
></CODE></A></DT>
43 <A NAME=
"reference"></A>
48 <PRE CLASS=
"broken_ie"><SPAN CLASS=
"keyword">namespace
</SPAN> boost {
<SPAN CLASS=
"keyword">namespace
</SPAN> iostreams {
50 <SPAN CLASS='keyword'
>template
</SPAN><<SPAN CLASS='keyword'
>typename
</SPAN> <A CLASS='documented' HREF='#template_params'
>Ch
</A>>
51 <SPAN CLASS='keyword'
>class
</SPAN> <A CLASS='documented' HREF='#template_params'
>basic_stdio_filter
</A> {
52 <SPAN CLASS='keyword'
>public:
</SPAN>
53 <SPAN CLASS='keyword'
>typedef
</SPAN> Ch char_type;
54 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='omitted'
>[implementation-defined]
</SPAN> category;
55 <SPAN CLASS='keyword'
>protected:
</SPAN>
57 <SPAN CLASS='keyword'
>public:
</SPAN>
58 <SPAN CLASS='keyword'
>virtual
</SPAN> ~basic_stdio_filter();
59 <SPAN CLASS='keyword'
>private:
</SPAN>
60 <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>;
63 <SPAN CLASS='keyword'
>typedef
</SPAN> basic_stdio_filter
<<SPAN CLASS='keyword'
>char
</SPAN>> <SPAN CLASS='defined'
>stdio_filter
</SPAN>;
64 <SPAN CLASS='keyword'
>typedef
</SPAN> basic_stdio_filter
<<SPAN CLASS='keyword'
>wchar_t
</SPAN>> <SPAN CLASS='defined'
>wstdio_filter
</SPAN>;
66 } }
<SPAN CLASS=
"comment">// End namespace boost::io
</SPAN></PRE>
68 <A NAME=
"template_params"></A>
69 <H4>Template parameters
</H4>
71 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
74 <TD VALIGN=
"top"><I>Ch
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
75 <TD>The
<A HREF='../guide/traits.html#char_type'
>character type
</A></TD>
79 <A NAME=
"do_filter"></A>
80 <H4><CODE>counter::do_filter
</CODE></H4>
82 <PRE CLASS=
"broken_ie"> <SPAN CLASS='keyword'
>virtual
</SPAN> <SPAN CLASS='keyword'
>void
</SPAN> do_filter()
<SPAN CLASS='numeric_literal'
>=
0</SPAN>;
</PRE>
84 <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>
86 <A NAME=
"example"></A>
89 <P>Five examples of
<CODE>stdio_filter
</CODE>s are presented in the
<A HREF=
"../tutorial/writing_filters.html">Tutorial
</A>.
</P>
94 <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>
96 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>)