]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
2 | <HTML> | |
3 | <HEAD> | |
4 | <TITLE>Class Template basic_stdio_filter</TITLE> | |
5 | <LINK REL="stylesheet" HREF="../../../../boost.css"> | |
6 | <LINK REL="stylesheet" HREF="../theme/iostreams.css"> | |
7 | </HEAD> | |
8 | <BODY> | |
9 | ||
10 | <!-- Begin Banner --> | |
11 | ||
12 | <H1 CLASS="title">Class Template <CODE>basic_stdio_filter</CODE></H1> | |
13 | <HR CLASS="banner"> | |
14 | ||
15 | <!-- End Banner --> | |
16 | ||
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> | |
22 | </DL> | |
23 | ||
24 | <HR> | |
25 | ||
26 | <A NAME="description"></A> | |
27 | <H2>Description</H2> | |
28 | ||
29 | <P> | |
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. | |
31 | </P> | |
32 | <P> | |
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. | |
34 | </P> | |
35 | ||
36 | <A NAME="headers"></A> | |
37 | <H2>Headers</H2> | |
38 | ||
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> | |
41 | </DL> | |
42 | ||
43 | <A NAME="reference"></A> | |
44 | <H2>Reference</H2> | |
45 | ||
46 | <H4>Synopsis</H4> | |
47 | ||
48 | <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { | |
49 | ||
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> | |
56 | basic_stdio_filter(); | |
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>; | |
61 | }; | |
62 | ||
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>; | |
65 | ||
66 | } } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> | |
67 | ||
68 | <A NAME="template_params"></A> | |
69 | <H4>Template parameters</H4> | |
70 | ||
71 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> | |
72 | <TR> | |
73 | <TR> | |
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> | |
76 | </TR> | |
77 | </TABLE> | |
78 | ||
79 | <A NAME="do_filter"></A> | |
80 | <H4><CODE>counter::do_filter</CODE></H4> | |
81 | ||
82 | <PRE CLASS="broken_ie"> <SPAN CLASS='keyword'>virtual</SPAN> <SPAN CLASS='keyword'>void</SPAN> do_filter() <SPAN CLASS='numeric_literal'>= 0</SPAN>;</PRE> | |
83 | ||
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> | |
85 | ||
86 | <A NAME="example"></A> | |
87 | <H2>Example</H2> | |
88 | ||
89 | <P>Five examples of <CODE>stdio_filter</CODE>s are presented in the <A HREF="../tutorial/writing_filters.html">Tutorial</A>.</P> | |
90 | <!-- Begin Footer --> | |
91 | ||
92 | <HR> | |
93 | ||
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> | |
95 | <P CLASS="copyright"> | |
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>) | |
97 | </P> | |
98 | ||
99 | <!-- End Footer --> | |
100 | ||
101 | </BODY> |