iostreams/doc/functions/putback.html

104 lines
4.3 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Function Template putback</TITLE>
<LINK REL="stylesheet" HREF="../../../../boost.css">
<LINK REL="stylesheet" HREF="../theme/iostreams.css">
</HEAD>
<BODY>
<!-- Begin Banner -->
<H1 CLASS="title">Function Template <CODE>putback</CODE></H1>
<HR CLASS="banner">
<!-- End Banner -->
<DL class="page-index">
<DT><A href="#overview">Overview</A></DT>
<DT><A href="#headers">Headers</A></DT>
<DT><A href="#reference">Reference</A></DT>
</DL>
<A NAME="overview"></A>
<H2>Overview</H2>
<P>
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>.
</P>
<A NAME="headers"></A>
<H2>Headers</H2>
<DL>
<DT><A CLASS="header" HREF="../../../../boost/iostreams/operations.hpp"><CODE>&lt;boost/iostreams/operations.hpp&gt;</CODE></A></DT>
<DT><A CLASS="header" HREF="../../../../boost/iostreams/putback.hpp"><CODE>&lt;boost/iostreams/putback.hpp&gt;</CODE></A></DT>
</DL>
<A NAME="reference"></A>
<H2>Reference</H2>
<A NAME="description"></A>
<H4>Description</H4>
<P>Attempt to putback a character to a given instance of the template parameter <CODE>Peekable</CODE>, returning <CODE>true</CODE> for success.</P>
<A NAME="synopsis"></A>
<H4>Synopsis</H4>
<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams {
<SPAN CLASS="keyword">template</SPAN>&lt;<SPAN CLASS="keyword">typename</SPAN> <A CLASS="documented" HREF="#template_params">Peekable</A>&gt;
<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);
} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE>
<A NAME="template_params"></A>
<H4>Template Parameters</H4>
<TABLE STYLE="margin-left:2em" BORDER=0 CELLPADDING=2>
<TR>
<TR>
<TD VALIGN="top"><I>Peekable</I></TD><TD WIDTH="2em" VALIGN="top">-</TD>
<TD>A model of <A HREF="../concepts/peekable.html">Peekable</A>.
</TR>
</TABLE>
<A NAME="semantics"></A>
<H4>Semantics</H4>
<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>
<TABLE STYLE="margin:0,0,2em,2em" BORDER=1 CELLPADDING=4>
<TR><TH><CODE>category_of&lt;Peekable&gt;::type</CODE></TH><TH>semantics</TH></TR>
<TR>
<TD VALIGN="top">convertible to <A HREF="../guide/traits.html#category_tags"><CODE>istream_tag</CODE></A></TD>
<TD>invokes <CODE>peekable.rdbuf()->putback(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</CODE></TD>
</TR>
<TR>
<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>
<TD>invokes <CODE>peekable.sputbackc(c)</CODE> and returns <CODE>true</CODE> if the operation was successful</TD>
</TR>
<TR>
<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>
<TD>returns <CODE>peekable.putback(c)</CODE></TD>
</TR>
<TR>
<TD VALIGN="top">otherwise</TD>
<TD>compile-time error</CODE></TD>
</TR>
</TABLE>
<!-- Begin Footer -->
<HR>
<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>
<P CLASS="copyright">
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>)
</P>
<!-- End Footer -->
</BODY>