1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <TITLE>Function Template restrict
</TITLE>
5 <LINK REL=
"stylesheet" HREF=
"../../../../boost.css">
6 <LINK REL=
"stylesheet" HREF=
"../theme/iostreams.css">
12 <H1 CLASS=
"title">Function Template
<CODE>restrict
</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>
25 <A NAME=
"description"></A>
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='http://www.boost.org/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.
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>.
37 The function template
<a href=
"slice.html"><code>slice
</code></a> is available as an alias of
<code>restrict
</code>, for platforms that treat
<code>restrict
</code> as a keyword.
40 <A NAME=
"headers"></A>
43 <DL class=
"page-index">
44 <DT><A CLASS=
"header" HREF=
"../../../../boost/iostreams/restrict.hpp"><CODE><boost/iostreams/restrict.hpp
></CODE></A></DT>
47 <A NAME=
"reference"></A>
50 <A NAME=
"synopsis"></A>
53 <PRE CLASS=
"broken_ie"><SPAN CLASS=
"keyword">namespace
</SPAN> boost {
<SPAN CLASS=
"keyword">namespace
</SPAN> iostreams {
55 <SPAN CLASS=
"keyword">template
</SPAN><<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#restriction_template_params">Component
</A>>
56 <SPAN CLASS='keyword'
>class
</SPAN> <A CLASS='documented' HREF='#restriction'
>restriction
</A> {
57 <SPAN CLASS='keyword'
>public:
</SPAN>
58 <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;
59 <SPAN CLASS='keyword'
>typedef
</SPAN> <SPAN CLASS='omitted'
>implementation-defined
</SPAN> mode;
61 <A CLASS='documented' HREF='#restriction_ctor'
>restriction
</A>( [
<SPAN CLASS='keyword'
>const
</SPAN>] Component
& component,
62 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> off,
63 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> len =
<SPAN CLASS='literal'
>-
1</SPAN> );
65 <SPAN CLASS='comment'
>// Filter or Device member functions
</SPAN>
68 <SPAN CLASS=
"keyword">template
</SPAN><<SPAN CLASS=
"keyword">typename
</SPAN> <A CLASS=
"documented" HREF=
"#restrict_template_params">Component
</A>>
69 <A CLASS='documented' HREF='#restriction'
>restriction
</A><Component
>
70 <A CLASS='documented' HREF='#restrict'
>restrict
</A>( [
<SPAN CLASS='keyword'
>const
</SPAN>] Component
& component,
71 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> off,
72 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> len =
<SPAN CLASS='literal'
>-
1</SPAN> );
74 } } // End namespace boost::io
</PRE>
76 <A NAME=
"restriction"></A>
77 <H2>Class Template
<CODE>restriction
</CODE></H2>
79 <A NAME=
"restriction_template_params"></A>
80 <H4>Template parameters
</H4>
82 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
85 <TD VALIGN=
"top"><I>Component
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
86 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A> or
<A HREF='../concepts/device.html'
>Device
</A></TD>
90 <A NAME=
"restriction_ctor"></A>
91 <H4><CODE>restriction::restriction
</CODE></H4>
93 <PRE CLASS=
"broken_ie"> restriction( [
<SPAN CLASS='keyword'
>const
</SPAN>] Component
& component,
94 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> off,
95 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> len =
<SPAN CLASS='literal'
>-
1</SPAN> );
</PRE>
98 Constructs an instance of
<CODE>restriction
</CODE> based on the given component and offsets. The parameters have the following interpretation:
101 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
104 <TD VALIGN=
"top"><I>component
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
105 <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>
108 <TD VALIGN=
"top"><I>off
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
109 <TD>The offset of the beginning of the restricted character sequence.
</TD>
112 <TD VALIGN=
"top"><I>len
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
113 <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>
117 <A NAME=
"restrict"></A>
118 <H2>Function Template
<CODE>restrict
</CODE></H2>
120 <PRE CLASS=
"broken_ie"><SPAN CLASS=
"keyword">template
</SPAN><<SPAN CLASS=
"keyword">typename
</SPAN> Component
>
121 restriction
<Component
>
122 restrict( [
<SPAN CLASS='keyword'
>const
</SPAN>] Component
& component,
123 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> off,
124 <A CLASS='documented' HREF='positioning.html#synopsis'
>stream_offset
</A> len =
<SPAN CLASS='literal'
>-
1</SPAN> );
</PRE>
126 <A NAME=
"restrict_template_params"></A>
127 <H4>Template parameters
</H4>
129 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
132 <TD VALIGN=
"top"><I>Component
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
133 <TD>A model of
<A HREF='../concepts/filter.html'
>Filter
</A> or
<A HREF='../concepts/device.html'
>Device
</A></TD>
138 Constructs an instance of an appropriate specialization of
<CODE>restriction
</CODE> based on the given component and offsets. The parameters have the following interpretation:
141 <TABLE STYLE=
"margin-left:2em" BORDER=
0 CELLPADDING=
2>
144 <TD VALIGN=
"top"><I>component
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
145 <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>
148 <TD VALIGN=
"top"><I>off
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
149 <TD>The offset of the beginning of the restricted character sequence.
</TD>
152 <TD VALIGN=
"top"><I>len
</I></TD><TD WIDTH=
"2em" VALIGN=
"top">-
</TD>
153 <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>
157 <!-- Begin Footer -->
161 <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>
162 <P CLASS=
"copyright">
163 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>)