Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > c74ab286c3d46f9b82671d206e43a74b > files > 1210

libstdc++-docs-4.6.3-2.fc15.i686.rpm

<!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++: postypes.h Source File</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('a00977.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">postypes.h</div>  </div>
</div>
<div class="contents">
<a href="a00977.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// Position types -*- C++ -*-</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="comment">// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,</span>
<a name="l00004"></a>00004 <span class="comment">// 2006, 2007, 2008, 2009, 2010</span>
<a name="l00005"></a>00005 <span class="comment">// Free Software Foundation, Inc.</span>
<a name="l00006"></a>00006 <span class="comment">//</span>
<a name="l00007"></a>00007 <span class="comment">// This file is part of the GNU ISO C++ Library.  This library is free</span>
<a name="l00008"></a>00008 <span class="comment">// software; you can redistribute it and/or modify it under the</span>
<a name="l00009"></a>00009 <span class="comment">// terms of the GNU General Public License as published by the</span>
<a name="l00010"></a>00010 <span class="comment">// Free Software Foundation; either version 3, or (at your option)</span>
<a name="l00011"></a>00011 <span class="comment">// any later version.</span>
<a name="l00012"></a>00012 
<a name="l00013"></a>00013 <span class="comment">// This library is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment">// but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment">// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00016"></a>00016 <span class="comment">// GNU General Public License for more details.</span>
<a name="l00017"></a>00017 
<a name="l00018"></a>00018 <span class="comment">// Under Section 7 of GPL version 3, you are granted additional</span>
<a name="l00019"></a>00019 <span class="comment">// permissions described in the GCC Runtime Library Exception, version</span>
<a name="l00020"></a>00020 <span class="comment">// 3.1, as published by the Free Software Foundation.</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="comment">// You should have received a copy of the GNU General Public License and</span>
<a name="l00023"></a>00023 <span class="comment">// a copy of the GCC Runtime Library Exception along with this program;</span>
<a name="l00024"></a>00024 <span class="comment">// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see</span>
<a name="l00025"></a>00025 <span class="comment">// &lt;http://www.gnu.org/licenses/&gt;.</span>
<a name="l00026"></a>00026 <span class="comment"></span>
<a name="l00027"></a>00027 <span class="comment">/** @file bits/postypes.h</span>
<a name="l00028"></a>00028 <span class="comment"> *  This is an internal header file, included by other library headers.</span>
<a name="l00029"></a>00029 <span class="comment"> *  Do not attempt to use it directly. @headername{iosfwd}</span>
<a name="l00030"></a>00030 <span class="comment"> */</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="comment">//</span>
<a name="l00033"></a>00033 <span class="comment">// ISO C++ 14882: 27.4.1 - Types</span>
<a name="l00034"></a>00034 <span class="comment">// ISO C++ 14882: 27.4.3 - Template class fpos</span>
<a name="l00035"></a>00035 <span class="comment">//</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037 <span class="preprocessor">#ifndef _GLIBCXX_POSTYPES_H</span>
<a name="l00038"></a>00038 <span class="preprocessor"></span><span class="preprocessor">#define _GLIBCXX_POSTYPES_H 1</span>
<a name="l00039"></a>00039 <span class="preprocessor"></span>
<a name="l00040"></a>00040 <span class="preprocessor">#pragma GCC system_header</span>
<a name="l00041"></a>00041 <span class="preprocessor"></span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &lt;cwchar&gt;</span> <span class="comment">// For mbstate_t</span>
<a name="l00043"></a>00043 
<a name="l00044"></a>00044 <span class="comment">// XXX If &lt;stdint.h&gt; is really needed, make sure to define the macros</span>
<a name="l00045"></a>00045 <span class="comment">// before including it, in order not to break &lt;tr1/cstdint&gt; (and &lt;cstdint&gt;</span>
<a name="l00046"></a>00046 <span class="comment">// in C++0x).  Reconsider all this as soon as possible...</span>
<a name="l00047"></a>00047 <span class="preprocessor">#if (defined(_GLIBCXX_HAVE_INT64_T) &amp;&amp; !defined(_GLIBCXX_HAVE_INT64_T_LONG) \</span>
<a name="l00048"></a>00048 <span class="preprocessor">     &amp;&amp; !defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG))</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050 <span class="preprocessor">#ifndef __STDC_LIMIT_MACROS</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor"># define _UNDEF__STDC_LIMIT_MACROS</span>
<a name="l00052"></a>00052 <span class="preprocessor"></span><span class="preprocessor"># define __STDC_LIMIT_MACROS</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00054"></a>00054 <span class="preprocessor"></span><span class="preprocessor">#ifndef __STDC_CONSTANT_MACROS</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor"># define _UNDEF__STDC_CONSTANT_MACROS</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="preprocessor"># define __STDC_CONSTANT_MACROS</span>
<a name="l00057"></a>00057 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdint.h&gt;</span> <span class="comment">// For int64_t</span>
<a name="l00059"></a>00059 <span class="preprocessor">#ifdef _UNDEF__STDC_LIMIT_MACROS</span>
<a name="l00060"></a>00060 <span class="preprocessor"></span><span class="preprocessor"># undef __STDC_LIMIT_MACROS</span>
<a name="l00061"></a>00061 <span class="preprocessor"></span><span class="preprocessor"># undef _UNDEF__STDC_LIMIT_MACROS</span>
<a name="l00062"></a>00062 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00063"></a>00063 <span class="preprocessor"></span><span class="preprocessor">#ifdef _UNDEF__STDC_CONSTANT_MACROS</span>
<a name="l00064"></a>00064 <span class="preprocessor"></span><span class="preprocessor"># undef __STDC_CONSTANT_MACROS</span>
<a name="l00065"></a>00065 <span class="preprocessor"></span><span class="preprocessor"># undef _UNDEF__STDC_CONSTANT_MACROS</span>
<a name="l00066"></a>00066 <span class="preprocessor"></span><span class="preprocessor">#endif</span>
<a name="l00067"></a>00067 <span class="preprocessor"></span>
<a name="l00068"></a>00068 <span class="preprocessor">#endif</span>
<a name="l00069"></a>00069 <span class="preprocessor"></span>
<a name="l00070"></a>00070 <span class="keyword">namespace </span>std _GLIBCXX_VISIBILITY(default)
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 _GLIBCXX_BEGIN_NAMESPACE_VERSION
<a name="l00073"></a>00073 
<a name="l00074"></a>00074   <span class="comment">// The types streamoff, streampos and wstreampos and the class</span>
<a name="l00075"></a>00075   <span class="comment">// template fpos&lt;&gt; are described in clauses 21.1.2, 21.1.3, 27.1.2,</span>
<a name="l00076"></a>00076   <span class="comment">// 27.2, 27.4.1, 27.4.3 and D.6. Despite all this verbiage, the</span>
<a name="l00077"></a>00077   <span class="comment">// behaviour of these types is mostly implementation defined or</span>
<a name="l00078"></a>00078   <span class="comment">// unspecified. The behaviour in this implementation is as noted</span>
<a name="l00079"></a>00079   <span class="comment">// below.</span>
<a name="l00080"></a>00080 <span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">  /**</span>
<a name="l00082"></a>00082 <span class="comment">   *  @brief  Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.</span>
<a name="l00083"></a>00083 <span class="comment">   *</span>
<a name="l00084"></a>00084 <span class="comment">   *  In clauses 21.1.3.1 and 27.4.1 streamoff is described as an</span>
<a name="l00085"></a>00085 <span class="comment">   *  implementation defined type.</span>
<a name="l00086"></a>00086 <span class="comment">   *  Note: In versions of GCC up to and including GCC 3.3, streamoff</span>
<a name="l00087"></a>00087 <span class="comment">   *  was typedef long.</span>
<a name="l00088"></a>00088 <span class="comment">  */</span>  
<a name="l00089"></a>00089 <span class="preprocessor">#ifdef _GLIBCXX_HAVE_INT64_T_LONG</span>
<a name="l00090"></a>00090 <span class="preprocessor"></span>  <span class="keyword">typedef</span> <span class="keywordtype">long</span>          <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>;
<a name="l00091"></a>00091 <span class="preprocessor">#elif defined(_GLIBCXX_HAVE_INT64_T_LONG_LONG)</span>
<a name="l00092"></a>00092 <span class="preprocessor"></span>  <span class="keyword">typedef</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>     <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>;
<a name="l00093"></a>00093 <span class="preprocessor">#elif defined(_GLIBCXX_HAVE_INT64_T) </span>
<a name="l00094"></a>00094 <span class="preprocessor"></span>  <span class="keyword">typedef</span> int64_t       <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>;
<a name="l00095"></a>00095 <span class="preprocessor">#else</span>
<a name="l00096"></a><a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032">00096</a> <span class="preprocessor"></span>  <span class="keyword">typedef</span> <span class="keywordtype">long</span> <span class="keywordtype">long</span>     <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>;
<a name="l00097"></a>00097 <span class="preprocessor">#endif</span>
<a name="l00098"></a>00098 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00099"></a>00099 <span class="comment">  /// Integral type for I/O operation counts and buffer sizes.</span>
<a name="l00100"></a><a class="code" href="a01137.html#a05eef5582eb5de62b76db4916f7adb84">00100</a> <span class="comment"></span>  <span class="keyword">typedef</span> ptrdiff_t <a class="code" href="a01137.html#a05eef5582eb5de62b76db4916f7adb84" title="Integral type for I/O operation counts and buffer sizes.">streamsize</a>; <span class="comment">// Signed integral type</span>
<a name="l00101"></a>00101 <span class="comment"></span>
<a name="l00102"></a>00102 <span class="comment">  /**</span>
<a name="l00103"></a>00103 <span class="comment">   *  @brief  Class representing stream positions.</span>
<a name="l00104"></a>00104 <span class="comment">   *</span>
<a name="l00105"></a>00105 <span class="comment">   *  The standard places no requirements upon the template parameter StateT.</span>
<a name="l00106"></a>00106 <span class="comment">   *  In this implementation StateT must be DefaultConstructible,</span>
<a name="l00107"></a>00107 <span class="comment">   *  CopyConstructible and Assignable.  The standard only requires that fpos</span>
<a name="l00108"></a>00108 <span class="comment">   *  should contain a member of type StateT. In this implementation it also</span>
<a name="l00109"></a>00109 <span class="comment">   *  contains an offset stored as a signed integer.</span>
<a name="l00110"></a>00110 <span class="comment">   *</span>
<a name="l00111"></a>00111 <span class="comment">   *  @param  StateT  Type passed to and returned from state().</span>
<a name="l00112"></a>00112 <span class="comment">   */</span>
<a name="l00113"></a>00113   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _StateT&gt;
<a name="l00114"></a><a class="code" href="a00476.html">00114</a>     <span class="keyword">class </span><a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>
<a name="l00115"></a>00115     {
<a name="l00116"></a>00116     <span class="keyword">private</span>:
<a name="l00117"></a>00117       <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>                 _M_off;
<a name="l00118"></a>00118       _StateT           _M_state;
<a name="l00119"></a>00119 
<a name="l00120"></a>00120     <span class="keyword">public</span>:
<a name="l00121"></a>00121       <span class="comment">// The standard doesn&#39;t require that fpos objects can be default</span>
<a name="l00122"></a>00122       <span class="comment">// constructed. This implementation provides a default</span>
<a name="l00123"></a>00123       <span class="comment">// constructor that initializes the offset to 0 and default</span>
<a name="l00124"></a>00124       <span class="comment">// constructs the state.</span>
<a name="l00125"></a>00125       <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>()
<a name="l00126"></a>00126       : _M_off(0), _M_state() { }
<a name="l00127"></a>00127 
<a name="l00128"></a>00128       <span class="comment">// The standard requires that fpos objects can be constructed</span>
<a name="l00129"></a>00129       <span class="comment">// from streamoff objects using the constructor syntax, and</span>
<a name="l00130"></a>00130       <span class="comment">// fails to give any meaningful semantics. In this</span>
<a name="l00131"></a>00131       <span class="comment">// implementation implicit conversion is also allowed, and this</span>
<a name="l00132"></a>00132       <span class="comment">// constructor stores the streamoff as the offset and default</span>
<a name="l00133"></a>00133       <span class="comment">// constructs the state.</span><span class="comment"></span>
<a name="l00134"></a>00134 <span class="comment">      /// Construct position from offset.</span>
<a name="l00135"></a><a class="code" href="a00476.html#a6816aa318c7eeb099c78a3414a2bcdfd">00135</a> <span class="comment"></span>      <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>(<a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a> __off)
<a name="l00136"></a>00136       : _M_off(__off), _M_state() { }
<a name="l00137"></a>00137 <span class="comment"></span>
<a name="l00138"></a>00138 <span class="comment">      /// Convert to streamoff.</span>
<a name="l00139"></a><a class="code" href="a00476.html#ad95708a5303b56fb6c4dd1a6839b0a85">00139</a> <span class="comment"></span>      <a class="code" href="a00476.html#ad95708a5303b56fb6c4dd1a6839b0a85" title="Convert to streamoff.">operator streamoff</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> _M_off; }
<a name="l00140"></a>00140 <span class="comment"></span>
<a name="l00141"></a>00141 <span class="comment">      /// Remember the value of @a st.</span>
<a name="l00142"></a>00142 <span class="comment"></span>      <span class="keywordtype">void</span>
<a name="l00143"></a><a class="code" href="a00476.html#a4e97b157edf8205bcc60347a86c9ed86">00143</a>       <a class="code" href="a00476.html#ab6bbadff0c7f59daf0112082bc34f0ed" title="Return the last set value of st.">state</a>(_StateT __st)
<a name="l00144"></a>00144       { _M_state = __st; }
<a name="l00145"></a>00145 <span class="comment"></span>
<a name="l00146"></a>00146 <span class="comment">      /// Return the last set value of @a st.</span>
<a name="l00147"></a>00147 <span class="comment"></span>      _StateT
<a name="l00148"></a><a class="code" href="a00476.html#ab6bbadff0c7f59daf0112082bc34f0ed">00148</a>       <a class="code" href="a00476.html#ab6bbadff0c7f59daf0112082bc34f0ed" title="Return the last set value of st.">state</a>()<span class="keyword"> const</span>
<a name="l00149"></a>00149 <span class="keyword">      </span>{ <span class="keywordflow">return</span> _M_state; }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151       <span class="comment">// The standard requires that this operator must be defined, but</span>
<a name="l00152"></a>00152       <span class="comment">// gives no semantics. In this implementation it just adds its</span>
<a name="l00153"></a>00153       <span class="comment">// argument to the stored offset and returns *this.</span><span class="comment"></span>
<a name="l00154"></a>00154 <span class="comment">      /// Add offset to this position.</span>
<a name="l00155"></a>00155 <span class="comment"></span>      <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>&amp;
<a name="l00156"></a><a class="code" href="a00476.html#a82884338bf22e5b2e47088240ee3603c">00156</a>       <a class="code" href="a00476.html#a82884338bf22e5b2e47088240ee3603c" title="Add offset to this position.">operator+=</a>(<a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a> __off)
<a name="l00157"></a>00157       {
<a name="l00158"></a>00158     _M_off += __off;
<a name="l00159"></a>00159     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00160"></a>00160       }
<a name="l00161"></a>00161 
<a name="l00162"></a>00162       <span class="comment">// The standard requires that this operator must be defined, but</span>
<a name="l00163"></a>00163       <span class="comment">// gives no semantics. In this implementation it just subtracts</span>
<a name="l00164"></a>00164       <span class="comment">// its argument from the stored offset and returns *this.</span><span class="comment"></span>
<a name="l00165"></a>00165 <span class="comment">      /// Subtract offset from this position.</span>
<a name="l00166"></a>00166 <span class="comment"></span>      <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>&amp;
<a name="l00167"></a><a class="code" href="a00476.html#af98737e3474e12ecb9d40f19bea2ea9e">00167</a>       <a class="code" href="a00476.html#af98737e3474e12ecb9d40f19bea2ea9e" title="Subtract offset from this position.">operator-=</a>(<a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a> __off)
<a name="l00168"></a>00168       {
<a name="l00169"></a>00169     _M_off -= __off;
<a name="l00170"></a>00170     <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00171"></a>00171       }
<a name="l00172"></a>00172 
<a name="l00173"></a>00173       <span class="comment">// The standard requires that this operator must be defined, but</span>
<a name="l00174"></a>00174       <span class="comment">// defines its semantics only in terms of operator-. In this</span>
<a name="l00175"></a>00175       <span class="comment">// implementation it constructs a copy of *this, adds the</span>
<a name="l00176"></a>00176       <span class="comment">// argument to that copy using operator+= and then returns the</span>
<a name="l00177"></a>00177       <span class="comment">// copy.</span><span class="comment"></span>
<a name="l00178"></a>00178 <span class="comment">      /// Add position and offset.</span>
<a name="l00179"></a>00179 <span class="comment"></span>      <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>
<a name="l00180"></a><a class="code" href="a00476.html#a3949b302037f17a9e00dd665acaa2972">00180</a>       <a class="code" href="a00476.html#a3949b302037f17a9e00dd665acaa2972" title="Add position and offset.">operator+</a>(<a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a> __off)<span class="keyword"> const</span>
<a name="l00181"></a>00181 <span class="keyword">      </span>{
<a name="l00182"></a>00182     <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a> __pos(*<span class="keyword">this</span>);
<a name="l00183"></a>00183     __pos += __off;
<a name="l00184"></a>00184     <span class="keywordflow">return</span> __pos;
<a name="l00185"></a>00185       }
<a name="l00186"></a>00186 
<a name="l00187"></a>00187       <span class="comment">// The standard requires that this operator must be defined, but</span>
<a name="l00188"></a>00188       <span class="comment">// defines its semantics only in terms of operator+. In this</span>
<a name="l00189"></a>00189       <span class="comment">// implementation it constructs a copy of *this, subtracts the</span>
<a name="l00190"></a>00190       <span class="comment">// argument from that copy using operator-= and then returns the</span>
<a name="l00191"></a>00191       <span class="comment">// copy.</span><span class="comment"></span>
<a name="l00192"></a>00192 <span class="comment">      /// Subtract offset from position.</span>
<a name="l00193"></a>00193 <span class="comment"></span>      <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>
<a name="l00194"></a><a class="code" href="a00476.html#aab00912dae322c363fc4bbf0ac49c9e8">00194</a>       <a class="code" href="a00476.html#aab00912dae322c363fc4bbf0ac49c9e8" title="Subtract offset from position.">operator-</a>(<a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a> __off)<span class="keyword"> const</span>
<a name="l00195"></a>00195 <span class="keyword">      </span>{
<a name="l00196"></a>00196     <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a> __pos(*<span class="keyword">this</span>);
<a name="l00197"></a>00197     __pos -= __off;
<a name="l00198"></a>00198     <span class="keywordflow">return</span> __pos;
<a name="l00199"></a>00199       }
<a name="l00200"></a>00200 
<a name="l00201"></a>00201       <span class="comment">// The standard requires that this operator must be defined, but</span>
<a name="l00202"></a>00202       <span class="comment">// defines its semantics only in terms of operator+. In this</span>
<a name="l00203"></a>00203       <span class="comment">// implementation it returns the difference between the offset</span>
<a name="l00204"></a>00204       <span class="comment">// stored in *this and in the argument.</span><span class="comment"></span>
<a name="l00205"></a>00205 <span class="comment">      /// Subtract position to return offset.</span>
<a name="l00206"></a>00206 <span class="comment"></span>      <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>
<a name="l00207"></a><a class="code" href="a00476.html#a26e69847311fe45236a5a4373976fe9e">00207</a>       <a class="code" href="a00476.html#aab00912dae322c363fc4bbf0ac49c9e8" title="Subtract offset from position.">operator-</a>(<span class="keyword">const</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos</a>&amp; __other)<span class="keyword"> const</span>
<a name="l00208"></a>00208 <span class="keyword">      </span>{ <span class="keywordflow">return</span> _M_off - __other._M_off; }
<a name="l00209"></a>00209     };
<a name="l00210"></a>00210 
<a name="l00211"></a>00211   <span class="comment">// The standard only requires that operator== must be an</span>
<a name="l00212"></a>00212   <span class="comment">// equivalence relation. In this implementation two fpos&lt;StateT&gt;</span>
<a name="l00213"></a>00213   <span class="comment">// objects belong to the same equivalence class if the contained</span>
<a name="l00214"></a>00214   <span class="comment">// offsets compare equal.</span><span class="comment"></span>
<a name="l00215"></a>00215 <span class="comment">  /// Test if equivalent to another position.</span>
<a name="l00216"></a>00216 <span class="comment"></span>  <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _StateT&gt;
<a name="l00217"></a>00217     <span class="keyword">inline</span> <span class="keywordtype">bool</span>
<a name="l00218"></a><a class="code" href="a01137.html#a288c42d45d87d4e08426eafd89784cd4">00218</a>     operator==(<span class="keyword">const</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;_StateT&gt;</a>&amp; __lhs, <span class="keyword">const</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;_StateT&gt;</a>&amp; __rhs)
<a name="l00219"></a>00219     { <span class="keywordflow">return</span> <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>(__lhs) == <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>(__rhs); }
<a name="l00220"></a>00220 
<a name="l00221"></a>00221   <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _StateT&gt;
<a name="l00222"></a>00222     <span class="keyword">inline</span> <span class="keywordtype">bool</span>
<a name="l00223"></a>00223     operator!=(<span class="keyword">const</span> fpos&lt;_StateT&gt;&amp; __lhs, <span class="keyword">const</span> fpos&lt;_StateT&gt;&amp; __rhs)
<a name="l00224"></a>00224     { <span class="keywordflow">return</span> <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>(__lhs) != <a class="code" href="a01137.html#a48649c5c32f0251572b366063ee93032" title="Type used by fpos, char_traits&lt;char&gt;, and char_traits&lt;wchar_t&gt;.">streamoff</a>(__rhs); }
<a name="l00225"></a>00225 
<a name="l00226"></a>00226   <span class="comment">// Clauses 21.1.3.1 and 21.1.3.2 describe streampos and wstreampos</span>
<a name="l00227"></a>00227   <span class="comment">// as implementation defined types, but clause 27.2 requires that</span>
<a name="l00228"></a>00228   <span class="comment">// they must both be typedefs for fpos&lt;mbstate_t&gt;</span><span class="comment"></span>
<a name="l00229"></a>00229 <span class="comment">  /// File position for char streams.</span>
<a name="l00230"></a><a class="code" href="a01137.html#a5894cfd4b461e2d4ed3b38402ff59c89">00230</a> <span class="comment"></span>  <span class="keyword">typedef</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;mbstate_t&gt;</a> <a class="code" href="a01137.html#a5894cfd4b461e2d4ed3b38402ff59c89" title="File position for char streams.">streampos</a>;<span class="comment"></span>
<a name="l00231"></a>00231 <span class="comment">  /// File position for wchar_t streams.</span>
<a name="l00232"></a><a class="code" href="a01137.html#a4c451a38ccf44b2ce7d8aadf02bb6309">00232</a> <span class="comment"></span>  <span class="keyword">typedef</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;mbstate_t&gt;</a> <a class="code" href="a01137.html#a4c451a38ccf44b2ce7d8aadf02bb6309" title="File position for wchar_t streams.">wstreampos</a>;
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 <span class="preprocessor">#ifdef __GXX_EXPERIMENTAL_CXX0X__</span>
<a name="l00235"></a>00235 <span class="preprocessor"></span><span class="comment">  /// File position for char16_t streams.</span>
<a name="l00236"></a><a class="code" href="a01137.html#a96c9446fbbc8c9cab8ad5e1447e2d670">00236</a> <span class="comment"></span>  <span class="keyword">typedef</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;mbstate_t&gt;</a> <a class="code" href="a01137.html#a96c9446fbbc8c9cab8ad5e1447e2d670" title="File position for char16_t streams.">u16streampos</a>;<span class="comment"></span>
<a name="l00237"></a>00237 <span class="comment">  /// File position for char32_t streams.</span>
<a name="l00238"></a><a class="code" href="a01137.html#a195e60ba4b6b786c2e0182d06c2ebbbb">00238</a> <span class="comment"></span>  <span class="keyword">typedef</span> <a class="code" href="a00476.html" title="Class representing stream positions.">fpos&lt;mbstate_t&gt;</a> <a class="code" href="a01137.html#a195e60ba4b6b786c2e0182d06c2ebbbb" title="File position for char32_t streams.">u32streampos</a>;
<a name="l00239"></a>00239 <span class="preprocessor">#endif</span>
<a name="l00240"></a>00240 <span class="preprocessor"></span>
<a name="l00241"></a>00241 _GLIBCXX_END_NAMESPACE_VERSION
<a name="l00242"></a>00242 } <span class="comment">// namespace</span>
<a name="l00243"></a>00243 
<a name="l00244"></a>00244 <span class="preprocessor">#endif</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00977.html">postypes.h</a>      </li>
      <li class="footer">Generated by&#160;
<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>