peekable.html 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Peekable</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">Peekable</H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <H2>Description</H2>
  14. <P>
  15. A Peekable <A HREF="device.html">Device</A> allows a character read from the input sequence to be putback.
  16. </P>
  17. <P>
  18. The name of the concept is based on the observation that a PeekableDevice allow the user to peek at the first character in the sequence it controls by calling <A HREF="../functions/get.html"><CODE>get</CODE></A> or <A HREF="../functions/read.html"><CODE>read</CODE></A> followed by <A HREF="../functions/putback.html"><CODE>putback</CODE></A>. The names Putbackable and InputRevertable were considered but rejected.
  19. </P>
  20. <H2>Refinement of</H2>
  21. <A HREF="source.html">Source</A>.
  22. <A NAME="types"></A>
  23. <H2>Associated Types</H2>
  24. Same as <A HREF="source.html">Source</A>.
  25. <H2>Notation</H2>
  26. <TABLE CELLPADDING="2">
  27. <TR><TD><CODE>P</CODE></TD><TD>-</TD><TD>A type which is a model of Peekable</TD></TR>
  28. <TR><TD><CODE>p</CODE></TD><TD>-</TD><TD>Object of type <CODE>P</CODE></TD></TR>
  29. <TR><TD><CODE>c</CODE></TD><TD>-</TD><TD>Object of type equal to the character type of <CODE>P</CODE></TD></TR>
  30. <TR><TD><CODE>io</CODE></TD><TD>-</TD><TD>Alias for namespace <CODE>boost::iostreams</CODE></TD></TR>
  31. </TABLE>
  32. <H2>Valid Expressions / Semantics</H2>
  33. <TABLE CELLPADDING="5" BORDER="1">
  34. <TR><TH>Expression</TH><TH>Expression Type</TH><TH>Precondition</TH><TH>Semantics</TH><TH>Postcondition</TH></TR>
  35. <TR>
  36. <TD>
  37. <PRE CLASS="plain_code"><CODE><A HREF="../functions/putback.html">io::putback</A>(p, c)</CODE></PRE>
  38. </TD>
  39. <TD><CODE>bool</CODE></TD>
  40. <TD>
  41. One or more characters has been read from <CODE>p</CODE> using <A HREF="../functions/get.html"><CODE>io::get</CODE></A> or <A HREF="../functions/read.html"><CODE>io::read</CODE></A>, with no intervening i/o operations having been performed
  42. </TD>
  43. <TD>
  44. Attempts to put back <CODE>c</CODE> to <CODE>p</CODE>, returning <CODE>true</CODE> for success
  45. </TD>
  46. <TD>
  47. If putback returns <CODE>true</CODE>, the next character read from <CODE>p</CODE> using <A HREF="../functions/get.html"><CODE>io::get</CODE></A> or <A HREF="../functions/read.html"><CODE>io::read</CODE></A> will be equal to <CODE>c</CODE></A>
  48. </TD>
  49. </TR>
  50. </TABLE>
  51. <H2>Exceptions</H2>
  52. <P>
  53. Errors which occur during the execution of <A CLASS="code" HREF="../functions/putback.html"><CODE>putback</CODE></A> are be indicated by throwing exceptions.
  54. </P>
  55. <H2>Models</H2>
  56. <UL>
  57. <LI>Standard input streams and stream buffers.
  58. </UL>
  59. <!-- Begin Footer -->
  60. <HR>
  61. <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>
  62. <P CLASS="copyright">
  63. 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>)
  64. </P>
  65. <!-- End Footer -->
  66. </BODY>