restrict.html 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Function Template restrict</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../../boost.css">
  6. <LINK REL="stylesheet" HREF="../theme/iostreams.css">
  7. </HEAD>
  8. <BODY>
  9. <!-- Begin Banner -->
  10. <H1 CLASS="title">Function Template <CODE>restrict</CODE></H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <DL class="page-index">
  14. <DT><A href="#description">Description</A></DT>
  15. <DT><A href="#headers">Headers</A></DT>
  16. <DT><A href="#reference">Reference</A></DT>
  17. </DL>
  18. <HR>
  19. <A NAME="description"></A>
  20. <H2>Description</H2>
  21. <P>
  22. 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.
  23. </P>
  24. <P>
  25. 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>.
  26. </P>
  27. <P>
  28. 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.
  29. </P>
  30. <A NAME="headers"></A>
  31. <H2>Headers</H2>
  32. <DL class="page-index">
  33. <DT><A CLASS="header" HREF="../../../../boost/iostreams/restrict.hpp"><CODE>&lt;boost/iostreams/restrict.hpp&gt;</CODE></A></DT>
  34. </DL>
  35. <A NAME="reference"></A>
  36. <H2>Reference</H2>
  37. <A NAME="synopsis"></A>
  38. <H4>Synopsis</H4>
  39. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  40. <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#restriction_template_params">Component</A>&gt;
  41. <SPAN CLASS='keyword'>class</SPAN> <A CLASS='documented' HREF='#restriction'>restriction</A> {
  42. <SPAN CLASS='keyword'>public:</SPAN>
  43. <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>&lt;Component&gt;::type char_type;
  44. <SPAN CLASS='keyword'>typedef</SPAN> <SPAN CLASS='omitted'>implementation-defined</SPAN> mode;
  45. <A CLASS='documented' HREF='#restriction_ctor'>restriction</A>( [<SPAN CLASS='keyword'>const</SPAN>] Component&amp; component,
  46. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,
  47. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN CLASS='literal'>-1</SPAN> );
  48. <SPAN CLASS='comment'>// Filter or Device member functions</SPAN>
  49. };
  50. <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#restrict_template_params">Component</A>&gt;
  51. <A CLASS='documented' HREF='#restriction'>restriction</A>&lt;Component&gt;
  52. <A CLASS='documented' HREF='#restrict'>restrict</A>( [<SPAN CLASS='keyword'>const</SPAN>] Component&amp; component,
  53. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,
  54. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN CLASS='literal'>-1</SPAN> );
  55. } } // End namespace boost::io</PRE>
  56. <A NAME="restriction"></A>
  57. <H2>Class Template <CODE>restriction</CODE></H2>
  58. <A NAME="restriction_template_params"></A>
  59. <H4>Template parameters</H4>
  60. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  61. <TR>
  62. <TR>
  63. <TD VALIGN="top"><I>Component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  64. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD>
  65. </TR>
  66. </TABLE>
  67. <A NAME="restriction_ctor"></A>
  68. <H4><CODE>restriction::restriction</CODE></H4>
  69. <PRE CLASS="broken_ie"> restriction( [<SPAN CLASS='keyword'>const</SPAN>] Component&amp; component,
  70. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,
  71. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN CLASS='literal'>-1</SPAN> );</PRE>
  72. <P>
  73. Constructs an instance of <CODE>restriction</CODE> based on the given component and offsets. The parameters have the following interpretation:
  74. </P>
  75. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  76. <TR>
  77. <TR>
  78. <TD VALIGN="top"><I>component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  79. <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>
  80. </TR>
  81. <TR>
  82. <TD VALIGN="top"><I>off</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  83. <TD>The offset of the beginning of the restricted character sequence.</TD>
  84. </TR>
  85. <TR>
  86. <TD VALIGN="top"><I>len</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  87. <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>
  88. </TR>
  89. </TABLE>
  90. <A NAME="restrict"></A>
  91. <H2>Function Template <CODE>restrict</CODE></H2>
  92. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> Component&gt;
  93. restriction&lt;Component&gt;
  94. restrict( [<SPAN CLASS='keyword'>const</SPAN>] Component&amp; component,
  95. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> off,
  96. <A CLASS='documented' HREF='positioning.html#synopsis'>stream_offset</A> len = <SPAN CLASS='literal'>-1</SPAN> );</PRE>
  97. <A NAME="restrict_template_params"></A>
  98. <H4>Template parameters</H4>
  99. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  100. <TR>
  101. <TR>
  102. <TD VALIGN="top"><I>Component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  103. <TD>A model of <A HREF='../concepts/filter.html'>Filter</A> or <A HREF='../concepts/device.html'>Device</A></TD>
  104. </TR>
  105. </TABLE>
  106. <P>
  107. Constructs an instance of an appropriate specialization of <CODE>restriction</CODE> based on the given component and offsets. The parameters have the following interpretation:
  108. </P>
  109. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  110. <TR>
  111. <TR>
  112. <TD VALIGN="top"><I>component</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  113. <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>
  114. </TR>
  115. <TR>
  116. <TD VALIGN="top"><I>off</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  117. <TD>The offset of the beginning of the restricted character sequence.</TD>
  118. </TR>
  119. <TR>
  120. <TD VALIGN="top"><I>len</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  121. <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>
  122. </TR>
  123. </TABLE>
  124. <!-- Begin Footer -->
  125. <HR>
  126. <P CLASS="copyright">&copy; Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>&copy; Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P>
  127. <P CLASS="copyright">
  128. 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>)
  129. </P>
  130. <!-- End Footer -->
  131. </BODY>