<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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"/> <meta http-equiv="X-UA-Compatible" content="IE=9"/> <meta name="generator" content="Doxygen 1.8.15"/> <meta name="viewport" content="width=device-width, initial-scale=1"/> <title>libstdc++: std::basic_istream< _CharT, _Traits >::sentry Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link href="navtree.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="resize.js"></script> <script type="text/javascript" src="navtreedata.js"></script> <script type="text/javascript" src="navtree.js"></script> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(initResizable); /* @license-end */</script> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div, it is closed by doxygen! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td id="projectalign" style="padding-left: 0.5em;"> <div id="projectname">libstdc++ </div> </td> </tr> </tbody> </table> </div> <!-- end header part --> <!-- Generated by Doxygen 1.8.15 --> </div><!-- top --> <div id="side-nav" class="ui-resizable side-nav-resizable"> <div id="nav-tree"> <div id="nav-tree-contents"> <div id="nav-sync" class="sync"></div> </div> </div> <div id="splitbar" style="-moz-user-select:none;" class="ui-resizable-handle"> </div> </div> <script type="text/javascript"> /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */ $(document).ready(function(){initNavTree('a02492.html','');}); /* @license-end */ </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> | <a href="a02489.html">List of all members</a> </div> <div class="headertitle"> <div class="title">std::basic_istream< _CharT, _Traits >::sentry Class Reference</div> </div> </div><!--header--> <div class="contents"> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a> Public Types</h2></td></tr> <tr class="memitem:a2caa06031c896dd0edc65f3a83214264"><td class="memItemLeft" align="right" valign="top"><a id="a2caa06031c896dd0edc65f3a83214264"></a> typedef <a class="el" href="a05856.html">__istream_type::__ctype_type</a> </td><td class="memItemRight" valign="bottom"><b>__ctype_type</b></td></tr> <tr class="separator:a2caa06031c896dd0edc65f3a83214264"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a282a36ad246007f07603dcd0cf7bff64"><td class="memItemLeft" align="right" valign="top"><a id="a282a36ad246007f07603dcd0cf7bff64"></a> typedef _Traits::int_type </td><td class="memItemRight" valign="bottom"><b>__int_type</b></td></tr> <tr class="separator:a282a36ad246007f07603dcd0cf7bff64"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9691d4cea84bfcdff2dd4a6057b5a7e2"><td class="memItemLeft" align="right" valign="top"><a id="a9691d4cea84bfcdff2dd4a6057b5a7e2"></a> typedef <a class="el" href="a02456.html">basic_istream</a>< _CharT, _Traits > </td><td class="memItemRight" valign="bottom"><b>__istream_type</b></td></tr> <tr class="separator:a9691d4cea84bfcdff2dd4a6057b5a7e2"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ab0024b8d06d0528fdbe022becc7b5c94"><td class="memItemLeft" align="right" valign="top"><a id="ab0024b8d06d0528fdbe022becc7b5c94"></a> typedef <a class="el" href="a02452.html">basic_streambuf</a>< _CharT, _Traits > </td><td class="memItemRight" valign="bottom"><b>__streambuf_type</b></td></tr> <tr class="separator:ab0024b8d06d0528fdbe022becc7b5c94"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a6b50f58dfa1c21836890bd40ec2a3300"><td class="memItemLeft" align="right" valign="top">typedef _Traits </td><td class="memItemRight" valign="bottom"><a class="el" href="a02492.html#a6b50f58dfa1c21836890bd40ec2a3300">traits_type</a></td></tr> <tr class="separator:a6b50f58dfa1c21836890bd40ec2a3300"><td class="memSeparator" colspan="2"> </td></tr> </table><table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a2fc3c8f08453fb26ed43694eaeab5493"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a02492.html#a2fc3c8f08453fb26ed43694eaeab5493">sentry</a> (<a class="el" href="a02456.html">basic_istream</a>< _CharT, _Traits > &__is, bool __noskipws=false)</td></tr> <tr class="separator:a2fc3c8f08453fb26ed43694eaeab5493"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a9fa4ff4cc39750195997c8d7e5e800c6"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="a02492.html#a9fa4ff4cc39750195997c8d7e5e800c6">operator bool</a> () const</td></tr> <tr class="separator:a9fa4ff4cc39750195997c8d7e5e800c6"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">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 class="definition">Definition at line <a class="el" href="a00089_source.html#l00686">686</a> of file <a class="el" href="a00089_source.html">istream</a>.</p> </div><h2 class="groupheader">Member Typedef Documentation</h2> <a id="a6b50f58dfa1c21836890bd40ec2a3300"></a> <h2 class="memtitle"><span class="permalink"><a href="#a6b50f58dfa1c21836890bd40ec2a3300">◆ </a></span>traits_type</h2> <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="a02456.html">std::basic_istream</a>< _CharT, _Traits >::<a class="el" href="a02492.html#a6b50f58dfa1c21836890bd40ec2a3300">sentry::traits_type</a></td> </tr> </table> </div><div class="memdoc"> <p>Easy access to dependent types. </p> <p class="definition">Definition at line <a class="el" href="a00089_source.html#l00693">693</a> of file <a class="el" href="a00089_source.html">istream</a>.</p> </div> </div> <h2 class="groupheader">Constructor & Destructor Documentation</h2> <a id="a2fc3c8f08453fb26ed43694eaeab5493"></a> <h2 class="memtitle"><span class="permalink"><a href="#a2fc3c8f08453fb26ed43694eaeab5493">◆ </a></span>sentry()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename _CharT, typename _Traits> </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a02456.html">std::basic_istream</a>< _CharT, _Traits >::sentry::sentry </td> <td>(</td> <td class="paramtype"><a class="el" href="a02456.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></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">explicit</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>The constructor performs all the work. </p> <dl class="params"><dt>Parameters</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()->flush()</code> is called to synchronize the output sequence</li> <li>if <em>__noskipws</em> is false, and <code>ios_base::skipws</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 class="definition">Definition at line <a class="el" href="a00386_source.html#l00047">47</a> of file <a class="el" href="a00386_source.html">istream.tcc</a>.</p> <p class="reference">References <a class="el" href="a00284_source.html#l00180">std::basic_ios< _CharT, _Traits >::good()</a>, and <a class="el" href="a00383_source.html#l00413">std::ios_base::goodbit</a>.</p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a id="a9fa4ff4cc39750195997c8d7e5e800c6"></a> <h2 class="memtitle"><span class="permalink"><a href="#a9fa4ff4cc39750195997c8d7e5e800c6">◆ </a></span>operator bool()</h2> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<typename _CharT, typename _Traits> </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname"><a class="el" href="a02456.html">std::basic_istream</a>< _CharT, _Traits >::sentry::operator bool </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Quick status checking. </p> <dl class="section return"><dt>Returns</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 class="definition">Definition at line <a class="el" href="a00089_source.html#l00734">734</a> of file <a class="el" href="a00089_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="a00089_source.html">istream</a></li> <li><a class="el" href="a00386_source.html">istream.tcc</a></li> </ul> </div><!-- contents --> </div><!-- doc-content --> <!-- start footer part --> <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> <ul> <li class="navelem"><a class="el" href="a01538.html">std</a></li><li class="navelem"><a class="el" href="a02456.html">basic_istream</a></li><li class="navelem"><a class="el" href="a02492.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.8.15 </li> </ul> </div> </body> </html>