Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/c++/v1/ios is written in an unsupported language. File is not indexed.

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_IOS
0011 #define _LIBCPP_IOS
0012 
0013 /*
0014     ios synopsis
0015 
0016 #include <iosfwd>
0017 
0018 namespace std
0019 {
0020 
0021 typedef OFF_T streamoff;
0022 typedef SZ_T streamsize;
0023 template <class stateT> class fpos;
0024 
0025 class ios_base
0026 {
0027 public:
0028     class failure;
0029 
0030     typedef T1 fmtflags;
0031     static constexpr fmtflags boolalpha;
0032     static constexpr fmtflags dec;
0033     static constexpr fmtflags fixed;
0034     static constexpr fmtflags hex;
0035     static constexpr fmtflags internal;
0036     static constexpr fmtflags left;
0037     static constexpr fmtflags oct;
0038     static constexpr fmtflags right;
0039     static constexpr fmtflags scientific;
0040     static constexpr fmtflags showbase;
0041     static constexpr fmtflags showpoint;
0042     static constexpr fmtflags showpos;
0043     static constexpr fmtflags skipws;
0044     static constexpr fmtflags unitbuf;
0045     static constexpr fmtflags uppercase;
0046     static constexpr fmtflags adjustfield;
0047     static constexpr fmtflags basefield;
0048     static constexpr fmtflags floatfield;
0049 
0050     typedef T2 iostate;
0051     static constexpr iostate badbit;
0052     static constexpr iostate eofbit;
0053     static constexpr iostate failbit;
0054     static constexpr iostate goodbit;
0055 
0056     typedef T3 openmode;
0057     static constexpr openmode app;
0058     static constexpr openmode ate;
0059     static constexpr openmode binary;
0060     static constexpr openmode in;
0061     static constexpr openmode noreplace; // since C++23
0062     static constexpr openmode out;
0063     static constexpr openmode trunc;
0064 
0065     typedef T4 seekdir;
0066     static constexpr seekdir beg;
0067     static constexpr seekdir cur;
0068     static constexpr seekdir end;
0069 
0070     class Init;
0071 
0072     // 27.5.2.2 fmtflags state:
0073     fmtflags flags() const;
0074     fmtflags flags(fmtflags fmtfl);
0075     fmtflags setf(fmtflags fmtfl);
0076     fmtflags setf(fmtflags fmtfl, fmtflags mask);
0077     void unsetf(fmtflags mask);
0078 
0079     streamsize precision() const;
0080     streamsize precision(streamsize prec);
0081     streamsize width() const;
0082     streamsize width(streamsize wide);
0083 
0084     // 27.5.2.3 locales:
0085     locale imbue(const locale& loc);
0086     locale getloc() const;
0087 
0088     // 27.5.2.5 storage:
0089     static int xalloc();
0090     long& iword(int index);
0091     void*& pword(int index);
0092 
0093     // destructor
0094     virtual ~ios_base();
0095 
0096     // 27.5.2.6 callbacks;
0097     enum event { erase_event, imbue_event, copyfmt_event };
0098     typedef void (*event_callback)(event, ios_base&, int index);
0099     void register_callback(event_callback fn, int index);
0100 
0101     ios_base(const ios_base&) = delete;
0102     ios_base& operator=(const ios_base&) = delete;
0103 
0104     static bool sync_with_stdio(bool sync = true);
0105 
0106 protected:
0107     ios_base();
0108 };
0109 
0110 template <class charT, class traits = char_traits<charT> >
0111 class basic_ios
0112     : public ios_base
0113 {
0114 public:
0115     // types:
0116     typedef charT char_type;
0117     typedef typename traits::int_type int_type;  // removed in C++17
0118     typedef typename traits::pos_type pos_type;  // removed in C++17
0119     typedef typename traits::off_type off_type;  // removed in C++17
0120     typedef traits traits_type;
0121 
0122     operator unspecified-bool-type() const;
0123     bool operator!() const;
0124     iostate rdstate() const;
0125     void clear(iostate state = goodbit);
0126     void setstate(iostate state);
0127     bool good() const;
0128     bool eof() const;
0129     bool fail() const;
0130     bool bad() const;
0131 
0132     iostate exceptions() const;
0133     void exceptions(iostate except);
0134 
0135     // 27.5.4.1 Constructor/destructor:
0136     explicit basic_ios(basic_streambuf<charT,traits>* sb);
0137     virtual ~basic_ios();
0138 
0139     // 27.5.4.2 Members:
0140     basic_ostream<charT,traits>* tie() const;
0141     basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
0142 
0143     basic_streambuf<charT,traits>* rdbuf() const;
0144     basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
0145 
0146     basic_ios& copyfmt(const basic_ios& rhs);
0147 
0148     char_type fill() const;
0149     char_type fill(char_type ch);
0150 
0151     locale imbue(const locale& loc);
0152 
0153     char narrow(char_type c, char dfault) const;
0154     char_type widen(char c) const;
0155 
0156     basic_ios(const basic_ios& ) = delete;
0157     basic_ios& operator=(const basic_ios&) = delete;
0158 
0159 protected:
0160     basic_ios();
0161     void init(basic_streambuf<charT,traits>* sb);
0162     void move(basic_ios& rhs);
0163     void swap(basic_ios& rhs) noexcept;
0164     void set_rdbuf(basic_streambuf<charT, traits>* sb);
0165 };
0166 
0167 // 27.5.5, manipulators:
0168 ios_base& boolalpha (ios_base& str);
0169 ios_base& noboolalpha(ios_base& str);
0170 ios_base& showbase (ios_base& str);
0171 ios_base& noshowbase (ios_base& str);
0172 ios_base& showpoint (ios_base& str);
0173 ios_base& noshowpoint(ios_base& str);
0174 ios_base& showpos (ios_base& str);
0175 ios_base& noshowpos (ios_base& str);
0176 ios_base& skipws (ios_base& str);
0177 ios_base& noskipws (ios_base& str);
0178 ios_base& uppercase (ios_base& str);
0179 ios_base& nouppercase(ios_base& str);
0180 ios_base& unitbuf (ios_base& str);
0181 ios_base& nounitbuf (ios_base& str);
0182 
0183 // 27.5.5.2 adjustfield:
0184 ios_base& internal (ios_base& str);
0185 ios_base& left (ios_base& str);
0186 ios_base& right (ios_base& str);
0187 
0188 // 27.5.5.3 basefield:
0189 ios_base& dec (ios_base& str);
0190 ios_base& hex (ios_base& str);
0191 ios_base& oct (ios_base& str);
0192 
0193 // 27.5.5.4 floatfield:
0194 ios_base& fixed (ios_base& str);
0195 ios_base& scientific (ios_base& str);
0196 ios_base& hexfloat (ios_base& str);
0197 ios_base& defaultfloat(ios_base& str);
0198 
0199 // 27.5.5.5 error reporting:
0200 enum class io_errc
0201 {
0202     stream = 1
0203 };
0204 
0205 concept_map ErrorCodeEnum<io_errc> { };
0206 error_code make_error_code(io_errc e) noexcept;
0207 error_condition make_error_condition(io_errc e) noexcept;
0208 storage-class-specifier const error_category& iostream_category() noexcept;
0209 
0210 }  // std
0211 
0212 */
0213 
0214 #if __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0215 #  include <__cxx03/ios>
0216 #else
0217 #  include <__config>
0218 
0219 #  if _LIBCPP_HAS_LOCALIZATION
0220 
0221 #    include <__fwd/ios.h>
0222 #    include <__ios/fpos.h>
0223 #    include <__locale>
0224 #    include <__memory/addressof.h>
0225 #    include <__system_error/error_category.h>
0226 #    include <__system_error/error_code.h>
0227 #    include <__system_error/error_condition.h>
0228 #    include <__system_error/system_error.h>
0229 #    include <__utility/swap.h>
0230 #    include <__verbose_abort>
0231 #    include <version>
0232 
0233 // standard-mandated includes
0234 
0235 // [ios.syn]
0236 #    include <iosfwd>
0237 
0238 #    if _LIBCPP_HAS_ATOMIC_HEADER
0239 #      include <__atomic/atomic.h> // for __xindex_
0240 #    endif
0241 
0242 #    if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0243 #      pragma GCC system_header
0244 #    endif
0245 
0246 _LIBCPP_PUSH_MACROS
0247 #    include <__undef_macros>
0248 
0249 _LIBCPP_BEGIN_NAMESPACE_STD
0250 
0251 typedef ptrdiff_t streamsize;
0252 
0253 class _LIBCPP_EXPORTED_FROM_ABI ios_base {
0254 public:
0255   class _LIBCPP_EXPORTED_FROM_ABI failure;
0256 
0257   typedef unsigned int fmtflags;
0258   static const fmtflags boolalpha   = 0x0001;
0259   static const fmtflags dec         = 0x0002;
0260   static const fmtflags fixed       = 0x0004;
0261   static const fmtflags hex         = 0x0008;
0262   static const fmtflags internal    = 0x0010;
0263   static const fmtflags left        = 0x0020;
0264   static const fmtflags oct         = 0x0040;
0265   static const fmtflags right       = 0x0080;
0266   static const fmtflags scientific  = 0x0100;
0267   static const fmtflags showbase    = 0x0200;
0268   static const fmtflags showpoint   = 0x0400;
0269   static const fmtflags showpos     = 0x0800;
0270   static const fmtflags skipws      = 0x1000;
0271   static const fmtflags unitbuf     = 0x2000;
0272   static const fmtflags uppercase   = 0x4000;
0273   static const fmtflags adjustfield = left | right | internal;
0274   static const fmtflags basefield   = dec | oct | hex;
0275   static const fmtflags floatfield  = scientific | fixed;
0276 
0277   typedef unsigned int iostate;
0278   static const iostate badbit  = 0x1;
0279   static const iostate eofbit  = 0x2;
0280   static const iostate failbit = 0x4;
0281   static const iostate goodbit = 0x0;
0282 
0283   typedef unsigned int openmode;
0284   static const openmode app    = 0x01;
0285   static const openmode ate    = 0x02;
0286   static const openmode binary = 0x04;
0287   static const openmode in     = 0x08;
0288   static const openmode out    = 0x10;
0289   static const openmode trunc  = 0x20;
0290 #    if _LIBCPP_STD_VER >= 23
0291   static const openmode noreplace = 0x40;
0292 #    endif
0293 
0294   enum seekdir { beg, cur, end };
0295 
0296 #    if _LIBCPP_STD_VER <= 14
0297   typedef iostate io_state;
0298   typedef openmode open_mode;
0299   typedef seekdir seek_dir;
0300 
0301   typedef std::streamoff streamoff;
0302   typedef std::streampos streampos;
0303 #    endif
0304 
0305   class _LIBCPP_EXPORTED_FROM_ABI Init;
0306 
0307   // 27.5.2.2 fmtflags state:
0308   _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
0309   _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
0310   _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
0311   _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
0312   _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
0313 
0314   _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
0315   _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
0316   _LIBCPP_HIDE_FROM_ABI streamsize width() const;
0317   _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
0318 
0319   // 27.5.2.3 locales:
0320   locale imbue(const locale& __loc);
0321   locale getloc() const;
0322 
0323   // 27.5.2.5 storage:
0324   static int xalloc();
0325   long& iword(int __index);
0326   void*& pword(int __index);
0327 
0328   // destructor
0329   virtual ~ios_base();
0330 
0331   // 27.5.2.6 callbacks;
0332   enum event { erase_event, imbue_event, copyfmt_event };
0333   typedef void (*event_callback)(event, ios_base&, int __index);
0334   void register_callback(event_callback __fn, int __index);
0335 
0336   ios_base(const ios_base&)            = delete;
0337   ios_base& operator=(const ios_base&) = delete;
0338 
0339   static bool sync_with_stdio(bool __sync = true);
0340 
0341   _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
0342   void clear(iostate __state = goodbit);
0343   _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
0344 
0345   _LIBCPP_HIDE_FROM_ABI bool good() const;
0346   _LIBCPP_HIDE_FROM_ABI bool eof() const;
0347   _LIBCPP_HIDE_FROM_ABI bool fail() const;
0348   _LIBCPP_HIDE_FROM_ABI bool bad() const;
0349 
0350   _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
0351   _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
0352 
0353   void __set_badbit_and_consider_rethrow();
0354   void __set_failbit_and_consider_rethrow();
0355 
0356   _LIBCPP_HIDE_FROM_ABI void __setstate_nothrow(iostate __state) {
0357     if (__rdbuf_)
0358       __rdstate_ |= __state;
0359     else
0360       __rdstate_ |= __state | ios_base::badbit;
0361   }
0362 
0363 protected:
0364   _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(nullptr) {
0365     // Purposefully does no initialization
0366     //
0367     // Except for the locale, this is a sentinel to avoid destroying
0368     // an uninitialized object. See
0369     // test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp
0370     // for the details.
0371   }
0372 
0373   void init(void* __sb);
0374   _LIBCPP_HIDE_FROM_ABI void* rdbuf() const { return __rdbuf_; }
0375 
0376   _LIBCPP_HIDE_FROM_ABI void rdbuf(void* __sb) {
0377     __rdbuf_ = __sb;
0378     clear();
0379   }
0380 
0381   void __call_callbacks(event);
0382   void copyfmt(const ios_base&);
0383   void move(ios_base&);
0384   void swap(ios_base&) _NOEXCEPT;
0385 
0386   _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; }
0387 
0388 private:
0389   // All data members must be scalars
0390   fmtflags __fmtflags_;
0391   streamsize __precision_;
0392   streamsize __width_;
0393   iostate __rdstate_;
0394   iostate __exceptions_;
0395   void* __rdbuf_;
0396   void* __loc_;
0397   event_callback* __fn_;
0398   int* __index_;
0399   size_t __event_size_;
0400   size_t __event_cap_;
0401 // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
0402 // enabled with clang.
0403 #    if _LIBCPP_HAS_C_ATOMIC_IMP && _LIBCPP_HAS_THREADS
0404   static atomic<int> __xindex_;
0405 #    else
0406   static int __xindex_;
0407 #    endif
0408   long* __iarray_;
0409   size_t __iarray_size_;
0410   size_t __iarray_cap_;
0411   void** __parray_;
0412   size_t __parray_size_;
0413   size_t __parray_cap_;
0414 };
0415 
0416 // enum class io_errc
0417 _LIBCPP_DECLARE_STRONG_ENUM(io_errc){stream = 1};
0418 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
0419 
0420 template <>
0421 struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {};
0422 
0423 #    ifdef _LIBCPP_CXX03_LANG
0424 template <>
0425 struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {};
0426 #    endif
0427 
0428 _LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
0429 
0430 inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
0431   return error_code(static_cast<int>(__e), iostream_category());
0432 }
0433 
0434 inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
0435   return error_condition(static_cast<int>(__e), iostream_category());
0436 }
0437 
0438 class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure : public system_error {
0439 public:
0440   explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
0441   explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
0442   _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
0443   ~failure() _NOEXCEPT override;
0444 };
0445 
0446 [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
0447 #    if _LIBCPP_HAS_EXCEPTIONS
0448   throw ios_base::failure(__msg);
0449 #    else
0450   _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
0451 #    endif
0452 }
0453 
0454 class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init {
0455 public:
0456   Init();
0457   ~Init();
0458 };
0459 
0460 // fmtflags
0461 
0462 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags() const { return __fmtflags_; }
0463 
0464 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) {
0465   fmtflags __r = __fmtflags_;
0466   __fmtflags_  = __fmtfl;
0467   return __r;
0468 }
0469 
0470 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) {
0471   fmtflags __r = __fmtflags_;
0472   __fmtflags_ |= __fmtfl;
0473   return __r;
0474 }
0475 
0476 inline _LIBCPP_HIDE_FROM_ABI void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; }
0477 
0478 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) {
0479   fmtflags __r = __fmtflags_;
0480   unsetf(__mask);
0481   __fmtflags_ |= __fmtfl & __mask;
0482   return __r;
0483 }
0484 
0485 // precision
0486 
0487 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision() const { return __precision_; }
0488 
0489 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision(streamsize __prec) {
0490   streamsize __r = __precision_;
0491   __precision_   = __prec;
0492   return __r;
0493 }
0494 
0495 // width
0496 
0497 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width() const { return __width_; }
0498 
0499 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width(streamsize __wide) {
0500   streamsize __r = __width_;
0501   __width_       = __wide;
0502   return __r;
0503 }
0504 
0505 // iostate
0506 
0507 inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::rdstate() const { return __rdstate_; }
0508 
0509 inline _LIBCPP_HIDE_FROM_ABI void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); }
0510 
0511 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::good() const { return __rdstate_ == 0; }
0512 
0513 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; }
0514 
0515 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; }
0516 
0517 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; }
0518 
0519 inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::exceptions() const { return __exceptions_; }
0520 
0521 inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) {
0522   __exceptions_ = __iostate;
0523   clear(__rdstate_);
0524 }
0525 
0526 template <class _Traits>
0527 // Attribute 'packed' is used to keep the layout compatible with the previous
0528 // definition of the '__fill_' and '_set_' pair in basic_ios on AIX & z/OS.
0529 struct _LIBCPP_PACKED _FillHelper {
0530   _LIBCPP_HIDE_FROM_ABI void __init() {
0531     __set_      = false;
0532     __fill_val_ = _Traits::eof();
0533   }
0534   _LIBCPP_HIDE_FROM_ABI _FillHelper& operator=(typename _Traits::int_type __x) {
0535     __set_      = true;
0536     __fill_val_ = __x;
0537     return *this;
0538   }
0539   _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __set_; }
0540   _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; }
0541 
0542 private:
0543   typename _Traits::int_type __fill_val_;
0544   bool __set_;
0545 };
0546 
0547 template <class _Traits>
0548 struct _LIBCPP_PACKED _SentinelValueFill {
0549   _LIBCPP_HIDE_FROM_ABI void __init() { __fill_val_ = _Traits::eof(); }
0550   _LIBCPP_HIDE_FROM_ABI _SentinelValueFill& operator=(typename _Traits::int_type __x) {
0551     __fill_val_ = __x;
0552     return *this;
0553   }
0554   _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __fill_val_ != _Traits::eof(); }
0555   _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; }
0556 
0557 private:
0558   typename _Traits::int_type __fill_val_;
0559 };
0560 
0561 template <class _CharT, class _Traits>
0562 class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base {
0563 public:
0564   // types:
0565   typedef _CharT char_type;
0566   typedef _Traits traits_type;
0567 
0568   typedef typename traits_type::int_type int_type;
0569   typedef typename traits_type::pos_type pos_type;
0570   typedef typename traits_type::off_type off_type;
0571 
0572   static_assert(is_same<_CharT, typename traits_type::char_type>::value,
0573                 "traits_type::char_type must be the same type as CharT");
0574 
0575 #    ifdef _LIBCPP_CXX03_LANG
0576   // Preserve the ability to compare with literal 0,
0577   // and implicitly convert to bool, but not implicitly convert to int.
0578   _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; }
0579 #    else
0580   _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); }
0581 #    endif
0582 
0583   _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
0584   _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
0585   _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); }
0586   _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); }
0587   _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
0588   _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
0589   _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
0590   _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
0591 
0592   _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
0593   _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); }
0594 
0595   // 27.5.4.1 Constructor/destructor:
0596   _LIBCPP_HIDE_FROM_ABI explicit basic_ios(basic_streambuf<char_type, traits_type>* __sb);
0597   ~basic_ios() override;
0598 
0599   // 27.5.4.2 Members:
0600   _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
0601   _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
0602 
0603   _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
0604   _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
0605 
0606   basic_ios& copyfmt(const basic_ios& __rhs);
0607 
0608   _LIBCPP_HIDE_FROM_ABI char_type fill() const;
0609   _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch);
0610 
0611   _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc);
0612 
0613   _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
0614   _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
0615 
0616 protected:
0617   _LIBCPP_HIDE_FROM_ABI basic_ios() {
0618     // purposefully does no initialization
0619     // since the destructor does nothing this does not have ios_base issues.
0620   }
0621   _LIBCPP_HIDE_FROM_ABI void init(basic_streambuf<char_type, traits_type>* __sb);
0622 
0623   _LIBCPP_HIDE_FROM_ABI void move(basic_ios& __rhs);
0624   _LIBCPP_HIDE_FROM_ABI void move(basic_ios&& __rhs) { move(__rhs); }
0625   _LIBCPP_HIDE_FROM_ABI void swap(basic_ios& __rhs) _NOEXCEPT;
0626   _LIBCPP_HIDE_FROM_ABI void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
0627 
0628 private:
0629   basic_ostream<char_type, traits_type>* __tie_;
0630 
0631 #    if defined(_LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE)
0632   using _FillType _LIBCPP_NODEBUG = _FillHelper<traits_type>;
0633 #    else
0634   using _FillType _LIBCPP_NODEBUG = _SentinelValueFill<traits_type>;
0635 #    endif
0636   mutable _FillType __fill_;
0637 };
0638 
0639 template <class _CharT, class _Traits>
0640 inline _LIBCPP_HIDE_FROM_ABI basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type, traits_type>* __sb) {
0641   init(__sb);
0642 }
0643 
0644 template <class _CharT, class _Traits>
0645 basic_ios<_CharT, _Traits>::~basic_ios() {}
0646 
0647 template <class _CharT, class _Traits>
0648 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) {
0649   ios_base::init(__sb);
0650   __tie_ = nullptr;
0651   __fill_.__init();
0652 }
0653 
0654 template <class _CharT, class _Traits>
0655 inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const {
0656   return __tie_;
0657 }
0658 
0659 template <class _CharT, class _Traits>
0660 inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>*
0661 basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) {
0662   basic_ostream<char_type, traits_type>* __r = __tie_;
0663   __tie_                                     = __tiestr;
0664   return __r;
0665 }
0666 
0667 template <class _CharT, class _Traits>
0668 inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const {
0669   return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
0670 }
0671 
0672 template <class _CharT, class _Traits>
0673 inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>*
0674 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
0675   basic_streambuf<char_type, traits_type>* __r = rdbuf();
0676   ios_base::rdbuf(__sb);
0677   return __r;
0678 }
0679 
0680 template <class _CharT, class _Traits>
0681 inline _LIBCPP_HIDE_FROM_ABI locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
0682   locale __r = getloc();
0683   ios_base::imbue(__loc);
0684   if (rdbuf())
0685     rdbuf()->pubimbue(__loc);
0686   return __r;
0687 }
0688 
0689 template <class _CharT, class _Traits>
0690 inline _LIBCPP_HIDE_FROM_ABI char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const {
0691   return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
0692 }
0693 
0694 template <class _CharT, class _Traits>
0695 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) const {
0696   return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
0697 }
0698 
0699 template <class _CharT, class _Traits>
0700 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const {
0701   if (!__fill_.__is_set())
0702     __fill_ = widen(' ');
0703   return __fill_.__get();
0704 }
0705 
0706 template <class _CharT, class _Traits>
0707 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) {
0708   if (!__fill_.__is_set())
0709     __fill_ = widen(' ');
0710   char_type __r = __fill_.__get();
0711   __fill_       = __ch;
0712   return __r;
0713 }
0714 
0715 template <class _CharT, class _Traits>
0716 basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
0717   if (this != std::addressof(__rhs)) {
0718     __call_callbacks(erase_event);
0719     ios_base::copyfmt(__rhs);
0720     __tie_  = __rhs.__tie_;
0721     __fill_ = __rhs.__fill_;
0722     __call_callbacks(copyfmt_event);
0723     exceptions(__rhs.exceptions());
0724   }
0725   return *this;
0726 }
0727 
0728 template <class _CharT, class _Traits>
0729 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) {
0730   ios_base::move(__rhs);
0731   __tie_       = __rhs.__tie_;
0732   __rhs.__tie_ = nullptr;
0733   __fill_      = __rhs.__fill_;
0734 }
0735 
0736 template <class _CharT, class _Traits>
0737 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT {
0738   ios_base::swap(__rhs);
0739   std::swap(__tie_, __rhs.__tie_);
0740   std::swap(__fill_, __rhs.__fill_);
0741 }
0742 
0743 template <class _CharT, class _Traits>
0744 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
0745   ios_base::set_rdbuf(__sb);
0746 }
0747 
0748 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
0749 
0750 #    if _LIBCPP_HAS_WIDE_CHARACTERS
0751 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
0752 #    endif
0753 
0754 _LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) {
0755   __str.setf(ios_base::boolalpha);
0756   return __str;
0757 }
0758 
0759 _LIBCPP_HIDE_FROM_ABI inline ios_base& noboolalpha(ios_base& __str) {
0760   __str.unsetf(ios_base::boolalpha);
0761   return __str;
0762 }
0763 
0764 _LIBCPP_HIDE_FROM_ABI inline ios_base& showbase(ios_base& __str) {
0765   __str.setf(ios_base::showbase);
0766   return __str;
0767 }
0768 
0769 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowbase(ios_base& __str) {
0770   __str.unsetf(ios_base::showbase);
0771   return __str;
0772 }
0773 
0774 _LIBCPP_HIDE_FROM_ABI inline ios_base& showpoint(ios_base& __str) {
0775   __str.setf(ios_base::showpoint);
0776   return __str;
0777 }
0778 
0779 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpoint(ios_base& __str) {
0780   __str.unsetf(ios_base::showpoint);
0781   return __str;
0782 }
0783 
0784 _LIBCPP_HIDE_FROM_ABI inline ios_base& showpos(ios_base& __str) {
0785   __str.setf(ios_base::showpos);
0786   return __str;
0787 }
0788 
0789 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpos(ios_base& __str) {
0790   __str.unsetf(ios_base::showpos);
0791   return __str;
0792 }
0793 
0794 _LIBCPP_HIDE_FROM_ABI inline ios_base& skipws(ios_base& __str) {
0795   __str.setf(ios_base::skipws);
0796   return __str;
0797 }
0798 
0799 _LIBCPP_HIDE_FROM_ABI inline ios_base& noskipws(ios_base& __str) {
0800   __str.unsetf(ios_base::skipws);
0801   return __str;
0802 }
0803 
0804 _LIBCPP_HIDE_FROM_ABI inline ios_base& uppercase(ios_base& __str) {
0805   __str.setf(ios_base::uppercase);
0806   return __str;
0807 }
0808 
0809 _LIBCPP_HIDE_FROM_ABI inline ios_base& nouppercase(ios_base& __str) {
0810   __str.unsetf(ios_base::uppercase);
0811   return __str;
0812 }
0813 
0814 _LIBCPP_HIDE_FROM_ABI inline ios_base& unitbuf(ios_base& __str) {
0815   __str.setf(ios_base::unitbuf);
0816   return __str;
0817 }
0818 
0819 _LIBCPP_HIDE_FROM_ABI inline ios_base& nounitbuf(ios_base& __str) {
0820   __str.unsetf(ios_base::unitbuf);
0821   return __str;
0822 }
0823 
0824 _LIBCPP_HIDE_FROM_ABI inline ios_base& internal(ios_base& __str) {
0825   __str.setf(ios_base::internal, ios_base::adjustfield);
0826   return __str;
0827 }
0828 
0829 _LIBCPP_HIDE_FROM_ABI inline ios_base& left(ios_base& __str) {
0830   __str.setf(ios_base::left, ios_base::adjustfield);
0831   return __str;
0832 }
0833 
0834 _LIBCPP_HIDE_FROM_ABI inline ios_base& right(ios_base& __str) {
0835   __str.setf(ios_base::right, ios_base::adjustfield);
0836   return __str;
0837 }
0838 
0839 _LIBCPP_HIDE_FROM_ABI inline ios_base& dec(ios_base& __str) {
0840   __str.setf(ios_base::dec, ios_base::basefield);
0841   return __str;
0842 }
0843 
0844 _LIBCPP_HIDE_FROM_ABI inline ios_base& hex(ios_base& __str) {
0845   __str.setf(ios_base::hex, ios_base::basefield);
0846   return __str;
0847 }
0848 
0849 _LIBCPP_HIDE_FROM_ABI inline ios_base& oct(ios_base& __str) {
0850   __str.setf(ios_base::oct, ios_base::basefield);
0851   return __str;
0852 }
0853 
0854 _LIBCPP_HIDE_FROM_ABI inline ios_base& fixed(ios_base& __str) {
0855   __str.setf(ios_base::fixed, ios_base::floatfield);
0856   return __str;
0857 }
0858 
0859 _LIBCPP_HIDE_FROM_ABI inline ios_base& scientific(ios_base& __str) {
0860   __str.setf(ios_base::scientific, ios_base::floatfield);
0861   return __str;
0862 }
0863 
0864 _LIBCPP_HIDE_FROM_ABI inline ios_base& hexfloat(ios_base& __str) {
0865   __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
0866   return __str;
0867 }
0868 
0869 _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) {
0870   __str.unsetf(ios_base::floatfield);
0871   return __str;
0872 }
0873 
0874 _LIBCPP_END_NAMESPACE_STD
0875 
0876 _LIBCPP_POP_MACROS
0877 
0878 #  endif // _LIBCPP_HAS_LOCALIZATION
0879 
0880 #  if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
0881 #    include <atomic>
0882 #    include <concepts>
0883 #    include <cstddef>
0884 #    include <cstdlib>
0885 #    include <cstring>
0886 #    include <initializer_list>
0887 #    include <limits>
0888 #    include <mutex>
0889 #    include <new>
0890 #    include <stdexcept>
0891 #    include <system_error>
0892 #    include <type_traits>
0893 #    include <typeinfo>
0894 #  endif
0895 #endif // __cplusplus < 201103L && defined(_LIBCPP_USE_FROZEN_CXX03_HEADERS)
0896 
0897 #endif // _LIBCPP_IOS