| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | 
|---|
| 2 | <HTML> | 
|---|
| 3 | <HEAD> | 
|---|
| 4 |     <TITLE>Class Template chain</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">Function Template <CODE>restrict</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 |     Given a Filter or Device that provides access to a single character sequence, we can construct a second Filter or Device which provides access to contiguous subsequence of the the original sequence. This second Filter or Device is called a <I>restriction</I> of the original device. Restrictions are represented by instances of the class template <CODE>restriction</CODE>. The function template <CODE>resrict</CODE> is an <A HREF='../../../../more/generic_programming.html#object_generator' TARGET='_top'>object generator</A> which returns an appropriate instance of <CODE>resriction</CODE> when passed a Filter or Device and a pair of values indicating the endpoints of the restricted subsequence. | 
|---|
| 30 | </P> | 
|---|
| 31 |  | 
|---|
| 32 | <P> | 
|---|
| 33 |     The <A HREF='../guide/modes.html'>mode</A> of a <CODE>resriction</CODE> is the same as that of the underlying component. A <CODE>resriction</CODE> is <A HREF='../concepts/closable.html'>Closable</A>, <A HREF='../concepts/flushable.html'>Flushable</A>, <A HREF='../concepts/localizable.html'>Localizable</A> and <A HREF='../concepts/optimally_buffered.html'>OptimallyBuffered</A>. | 
|---|
| 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/restrict.hpp"><CODE><boost/iostreams/restrict.hpp></CODE></A></DT> | 
|---|
| 41 | </DL> | 
|---|
| 42 |  | 
|---|
| 43 | <A NAME="reference"></A> | 
|---|
| 44 | <H2>Reference</H2> | 
|---|
| 45 |  | 
|---|
| 46 | <A NAME="synopsis"></A> | 
|---|
| 47 | <H4>Synopsis</H4> | 
|---|
| 48 |  | 
|---|
| 49 | <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { | 
|---|
| 50 |  | 
|---|
| 51 | <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#restriction_template_params">Component</A>> | 
|---|
| 52 | <SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#restriction'>restriction</A> { | 
|---|
| 53 | <SPAN CLASS='keyword'>public:</SPAN> | 
|---|
| 54 |     <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='keyword'>typename</SPAN> <A CLASS='documented' HREF='../guide/traits.html#char_type_of_ref'>char_type_of</A><Component>::type  char_type; | 
|---|
| 55 |     <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>implementation-defined</SPAN>                  mode; | 
|---|
| 56 |  | 
|---|
| 57 |     <A CLASS='documented' HREF='#restriction_ctor'>restriction</A>( [<SPAN CLASS='keyword'>const</SPAN>] Component& component, | 
|---|
| 58 |                  <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,  | 
|---|
| 59 |                  <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN     CLASS='literal'>-1</SPAN> ); | 
|---|
| 60 |  | 
|---|
| 61 |     <SPAN CLASS='comment'>// Filter or Device member functions</SPAN> | 
|---|
| 62 | }; | 
|---|
| 63 |  | 
|---|
| 64 | <SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#restrict_template_params">Component</A>> | 
|---|
| 65 | <A CLASS='documented' HREF='#restriction'>restriction</A><Component>  | 
|---|
| 66 | <A CLASS='documented' HREF='#restrict'>restrict</A>( [<SPAN CLASS='keyword'>const</SPAN>] Component& component, | 
|---|
| 67 |           <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,  | 
|---|
| 68 |           <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN     CLASS='literal'>-1</SPAN> ); | 
|---|
| 69 |  | 
|---|
| 70 | } } // End namespace boost::io</PRE> | 
|---|
| 71 |  | 
|---|
| 72 | <A NAME="restriction"></A> | 
|---|
| 73 | <H2>Class Template <CODE>restriction</CODE></H2> | 
|---|
| 74 |  | 
|---|
| 75 | <A NAME="restriction_template_params"></A> | 
|---|
| 76 | <H4>Template parameters</H4> | 
|---|
| 77 |  | 
|---|
| 78 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> | 
|---|
| 79 | <TR> | 
|---|
| 80 |     <TR> | 
|---|
| 81 |         <TD VALIGN="top"><I>Component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 82 |         <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD> | 
|---|
| 83 |     </TR> | 
|---|
| 84 | </TABLE> | 
|---|
| 85 |  | 
|---|
| 86 | <A NAME="restriction_ctor"></A> | 
|---|
| 87 | <H4><CODE>restriction::restriction</CODE></H4> | 
|---|
| 88 |  | 
|---|
| 89 | <PRE CLASS="broken_ie">    restriction( [<SPAN CLASS='keyword'>const</SPAN>] Component& component, | 
|---|
| 90 |                  <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,  | 
|---|
| 91 |                  <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN     CLASS='literal'>-1</SPAN> );</PRE> | 
|---|
| 92 |  | 
|---|
| 93 | <P> | 
|---|
| 94 |     Constructs an instance of <CODE>restriction</CODE> based on the given component and offsets. The parameters have the following interpretation: | 
|---|
| 95 | </P> | 
|---|
| 96 |  | 
|---|
| 97 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> | 
|---|
| 98 | <TR> | 
|---|
| 99 |     <TR> | 
|---|
| 100 |         <TD VALIGN="top"><I>component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 101 |         <TD>The Filter or Device to be restricted. If <CODE>Component</CODE> is a stream or stream buffer type, the function parameter is a non-<CODE>const</CODE> reference; otherwise it is a <CODE>const</CODE> reference.</TD> | 
|---|
| 102 |     </TR> | 
|---|
| 103 |     <TR> | 
|---|
| 104 |         <TD VALIGN="top"><I>off</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 105 |         <TD>The offset of the beginning of the restricted character sequence.</TD> | 
|---|
| 106 |     </TR> | 
|---|
| 107 |     <TR> | 
|---|
| 108 |         <TD VALIGN="top"><I>len</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 109 |         <TD>The length of the restricted character sequence. A value of <CODE>-1</CODE> indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.</TD> | 
|---|
| 110 |     </TR> | 
|---|
| 111 | </TABLE> | 
|---|
| 112 |  | 
|---|
| 113 | <A NAME="restrict"></A> | 
|---|
| 114 | <H2>Function Template <CODE>restrict</CODE></H2> | 
|---|
| 115 |  | 
|---|
| 116 | <PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Component> | 
|---|
| 117 | restriction<Component>  | 
|---|
| 118 | restrict( [<SPAN CLASS='keyword'>const</SPAN>] Component& component, | 
|---|
| 119 |           <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,  | 
|---|
| 120 |           <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN     CLASS='literal'>-1</SPAN> );</PRE> | 
|---|
| 121 |  | 
|---|
| 122 | <A NAME="restrict_template_params"></A> | 
|---|
| 123 | <H4>Template parameters</H4> | 
|---|
| 124 |  | 
|---|
| 125 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> | 
|---|
| 126 | <TR> | 
|---|
| 127 |     <TR> | 
|---|
| 128 |         <TD VALIGN="top"><I>Component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 129 |         <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD> | 
|---|
| 130 |     </TR> | 
|---|
| 131 | </TABLE> | 
|---|
| 132 |  | 
|---|
| 133 | <P> | 
|---|
| 134 |     Constructs an instance of an appropriate specialization of <CODE>restriction</CODE> based on the given component and offsets. The parameters have the following interpretation: | 
|---|
| 135 | </P> | 
|---|
| 136 |  | 
|---|
| 137 | <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2> | 
|---|
| 138 | <TR> | 
|---|
| 139 |     <TR> | 
|---|
| 140 |         <TD VALIGN="top"><I>component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 141 |         <TD>The Filter or Device to be restricted. If <CODE>Component</CODE> is a stream or stream buffer type, the function parameter is a non-<CODE>const</CODE> reference; otherwise it is a <CODE>const</CODE> reference.</TD> | 
|---|
| 142 |     </TR> | 
|---|
| 143 |     <TR> | 
|---|
| 144 |         <TD VALIGN="top"><I>off</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 145 |         <TD>The offset of the beginning of the restricted character sequence.</TD> | 
|---|
| 146 |     </TR> | 
|---|
| 147 |     <TR> | 
|---|
| 148 |         <TD VALIGN="top"><I>len</I></TD><TD WIDTH="2em" VALIGN="top">-</TD> | 
|---|
| 149 |         <TD>The length of the restricted character sequence. A value of <CODE>-1</CODE> indicates that the end of the restricted sequence should be the same as that of the unrestricted sequence.</TD> | 
|---|
| 150 |     </TR> | 
|---|
| 151 | </TABLE> | 
|---|
| 152 |  | 
|---|
| 153 | <!-- Begin Footer --> | 
|---|
| 154 |  | 
|---|
| 155 | <HR> | 
|---|
| 156 | <P CLASS="copyright">Revised | 
|---|
| 157 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> | 
|---|
| 158 | 20 May, 2004 | 
|---|
| 159 | <!--webbot bot="Timestamp" endspan i-checksum="38504" --> | 
|---|
| 160 | </P> | 
|---|
| 161 |  | 
|---|
| 162 | <P CLASS="copyright">© Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P> | 
|---|
| 163 | <P CLASS="copyright">  | 
|---|
| 164 |     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>) | 
|---|
| 165 | </P> | 
|---|
| 166 |  | 
|---|
| 167 | <!-- End Footer --> | 
|---|
| 168 |  | 
|---|
| 169 | </BODY> | 
|---|