<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>libstdc++: std::basic_istream< _CharT, _Traits >::sentry Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript"> $(document).ready(initResizable); </script> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.4 --> <div id="top"> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">libstdc++</div> </td> </tr> </tbody> </table> </div> </div> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> initNavTree('a00397.html',''); </script> <div id="doc-content"> <div class="header"> <div class="summary"> <a href="#pub-types">Public Types</a> | <a href="#pub-methods">Public Member Functions</a> </div> <div class="headertitle"> <div class="title">std::basic_istream< _CharT, _Traits >::sentry Class Reference</div> </div> </div> <div class="contents"> <!-- doxytag: class="std::basic_istream::sentry" --> <p>Performs setup work for input streams. <a href="a00397.html#details">More...</a></p> <p><a href="a01904.html">List of all members.</a></p> <h2><a name="pub-types"></a> Public Types</h2> <ul> <li><a class="anchor" id="a2caa06031c896dd0edc65f3a83214264"></a><!-- doxytag: member="std::basic_istream::sentry::__ctype_type" ref="a2caa06031c896dd0edc65f3a83214264" args="" --> typedef <br class="typebreak"/> <a class="el" href="a00442.html">__istream_type::__ctype_type</a> <b>__ctype_type</b> <li><a class="anchor" id="a282a36ad246007f07603dcd0cf7bff64"></a><!-- doxytag: member="std::basic_istream::sentry::__int_type" ref="a282a36ad246007f07603dcd0cf7bff64" args="" --> typedef _Traits::int_type <b>__int_type</b> <li><a class="anchor" id="a9691d4cea84bfcdff2dd4a6057b5a7e2"></a><!-- doxytag: member="std::basic_istream::sentry::__istream_type" ref="a9691d4cea84bfcdff2dd4a6057b5a7e2" args="" --> typedef <a class="el" href="a00250.html">basic_istream</a>< _CharT, <br class="typebreak"/> _Traits > <b>__istream_type</b> <li><a class="anchor" id="ab0024b8d06d0528fdbe022becc7b5c94"></a><!-- doxytag: member="std::basic_istream::sentry::__streambuf_type" ref="ab0024b8d06d0528fdbe022becc7b5c94" args="" --> typedef <a class="el" href="a00252.html">basic_streambuf</a><br class="typebreak"/> < _CharT, _Traits > <b>__streambuf_type</b> <li>typedef _Traits <a class="el" href="a00397.html#a6b50f58dfa1c21836890bd40ec2a3300">traits_type</a> </ul> <h2><a name="pub-methods"></a> Public Member Functions</h2> <ul> <li><a class="el" href="a00397.html#a2fc3c8f08453fb26ed43694eaeab5493">sentry</a> (<a class="el" href="a00250.html">basic_istream</a>< _CharT, _Traits > &__is, bool __noskipws=false) <li><a class="el" href="a00397.html#a127f77708e52009504b25a82c2c9505e">operator bool</a> () const </ul> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"><h3>template<typename _CharT, typename _Traits><br/> class std::basic_istream< _CharT, _Traits >::sentry</h3> <p>Performs setup work for input streams. </p> <p>Objects of this class are created before all of the standard extractors are run. It is responsible for <em>exception-safe prefix and suffix operations,</em> although only prefix actions are currently required by the standard. </p> <p>Definition at line <a class="el" href="a00912_source.html#l00638">638</a> of file <a class="el" href="a00912_source.html">istream</a>.</p> </div><hr/><h2>Member Typedef Documentation</h2> <a class="anchor" id="a6b50f58dfa1c21836890bd40ec2a3300"></a><!-- doxytag: member="std::basic_istream::sentry::traits_type" ref="a6b50f58dfa1c21836890bd40ec2a3300" args="" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename _CharT, typename _Traits> </div> <table class="memname"> <tr> <td class="memname">typedef _Traits <a class="el" href="a00250.html">std::basic_istream</a>< _CharT, _Traits >::<a class="el" href="a00397.html#a6b50f58dfa1c21836890bd40ec2a3300">sentry::traits_type</a></td> </tr> </table> </div> <div class="memdoc"> <p>Easy access to dependant types. </p> <p>Definition at line <a class="el" href="a00912_source.html#l00645">645</a> of file <a class="el" href="a00912_source.html">istream</a>.</p> </div> </div> <hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="a2fc3c8f08453fb26ed43694eaeab5493"></a><!-- doxytag: member="std::basic_istream::sentry::sentry" ref="a2fc3c8f08453fb26ed43694eaeab5493" args="(basic_istream< _CharT, _Traits > &__is, bool __noskipws=false)" --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename _CharT, typename _Traits> </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00250.html">std::basic_istream</a>< _CharT, _Traits >::sentry::sentry </td> <td>(</td> <td class="paramtype"><a class="el" href="a00250.html">basic_istream</a>< _CharT, _Traits > & </td> <td class="paramname"><em>__is</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>__noskipws</em> = <code>false</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td><code> [explicit]</code></td> </tr> </table> </div> <div class="memdoc"> <p>The constructor performs all the work. </p> <dl><dt><b>Parameters:</b></dt><dd> <table class="params"> <tr><td class="paramname">is</td><td>The input stream to guard. </td></tr> <tr><td class="paramname">noskipws</td><td>Whether to consume whitespace or not.</td></tr> </table> </dd> </dl> <p>If the stream state is good (<em>is.good()</em> is true), then the following actions are performed, otherwise the sentry state is false (<em>not okay</em>) and failbit is set in the stream state.</p> <p>The sentry's preparatory actions are:</p> <ol type="1"> <li>if the stream is tied to an output stream, <code>is.tie()-><a class="el" href="a01137.html#a2a6e4bca181719c6eeca4dc1327b1620" title="Flushes the output stream.">flush()</a></code> is called to synchronize the output sequence</li> <li>if <em>noskipws</em> is false, and <code><a class="el" href="a00528.html#a0092524de17db6438bc3bdcb914ac62b" title="Skips leading white space before certain input operations.">ios_base::skipws</a></code> is set in <code>is.flags()</code>, the sentry extracts and discards whitespace characters from the stream. The currently imbued locale is used to determine whether each character is whitespace.</li> </ol> <p>If the stream state is still good, then the sentry state becomes true (<em>okay</em>). </p> <p>Definition at line <a class="el" href="a00913_source.html#l00049">49</a> of file <a class="el" href="a00913_source.html">istream.tcc</a>.</p> <p>References <a class="el" href="a00767_source.html#l00182">std::basic_ios< _CharT, _Traits >::eof()</a>, <a class="el" href="a00909_source.html#l00339">std::ios_base::eofbit</a>, <a class="el" href="a00909_source.html#l00344">std::ios_base::failbit</a>, <a class="el" href="a00909_source.html#l00553">std::ios_base::flags()</a>, <a class="el" href="a00767_source.html#l00172">std::basic_ios< _CharT, _Traits >::good()</a>, <a class="el" href="a00909_source.html#l00347">std::ios_base::goodbit</a>, <a class="el" href="a00928_source.html#l00163">std::__ctype_abstract_base< _CharT >::is()</a>, <a class="el" href="a00767_source.html#l00313">std::basic_ios< _CharT, _Traits >::rdbuf()</a>, <a class="el" href="a00767_source.html#l00149">std::basic_ios< _CharT, _Traits >::setstate()</a>, <a class="el" href="a01071_source.html#l00318">std::basic_streambuf< _CharT, _Traits >::sgetc()</a>, <a class="el" href="a00909_source.html#l00302">std::ios_base::skipws</a>, <a class="el" href="a01071_source.html#l00278">std::basic_streambuf< _CharT, _Traits >::snextc()</a>, and <a class="el" href="a00767_source.html#l00287">std::basic_ios< _CharT, _Traits >::tie()</a>.</p> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a127f77708e52009504b25a82c2c9505e"></a><!-- doxytag: member="std::basic_istream::sentry::operator bool" ref="a127f77708e52009504b25a82c2c9505e" args="() const " --> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename _CharT, typename _Traits> </div> <table class="memname"> <tr> <td class="memname"><a class="el" href="a00250.html">std::basic_istream</a>< _CharT, _Traits >::sentry::operator bool </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const<code> [inline, explicit]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Quick status checking. </p> <dl class="return"><dt><b>Returns:</b></dt><dd>The sentry state.</dd></dl> <p>For ease of use, sentries may be converted to booleans. The return value is that of the sentry state (true == okay). </p> <p>Definition at line <a class="el" href="a00912_source.html#l00686">686</a> of file <a class="el" href="a00912_source.html">istream</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="a00912_source.html">istream</a></li> <li><a class="el" href="a00913_source.html">istream.tcc</a></li> </ul> </div> </div> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="a01137.html">std</a> </li> <li class="navelem"><a class="el" href="a00250.html">basic_istream</a> </li> <li class="navelem"><a class="el" href="a00397.html">sentry</a> </li> <li class="footer">Generated by  <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </li> </ul> </div> </body> </html>