putback.html 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Function Template putback</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>putback</CODE></H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <DL class="page-index">
  14. <DT><A href="#overview">Overview</A></DT>
  15. <DT><A href="#headers">Headers</A></DT>
  16. <DT><A href="#reference">Reference</A></DT>
  17. </DL>
  18. <A NAME="overview"></A>
  19. <H2>Overview</H2>
  20. <P>
  21. The function template <CODE>putback</CODE> provides a uniform interface for putting back characters read from models of <A HREF="../concepts/peekable.html">Peekable</A>, for use in the definitions of <A HREF="../concepts/filter.html">Filters</A>.
  22. </P>
  23. <A NAME="headers"></A>
  24. <H2>Headers</H2>
  25. <DL>
  26. <DT><A CLASS="header" HREF="../../../../boost/iostreams/operations.hpp"><CODE>&lt;boost/iostreams/operations.hpp&gt;</CODE></A></DT>
  27. <DT><A CLASS="header" HREF="../../../../boost/iostreams/putback.hpp"><CODE>&lt;boost/iostreams/putback.hpp&gt;</CODE></A></DT>
  28. </DL>
  29. <A NAME="reference"></A>
  30. <H2>Reference</H2>
  31. <A NAME="description"></A>
  32. <H4>Description</H4>
  33. <P>Attempt to putback a character to a given instance of the template parameter <CODE>Peekable</CODE>, returning <CODE>true</CODE> for success.</P>
  34. <A NAME="synopsis"></A>
  35. <H4>Synopsis</H4>
  36. <PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
  37. <SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Peekable</A>&gt;
  38. <SPAN CLASS="keyword">bool</SPAN> <A CLASS="documented" HREF="#semantics">putback</A>(Peekable&amp; peekable, <SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="../guide/traits.html#char_type_of_ref">char_type_of</A>&lt;Peekable&gt;::type c);
  39. } } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
  40. <A NAME="template_params"></A>
  41. <H4>Template Parameters</H4>
  42. <TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
  43. <TR>
  44. <TR>
  45. <TD VALIGN="top"><I>Peekable</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
  46. <TD>A model of <A HREF="../concepts/peekable.html">Peekable</A>.
  47. </TR>
  48. </TABLE>
  49. <A NAME="semantics"></A>
  50. <H4>Semantics</H4>
  51. <P>The semantics of <CODE>putback</CODE> depends on the <A HREF="../guide/traits.html#category">category</A> of <CODE>Peekable</CODE> as follows:</P>
  52. <TABLE STYLE="margin:0,0,2em,2em" BORDER=1 CELLPADDING=4>
  53. <TR><TH><CODE>category_of&lt;Peekable&gt;::type</CODE></TH><TH>semantics</TH></TR>
  54. <TR>
  55. <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD>
  56. <TD>invokes <CODE>peekable.rdbuf()->putback(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</CODE></TD>
  57. </TR>
  58. <TR>
  59. <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>streambuf_tag</CODE></A> but not to <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD>
  60. <TD>invokes <CODE>peekable.sputbackc(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</TD>
  61. </TR>
  62. <TR>
  63. <TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>peekable_tag</CODE></A> but not to <A HREF="../guide/traits.html#category_tags"><CODE>streambuf_tag</CODE></A> or <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD>
  64. <TD>returns <CODE>peekable.putback(c)</CODE></TD>
  65. </TR>
  66. <TR>
  67. <TD VALIGN="top">otherwise</TD>
  68. <TD>compile-time error</CODE></TD>
  69. </TR>
  70. </TABLE>
  71. <!-- Begin Footer -->
  72. <HR>
  73. <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>
  74. <P CLASS="copyright">
  75. 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>)
  76. </P>
  77. <!-- End Footer -->
  78. </BODY>