Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:32

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___IOS_FPOS_H
0011 #define _LIBCPP___CXX03___IOS_FPOS_H
0012 
0013 #include <__cxx03/__config>
0014 #include <__cxx03/__fwd/ios.h>
0015 
0016 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0017 #  pragma GCC system_header
0018 #endif
0019 
0020 _LIBCPP_BEGIN_NAMESPACE_STD
0021 
0022 template <class _StateT>
0023 class _LIBCPP_TEMPLATE_VIS fpos {
0024 private:
0025   _StateT __st_;
0026   streamoff __off_;
0027 
0028 public:
0029   _LIBCPP_HIDE_FROM_ABI fpos(streamoff __off = streamoff()) : __st_(), __off_(__off) {}
0030 
0031   _LIBCPP_HIDE_FROM_ABI operator streamoff() const { return __off_; }
0032 
0033   _LIBCPP_HIDE_FROM_ABI _StateT state() const { return __st_; }
0034   _LIBCPP_HIDE_FROM_ABI void state(_StateT __st) { __st_ = __st; }
0035 
0036   _LIBCPP_HIDE_FROM_ABI fpos& operator+=(streamoff __off) {
0037     __off_ += __off;
0038     return *this;
0039   }
0040 
0041   _LIBCPP_HIDE_FROM_ABI fpos operator+(streamoff __off) const {
0042     fpos __t(*this);
0043     __t += __off;
0044     return __t;
0045   }
0046 
0047   _LIBCPP_HIDE_FROM_ABI fpos& operator-=(streamoff __off) {
0048     __off_ -= __off;
0049     return *this;
0050   }
0051 
0052   _LIBCPP_HIDE_FROM_ABI fpos operator-(streamoff __off) const {
0053     fpos __t(*this);
0054     __t -= __off;
0055     return __t;
0056   }
0057 };
0058 
0059 template <class _StateT>
0060 inline _LIBCPP_HIDE_FROM_ABI streamoff operator-(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
0061   return streamoff(__x) - streamoff(__y);
0062 }
0063 
0064 template <class _StateT>
0065 inline _LIBCPP_HIDE_FROM_ABI bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
0066   return streamoff(__x) == streamoff(__y);
0067 }
0068 
0069 template <class _StateT>
0070 inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y) {
0071   return streamoff(__x) != streamoff(__y);
0072 }
0073 
0074 _LIBCPP_END_NAMESPACE_STD
0075 
0076 #endif // _LIBCPP___CXX03___IOS_FPOS_H