| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|---|
| 2 | <HTML> |
|---|
| 3 | <HEAD> |
|---|
| 4 | <TITLE>Class Template device</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>device</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 | </DL> |
|---|
| 22 | |
|---|
| 23 | <HR> |
|---|
| 24 | |
|---|
| 25 | <A NAME="description"></A> |
|---|
| 26 | <H2>Description</H2> |
|---|
| 27 | |
|---|
| 28 | <P> |
|---|
| 29 | The class template <CODE>device</CODE>, its subcass <CODE>wdevice</CODE> and their specializations <CODE>source</CODE>, <CODE>sink</CODE>, <CODE>wsource</CODE> and <CODE>wsink</CODE> are provided by the Iostreams library to ease the definitions of new models of the various <A HREF="../guide/concepts.html#device_concepts">Device Concepts</A>. These templates and <CODE>typedef</CODE>s are inteded to be used as base classes for user-defined Devices. They supply the member types <CODE>char_type</CODE> and <CODE>category</CODE> used by the Iostreams library. |
|---|
| 30 | </P> |
|---|
| 31 | <P> |
|---|
| 32 | 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>. |
|---|
| 33 | </P> |
|---|
| 34 | |
|---|
| 35 | <A NAME="headers"></A> |
|---|
| 36 | <H2>Headers</H2> |
|---|
| 37 | |
|---|
| 38 | <DL class="page-index"> |
|---|
| 39 | <DT><A CLASS="header" HREF="../../../../boost/iostreams/concepts.hpp"><CODE><boost/iostreams/concepts.hpp></CODE></A></DT> |
|---|
| 40 | </DL> |
|---|
| 41 | |
|---|
| 42 | <A NAME="reference"></A> |
|---|
| 43 | <H2>Reference</H2> |
|---|
| 44 | |
|---|
| 45 | <A NAME="synopsis"></A> |
|---|
| 46 | <H3>Synopsis</H3> |
|---|
| 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> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">char</SPAN>> |
|---|
| 51 | <SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#description">device</A>; |
|---|
| 52 | |
|---|
| 53 | <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Mode, <SPAN CLASS="keyword">typename</SPAN> Ch = <SPAN CLASS="keyword">wchar_t</SPAN>> |
|---|
| 54 | <SPAN CLASS="keyword">struct</SPAN> <SPAN CLASS="defined">wdevice</SPAN> : device<Mode, Ch> { }; |
|---|
| 55 | |
|---|
| 56 | <SPAN CLASS="keyword">typedef</SPAN> device<input> <SPAN CLASS="defined">source</SPAN></A>; |
|---|
| 57 | <SPAN CLASS="keyword">typedef</SPAN> device<output> <SPAN CLASS="defined">sink</SPAN>; |
|---|
| 58 | <SPAN CLASS="keyword">typedef</SPAN> wdevice<input> <SPAN CLASS="defined">wsource</SPAN>; |
|---|
| 59 | <SPAN CLASS="keyword">typedef</SPAN> wdevice<output> <SPAN CLASS="defined">wsink</SPAN>; |
|---|
| 60 | |
|---|
| 61 | <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Mode</A>, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Ch</A> = <SPAN CLASS="keyword">char</SPAN>> |
|---|
| 62 | <SPAN CLASS="keyword">struct</SPAN> <A CLASS="documented" HREF="#description">device</A> { |
|---|
| 63 | <SPAN CLASS="keyword">typedef</SPAN> Ch char_type; |
|---|
| 64 | <SPAN CLASS="keyword">typedef</SPAN> <A STYLE="text-decoration:none" HREF="#category"><SPAN CLASS="omitted">see below</SPAN></A> category; |
|---|
| 65 | <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(); |
|---|
| 66 | <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(std::ios_base::openmode); |
|---|
| 67 | <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&); |
|---|
| 68 | }; |
|---|
| 69 | |
|---|
| 70 | } } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> |
|---|
| 71 | |
|---|
| 72 | <A NAME="template_params"></A> |
|---|
| 73 | <H4>Template parameters</H4> |
|---|
| 74 | |
|---|
| 75 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> |
|---|
| 76 | <TR> |
|---|
| 77 | <TR> |
|---|
| 78 | <TD VALIGN="top"><I>Mode</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
|---|
| 79 | <TD>A <A HREF="../guide/modes.html#mode_tags">mode tag</A>.</TD> |
|---|
| 80 | </TR> |
|---|
| 81 | <TR> |
|---|
| 82 | <TD VALIGN="top"><I>Ch</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> |
|---|
| 83 | <TD>The character type</TD> |
|---|
| 84 | </TR> |
|---|
| 85 | </TABLE> |
|---|
| 86 | |
|---|
| 87 | <A NAME="category"></A> |
|---|
| 88 | <H4><CODE>device::category</CODE></H4> |
|---|
| 89 | |
|---|
| 90 | <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">typedef</SPAN> <SPAN CLASS="omitted">see below</SPAN> category;</PRE> |
|---|
| 91 | |
|---|
| 92 | <P> |
|---|
| 93 | A category tag convertible to <A HREF="#template_params"><CODE>Mode</CODE></A>, <A HREF="../guide/traits.html#category_tags"><CODE>device_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>. |
|---|
| 94 | </P> |
|---|
| 95 | |
|---|
| 96 | <A NAME="close"></A> |
|---|
| 97 | <H4><CODE>device::close</CODE></H4> |
|---|
| 98 | <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(); |
|---|
| 99 | <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#close">close</A>(std::ios_base::openmode);</PRE> |
|---|
| 100 | |
|---|
| 101 | <P> |
|---|
| 102 | Both overloads are implemented as no-ops. The second is available only if <A HREF="#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>. |
|---|
| 103 | </P> |
|---|
| 104 | <P> |
|---|
| 105 | Required by <A HREF="../concepts/closable.html">Closable</A>. |
|---|
| 106 | </P> |
|---|
| 107 | |
|---|
| 108 | <A NAME="imbue"></A> |
|---|
| 109 | <H4><CODE>device::imbue</CODE></H4> |
|---|
| 110 | <PRE CLASS="broken_ie"> <SPAN CLASS="keyword">void</SPAN> <A CLASS="documented" HREF="#imbue">imbue</A>(<SPAN CLASS="keyword">const</SPAN> std::locale&);</PRE> |
|---|
| 111 | |
|---|
| 112 | <P> |
|---|
| 113 | Implemented as a no-op. Required by <A HREF="../concepts/localizable.html">Localizable</A>. |
|---|
| 114 | </P> |
|---|
| 115 | |
|---|
| 116 | <!-- Begin Footer --> |
|---|
| 117 | |
|---|
| 118 | <HR> |
|---|
| 119 | <P CLASS="copyright">Revised |
|---|
| 120 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
|---|
| 121 | 20 May, 2004 |
|---|
| 122 | <!--webbot bot="Timestamp" endspan i-checksum="38504" --> |
|---|
| 123 | </P> |
|---|
| 124 | |
|---|
| 125 | <P CLASS="copyright">© Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P> |
|---|
| 126 | <P CLASS="copyright"> |
|---|
| 127 | 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>) |
|---|
| 128 | </P> |
|---|
| 129 | |
|---|
| 130 | <!-- End Footer --> |
|---|
| 131 | |
|---|
| 132 | </BODY> |
|---|