flushable.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Flushable</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">Flushable</H1>
  11. <HR CLASS="banner">
  12. <!-- End Banner -->
  13. <H2>Description</H2>
  14. <P>
  15. A Flushable Sink or OutputFilter provides a means for the user to request that all buffered characters be sent downstream.
  16. </P>
  17. <H2>Refinement of</H2>
  18. <A NAME="types"></A>
  19. <H2>Associated Types</H2>
  20. <P>Same as <A HREF="filter.html#types">Filter</A> or <A HREF="device.html#types">Device</A>, with the following additional requirement:</P>
  21. <TABLE CELLPADDING="5" BORDER="1">
  22. <TR><TD>Category</TD><TD>A type convertible to <A HREF="../guide/traits.html#category_tags"><CODE>flushable_tag</CODE></A></TD></TR>
  23. </TABLE>
  24. <H2>Notation</H2>
  25. <TABLE CELLPADDING="2">
  26. <TR><TD><CODE>F</CODE></TD><TD>-</TD><TD>A type which is a model of Flushable</TD></TR>
  27. <TR><TD><CODE>D</CODE></TD><TD>-</TD><TD>A type which is a model of <A HREF="device.html">Sink</A>, with the same character type as <CODE>F</CODE></TD></TR>
  28. <TR><TD><CODE>f</CODE></TD><TD>-</TD><TD>Object of type <CODE>F</CODE></TD></TR>
  29. <TR><TD><CODE>d</CODE></TD><TD>-</TD><TD>Object of type <CODE>D</CODE></TD></TR>
  30. </TABLE>
  31. <H2>Valid Expressions / Semantics</H2>
  32. <TABLE CELLPADDING="5" BORDER="1">
  33. <TR><TH>Expression</TH><TH>Expression Type</TH><TH>Precondition</TH><TH>Semantics</TH></TR>
  34. <TR>
  35. <TD>
  36. <PRE CLASS="plain_code"><CODE><A HREF="../functions/flush.html#flush_device">boost::iostreams::flush</A>(f)</CODE></PRE>
  37. </TD>
  38. <TD><CODE>bool</CODE></TD>
  39. <TD>Category convertible to <A HREF="../guide/traits.html#category_tags"><CODE>device_tag</CODE></A></TD>
  40. <TD>
  41. Attempts to send all buffered characters downstream, returning <CODE>true</CODE> unless an error occurs.<A CLASS='footnote_ref' NAME='note_1_ref' HREF='#note_1'><SUP>[1]</SUP></A>
  42. </TD>
  43. </TR>
  44. <TR>
  45. <TD>
  46. <PRE CLASS="plain_code"><CODE><A HREF="../functions/flush.html#flush_filter">boost::iostreams::flush</A>(f, d)</CODE></PRE>
  47. </TD>
  48. <TD><CODE>bool</CODE></TD>
  49. <TD>Category convertible to <A HREF="../guide/traits.html#category_tags"><CODE>filter_tag</CODE></A></TD>
  50. <TD>
  51. <P>
  52. Attempts to write all buffered characters to d, returning <CODE>true</CODE> if all buffered characters were written.
  53. </P>
  54. </TD>
  55. </TR>
  56. </TABLE>
  57. <H2>Exceptions</H2>
  58. <P>
  59. Errors which occur during the execution of <A CLASS="code" HREF="../functions/flush.html"><CODE>flush</CODE></A> are be indicated by throwing exceptions. Such exceptions are caught and ignored if they occur during the execution of stream or stream buffer destructor.
  60. </P>
  61. <H2>Models</H2>
  62. <P>Several of the Filters and Devices provided by the Iostreams library are Flushable, but this is an implementation detail.</P>
  63. <HR>
  64. <P>
  65. <A CLASS='footnote_ref' NAME='note_1' HREF='#note_1_ref'><SUP>[1]</SUP></A>It was noticed late in developement that to be consistent with the policy of reporting errors using exceptions (<I>see</I> <A HREF='../guide/exceptions.html'>Exceptions</A>), <CODE>flush</CODE> should have been specified to return <CODE>void</CODE> when invoked on a Device. Until the specification is changed, Devices should always return <CODE>true</CODE> when flushed.
  66. </P>
  67. <!-- Begin Footer -->
  68. <HR>
  69. <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>
  70. <P CLASS="copyright">
  71. 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>)
  72. </P>
  73. <!-- End Footer -->
  74. </BODY>