<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Class Template 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>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> </DL> <HR> <A NAME="description"></A> <H2>Description</H2> <P> The class templates <CODE>filter</CODE>, <CODE>wfilter</CODE>, <CODE>multichar_filter</CODE>, <CODE>multichar_wfilter</CODE> and their specializations are provided by the Iostreams library for use as base classes for user-defined <A HREF="../concepts/filter.html">Filters</A>. These base classes supply the member types <CODE>char_type</CODE> and <CODE>category</CODE> used internally by the Iostreams library to classify filters. </P> <P> The supplied <CODE>category</CODE> member is convertible to <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and to <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>. This allows users to define models of the concepts <A HREF="../concepts/closable.html">Closable</A> and <A HREF="../concepts/closable.html">Localizable</A> simply by providing definitions of member functions <CODE>close</CODE> and <CODE>imbue</CODE>. </P> <A NAME="headers"></A> <H2>Headers</H2> <DL class="page-index"> <DT><A CLASS="header" HREF="../../../../boost/iostreams/concepts.hpp"><CODE><boost/iostreams/concepts.hpp></CODE></A></DT> </DL> <A NAME="reference"></A> <H2>Reference</H2> <A NAME="synopsis"></A> <H3>Synopsis</H3> <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost{ <SPAN CLASS="keyword">namespace</SPAN> iostreams { <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#description">filter</A>; <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">wchar_t</SPAN>> <SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">wfilter</SPAN> : filter<Mode, Ch> { }; <SPAN CLASS="keyword">typedef</SPAN> filter<input> input_filter; <SPAN CLASS="keyword">typedef</SPAN> wfilter<input> input_wfilter; <SPAN CLASS="keyword">typedef</SPAN> filter<output> output_filter; <SPAN CLASS="keyword">typedef</SPAN> wfilter<output> output_wfilter; <SPAN CLASS="keyword">typedef</SPAN> filter<seekable> seekable_filter; <SPAN CLASS="keyword">typedef</SPAN> wfilter<seekable> seekable_wfilter; <SPAN CLASS="keyword">typedef</SPAN> filter<dual_use> dual_use_filter; <SPAN CLASS="keyword">typedef</SPAN> wfilter<dual_use> dual_use_wfilter; <SPAN CLASS="keyword"><SPAN CLASS="keyword">template</SPAN></SPAN><<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#multichar_filter">multichar_filter</A> : filter<Mode, Ch> { <SPAN CLASS="keyword">typedef</SPAN> <A STYLE="text-decoration:none" HREF="#category"><SPAN CLASS="omitted">see below</SPAN></A> category; }; <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">wchar_t</SPAN>> <SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">multichar_wfilter</SPAN> : multichar_filter<Mode, Ch> { }; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<input> multichar_input_filter; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<input> multichar_input_wfilter; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<output> multichar_output_filter; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<output> multichar_output_wfilter; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<dual_use> multichar_dual_use_filter; <SPAN CLASS="keyword">typedef</SPAN> multichar_filter<dual_use> multichar_dual_use_wfilter; <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#filter_template_params">Mode</A>, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#filter_template_params">Ch</A> = <SPAN CLASS="keyword">char</SPAN>> <SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#filter">filter</A> { <SPAN CLASS="keyword">typedef</SPAN> Ch char_type; <SPAN CLASS="keyword">typedef</SPAN> <A STYLE="text-decoration:none" HREF="#category"><SPAN CLASS="omitted">see below</SPAN></A> category; <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Device> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&); <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Device> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(std::ios_base::openmode, Device&); <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&); }; } } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> <A NAME="filter"></A> <H3>Class Template <CODE>filter</CODE></H3> <H4>Description</H4> <P>Convenience base class for defining <A HREF="../concepts/filter.html">Filters</A></P> <A NAME="filter_template_params"></A> <H4>Template parameters</H4> <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> <TR> <TR> <TD VALIGN="top"><I>Mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> <TD>A <A HREF="../guide/modes.html#mode_tags">mode tag</A>.</TD> </TR> <TR> <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> <TD>The character type</TD> </TR> </TABLE> <A NAME="category"></A> <H4><CODE>filter::category</CODE></H4> <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">see below</SPAN> category;</PRE> <P> A category tag convertible to <A HREF="#filter_template_params"><CODE>Mode</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>filter_tag</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>. </P> <A NAME="close"></A> <H4><CODE>filter::close</CODE></H4> <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Device> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(Device&); <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Device> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(std::ios_base::openmode, Device&);</PRE> <P> Both overloads are implemented as no-ops. The second is available only if <A HREF="#filter_template_params">Mode</A> is convertible to <A HREF="../guide/modes.html#mode_tags"><CODE>bidirectional</CODE></A>. The first is available only if Mode is <I>not</I> convertible to <A HREF="../guide/modes.html#mode_tags"><CODE>bidirectional</CODE></A>. </P> <P> Required by <A HREF="../concepts/closable.html">Closable</A>. </P> <A NAME="imbue"></A> <H4><CODE>filter::imbue</CODE></H4> <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&);</PRE> <P> Implemented as a no-op. Required by <A HREF="../concepts/localizable.html">Localizable</A>. </P> <A NAME="multichar_filter"></A> <H3>Class Template <CODE>multichar_filter</CODE></H3> <H4>Description</H4> <P>Convenience base class for defining <A HREF="../concepts/multi_character.html">Multi-Character Filters</A>. Derived class of <A HREF="#filter"><CODE>filter</CODE></A> whose member type <CODE>category</CODE> is convertible to the template parameter Mode and to <A HREF="../guide/traits.html#category_tags"><CODE>multichar_filter_tag</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>closable_tag</CODE></A> and <A HREF="../guide/traits.html#category_tags"><CODE>localizable_tag</CODE></A>.</P> <A NAME="multichar_filter_template_params"></A> <H4>Template parameters</H4> <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> <TR> <TR> <TD VALIGN="top"><I>Mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> <TD>A <A HREF="../guide/modes.html#mode_tags">mode tag</A>.</TD> </TR> <TR> <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> <TD>The character type</TD> </TR> </TABLE> <!-- Begin Footer --> <HR STYLE="margin-top:2em"> <P CLASS="copyright">Revised 02 Feb 2008</P> <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> <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>