| 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 |  | 
|---|
| 10 | <!-- Begin Banner --> | 
|---|
| 11 |  | 
|---|
| 12 |     <H1 CLASS="title">Flushable</H1> | 
|---|
| 13 |     <HR CLASS="banner"> | 
|---|
| 14 |  | 
|---|
| 15 | <!-- End Banner --> | 
|---|
| 16 |  | 
|---|
| 17 | <H2>Description</H2> | 
|---|
| 18 |  | 
|---|
| 19 | <P> | 
|---|
| 20 |     A Flushable Sink or OutputFilter provides a means for the user to request that all buffered characters be sent downstream. | 
|---|
| 21 | </P> | 
|---|
| 22 |  | 
|---|
| 23 | <H2>Refinement of</H2> | 
|---|
| 24 |  | 
|---|
| 25 | <A NAME="types"></A> | 
|---|
| 26 | <H2>Associated Types</H2> | 
|---|
| 27 |  | 
|---|
| 28 | <P>Same as <A HREF="filter.html#types">Filter</A> or <A HREF="device.html#types">Device</A>, with the following additional requirement:</P> | 
|---|
| 29 |  | 
|---|
| 30 | <TABLE CELLPADDING="5" BORDER="1"> | 
|---|
| 31 |     <TR><TD>Category</TD><TD>A type convertible to <A HREF="../guide/traits.html#category_tags"><CODE>flushable_tag</CODE></A></TD></TR> | 
|---|
| 32 | </TABLE> | 
|---|
| 33 |  | 
|---|
| 34 |  | 
|---|
| 35 | <H2>Notation</H2> | 
|---|
| 36 |  | 
|---|
| 37 | <TABLE CELLPADDING="2"> | 
|---|
| 38 |     <TR><TD><CODE>F</CODE></TD><TD>-</TD><TD>A type which is a model of Flushable</TD></TR> | 
|---|
| 39 |     <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> | 
|---|
| 40 |     <TR><TD><CODE>f</CODE></TD><TD>-</TD><TD>Object of type <CODE>F</CODE></TD></TR> | 
|---|
| 41 |     <TR><TD><CODE>d</CODE></TD><TD>-</TD><TD>Object of type <CODE>D</CODE></TD></TR> | 
|---|
| 42 | </TABLE> | 
|---|
| 43 |  | 
|---|
| 44 | <H2>Valid Expressions / Semantics</H2> | 
|---|
| 45 |  | 
|---|
| 46 | <TABLE CELLPADDING="5" BORDER="1"> | 
|---|
| 47 |     <TR><TH>Expression</TH><TH>Expression Type</TH><TH>Precondition</TH><TH>Semantics</TH></TR> | 
|---|
| 48 |     <TR> | 
|---|
| 49 |         <TD> | 
|---|
| 50 |             <PRE CLASS="plain_code"><CODE><A HREF="../functions/flush.html#flush_device">boost::iostreams::flush</A>(f)</CODE></PRE> | 
|---|
| 51 |         </TD> | 
|---|
| 52 |         <TD><CODE>bool</CODE></TD> | 
|---|
| 53 |         <TD>Category convertible to <A HREF="../guide/traits.html#category_tags"><CODE>device_tag</CODE></A></TD> | 
|---|
| 54 |         <TD> | 
|---|
| 55 |             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> | 
|---|
| 56 |         </TD> | 
|---|
| 57 |     </TR> | 
|---|
| 58 |     <TR> | 
|---|
| 59 |         <TD> | 
|---|
| 60 |             <PRE CLASS="plain_code"><CODE><A HREF="../functions/flush.html#flush_filter">boost::iostreams::flush</A>(f, d)</CODE></PRE> | 
|---|
| 61 |         </TD> | 
|---|
| 62 |         <TD><CODE>bool</CODE></TD> | 
|---|
| 63 |         <TD>Category convertible to <A HREF="../guide/traits.html#category_tags"><CODE>filter_tag</CODE></A></TD> | 
|---|
| 64 |         <TD> | 
|---|
| 65 |             <P> | 
|---|
| 66 |                 Attempts to write all buffered characters to d, returning <CODE>true</CODE> if all buffered characters were written. | 
|---|
| 67 |             </P> | 
|---|
| 68 |         </TD> | 
|---|
| 69 |     </TR> | 
|---|
| 70 | </TABLE> | 
|---|
| 71 |  | 
|---|
| 72 | <H2>Exceptions</H2> | 
|---|
| 73 |  | 
|---|
| 74 | <P> | 
|---|
| 75 |     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. | 
|---|
| 76 | </P> | 
|---|
| 77 |  | 
|---|
| 78 | <H2>Models</H2> | 
|---|
| 79 |  | 
|---|
| 80 | <P>Several of the Filters and Devices provided by the Iostreams library are Flushable, but this is an implementation detail.</P> | 
|---|
| 81 |  | 
|---|
| 82 | <HR> | 
|---|
| 83 |  | 
|---|
| 84 | <P> | 
|---|
| 85 |     <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. | 
|---|
| 86 | </P> | 
|---|
| 87 |  | 
|---|
| 88 | <!-- Begin Footer --> | 
|---|
| 89 |  | 
|---|
| 90 | <HR> | 
|---|
| 91 | <P CLASS="copyright">Revised | 
|---|
| 92 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> | 
|---|
| 93 | 20 May, 2004 | 
|---|
| 94 | <!--webbot bot="Timestamp" endspan i-checksum="38504" --> | 
|---|
| 95 | </P> | 
|---|
| 96 |  | 
|---|
| 97 | <P CLASS="copyright">© Copyright <A HREF="http://www.kangaroologic.com" TARGET="_top">Jonathan Turkanis</A>, 2004</P> | 
|---|
| 98 | <P CLASS="copyright">  | 
|---|
| 99 |     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>) | 
|---|
| 100 | </P> | 
|---|
| 101 |  | 
|---|
| 102 | <!-- End Footer --> | 
|---|
| 103 |  | 
|---|
| 104 | </BODY> | 
|---|