ios revision 249989
1227825Stheraven// -*- C++ -*- 2227825Stheraven//===---------------------------- ios -------------------------------------===// 3227825Stheraven// 4227825Stheraven// The LLVM Compiler Infrastructure 5227825Stheraven// 6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open 7227825Stheraven// Source Licenses. See LICENSE.TXT for details. 8227825Stheraven// 9227825Stheraven//===----------------------------------------------------------------------===// 10227825Stheraven 11227825Stheraven#ifndef _LIBCPP_IOS 12227825Stheraven#define _LIBCPP_IOS 13227825Stheraven 14227825Stheraven/* 15227825Stheraven ios synopsis 16227825Stheraven 17227825Stheraven#include <iosfwd> 18227825Stheraven 19227825Stheravennamespace std 20227825Stheraven{ 21227825Stheraven 22227825Stheraventypedef OFF_T streamoff; 23227825Stheraventypedef SZ_T streamsize; 24227825Stheraventemplate <class stateT> class fpos; 25227825Stheraven 26227825Stheravenclass ios_base 27227825Stheraven{ 28227825Stheravenpublic: 29227825Stheraven class failure; 30227825Stheraven 31227825Stheraven typedef T1 fmtflags; 32241900Sdim static constexpr fmtflags boolalpha; 33241900Sdim static constexpr fmtflags dec; 34241900Sdim static constexpr fmtflags fixed; 35241900Sdim static constexpr fmtflags hex; 36241900Sdim static constexpr fmtflags internal; 37241900Sdim static constexpr fmtflags left; 38241900Sdim static constexpr fmtflags oct; 39241900Sdim static constexpr fmtflags right; 40241900Sdim static constexpr fmtflags scientific; 41241900Sdim static constexpr fmtflags showbase; 42241900Sdim static constexpr fmtflags showpoint; 43241900Sdim static constexpr fmtflags showpos; 44241900Sdim static constexpr fmtflags skipws; 45241900Sdim static constexpr fmtflags unitbuf; 46241900Sdim static constexpr fmtflags uppercase; 47241900Sdim static constexpr fmtflags adjustfield; 48241900Sdim static constexpr fmtflags basefield; 49241900Sdim static constexpr fmtflags floatfield; 50227825Stheraven 51227825Stheraven typedef T2 iostate; 52241900Sdim static constexpr iostate badbit; 53241900Sdim static constexpr iostate eofbit; 54241900Sdim static constexpr iostate failbit; 55241900Sdim static constexpr iostate goodbit; 56227825Stheraven 57227825Stheraven typedef T3 openmode; 58241900Sdim static constexpr openmode app; 59241900Sdim static constexpr openmode ate; 60241900Sdim static constexpr openmode binary; 61241900Sdim static constexpr openmode in; 62241900Sdim static constexpr openmode out; 63241900Sdim static constexpr openmode trunc; 64227825Stheraven 65227825Stheraven typedef T4 seekdir; 66241900Sdim static constexpr seekdir beg; 67241900Sdim static constexpr seekdir cur; 68241900Sdim static constexpr seekdir end; 69227825Stheraven 70227825Stheraven class Init; 71227825Stheraven 72227825Stheraven // 27.5.2.2 fmtflags state: 73227825Stheraven fmtflags flags() const; 74227825Stheraven fmtflags flags(fmtflags fmtfl); 75227825Stheraven fmtflags setf(fmtflags fmtfl); 76227825Stheraven fmtflags setf(fmtflags fmtfl, fmtflags mask); 77227825Stheraven void unsetf(fmtflags mask); 78227825Stheraven 79227825Stheraven streamsize precision() const; 80227825Stheraven streamsize precision(streamsize prec); 81227825Stheraven streamsize width() const; 82227825Stheraven streamsize width(streamsize wide); 83227825Stheraven 84227825Stheraven // 27.5.2.3 locales: 85227825Stheraven locale imbue(const locale& loc); 86227825Stheraven locale getloc() const; 87227825Stheraven 88227825Stheraven // 27.5.2.5 storage: 89227825Stheraven static int xalloc(); 90227825Stheraven long& iword(int index); 91227825Stheraven void*& pword(int index); 92227825Stheraven 93227825Stheraven // destructor 94227825Stheraven virtual ~ios_base(); 95227825Stheraven 96227825Stheraven // 27.5.2.6 callbacks; 97227825Stheraven enum event { erase_event, imbue_event, copyfmt_event }; 98227825Stheraven typedef void (*event_callback)(event, ios_base&, int index); 99227825Stheraven void register_callback(event_callback fn, int index); 100227825Stheraven 101227825Stheraven ios_base(const ios_base&) = delete; 102227825Stheraven ios_base& operator=(const ios_base&) = delete; 103227825Stheraven 104227825Stheraven static bool sync_with_stdio(bool sync = true); 105227825Stheraven 106227825Stheravenprotected: 107227825Stheraven ios_base(); 108227825Stheraven}; 109227825Stheraven 110227825Stheraventemplate <class charT, class traits = char_traits<charT> > 111227825Stheravenclass basic_ios 112227825Stheraven : public ios_base 113227825Stheraven{ 114227825Stheravenpublic: 115227825Stheraven // types: 116227825Stheraven typedef charT char_type; 117227825Stheraven typedef typename traits::int_type int_type; 118227825Stheraven typedef typename traits::pos_type pos_type; 119227825Stheraven typedef typename traits::off_type off_type; 120227825Stheraven typedef traits traits_type; 121227825Stheraven 122227825Stheraven operator unspecified-bool-type() const; 123227825Stheraven bool operator!() const; 124227825Stheraven iostate rdstate() const; 125227825Stheraven void clear(iostate state = goodbit); 126227825Stheraven void setstate(iostate state); 127227825Stheraven bool good() const; 128227825Stheraven bool eof() const; 129227825Stheraven bool fail() const; 130227825Stheraven bool bad() const; 131227825Stheraven 132227825Stheraven iostate exceptions() const; 133227825Stheraven void exceptions(iostate except); 134227825Stheraven 135227825Stheraven // 27.5.4.1 Constructor/destructor: 136227825Stheraven explicit basic_ios(basic_streambuf<charT,traits>* sb); 137227825Stheraven virtual ~basic_ios(); 138227825Stheraven 139227825Stheraven // 27.5.4.2 Members: 140227825Stheraven basic_ostream<charT,traits>* tie() const; 141227825Stheraven basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr); 142227825Stheraven 143227825Stheraven basic_streambuf<charT,traits>* rdbuf() const; 144227825Stheraven basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb); 145227825Stheraven 146227825Stheraven basic_ios& copyfmt(const basic_ios& rhs); 147227825Stheraven 148227825Stheraven char_type fill() const; 149227825Stheraven char_type fill(char_type ch); 150227825Stheraven 151227825Stheraven locale imbue(const locale& loc); 152227825Stheraven 153227825Stheraven char narrow(char_type c, char dfault) const; 154227825Stheraven char_type widen(char c) const; 155227825Stheraven 156227825Stheraven basic_ios(const basic_ios& ) = delete; 157227825Stheraven basic_ios& operator=(const basic_ios&) = delete; 158227825Stheraven 159227825Stheravenprotected: 160227825Stheraven basic_ios(); 161227825Stheraven void init(basic_streambuf<charT,traits>* sb); 162227825Stheraven void move(basic_ios& rhs); 163241900Sdim void swap(basic_ios& rhs) noexcept; 164227825Stheraven void set_rdbuf(basic_streambuf<charT, traits>* sb); 165227825Stheraven}; 166227825Stheraven 167227825Stheraven// 27.5.5, manipulators: 168227825Stheravenios_base& boolalpha (ios_base& str); 169227825Stheravenios_base& noboolalpha(ios_base& str); 170227825Stheravenios_base& showbase (ios_base& str); 171227825Stheravenios_base& noshowbase (ios_base& str); 172227825Stheravenios_base& showpoint (ios_base& str); 173227825Stheravenios_base& noshowpoint(ios_base& str); 174227825Stheravenios_base& showpos (ios_base& str); 175227825Stheravenios_base& noshowpos (ios_base& str); 176227825Stheravenios_base& skipws (ios_base& str); 177227825Stheravenios_base& noskipws (ios_base& str); 178227825Stheravenios_base& uppercase (ios_base& str); 179227825Stheravenios_base& nouppercase(ios_base& str); 180227825Stheravenios_base& unitbuf (ios_base& str); 181227825Stheravenios_base& nounitbuf (ios_base& str); 182227825Stheraven 183227825Stheraven// 27.5.5.2 adjustfield: 184227825Stheravenios_base& internal (ios_base& str); 185227825Stheravenios_base& left (ios_base& str); 186227825Stheravenios_base& right (ios_base& str); 187227825Stheraven 188227825Stheraven// 27.5.5.3 basefield: 189227825Stheravenios_base& dec (ios_base& str); 190227825Stheravenios_base& hex (ios_base& str); 191227825Stheravenios_base& oct (ios_base& str); 192227825Stheraven 193227825Stheraven// 27.5.5.4 floatfield: 194227825Stheravenios_base& fixed (ios_base& str); 195227825Stheravenios_base& scientific (ios_base& str); 196227825Stheravenios_base& hexfloat (ios_base& str); 197227825Stheravenios_base& defaultfloat(ios_base& str); 198227825Stheraven 199227825Stheraven// 27.5.5.5 error reporting: 200227825Stheravenenum class io_errc 201227825Stheraven{ 202227825Stheraven stream = 1 203227825Stheraven}; 204227825Stheraven 205227825Stheravenconcept_map ErrorCodeEnum<io_errc> { }; 206227825Stheravenerror_code make_error_code(io_errc e); 207227825Stheravenerror_condition make_error_condition(io_errc e); 208227825Stheravenstorage-class-specifier const error_category& iostream_category; 209227825Stheraven 210227825Stheraven} // std 211227825Stheraven 212227825Stheraven*/ 213227825Stheraven 214227825Stheraven#include <__config> 215227825Stheraven#include <iosfwd> 216227825Stheraven#include <__locale> 217227825Stheraven#include <system_error> 218227825Stheraven 219227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) 220227825Stheraven#pragma GCC system_header 221227825Stheraven#endif 222227825Stheraven 223227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD 224227825Stheraven 225227825Stheraventypedef ptrdiff_t streamsize; 226227825Stheraven 227249989Sdimclass _LIBCPP_TYPE_VIS ios_base 228227825Stheraven{ 229227825Stheravenpublic: 230249989Sdim class _LIBCPP_TYPE_VIS failure; 231227825Stheraven 232227825Stheraven typedef unsigned int fmtflags; 233227825Stheraven static const fmtflags boolalpha = 0x0001; 234227825Stheraven static const fmtflags dec = 0x0002; 235227825Stheraven static const fmtflags fixed = 0x0004; 236227825Stheraven static const fmtflags hex = 0x0008; 237227825Stheraven static const fmtflags internal = 0x0010; 238227825Stheraven static const fmtflags left = 0x0020; 239227825Stheraven static const fmtflags oct = 0x0040; 240227825Stheraven static const fmtflags right = 0x0080; 241227825Stheraven static const fmtflags scientific = 0x0100; 242227825Stheraven static const fmtflags showbase = 0x0200; 243227825Stheraven static const fmtflags showpoint = 0x0400; 244227825Stheraven static const fmtflags showpos = 0x0800; 245227825Stheraven static const fmtflags skipws = 0x1000; 246227825Stheraven static const fmtflags unitbuf = 0x2000; 247227825Stheraven static const fmtflags uppercase = 0x4000; 248227825Stheraven static const fmtflags adjustfield = left | right | internal; 249227825Stheraven static const fmtflags basefield = dec | oct | hex; 250227825Stheraven static const fmtflags floatfield = scientific | fixed; 251227825Stheraven 252227825Stheraven typedef unsigned int iostate; 253227825Stheraven typedef iostate io_state; 254227825Stheraven static const iostate badbit = 0x1; 255227825Stheraven static const iostate eofbit = 0x2; 256227825Stheraven static const iostate failbit = 0x4; 257227825Stheraven static const iostate goodbit = 0x0; 258227825Stheraven 259227825Stheraven typedef unsigned int openmode; 260227825Stheraven typedef openmode open_mode; 261227825Stheraven static const openmode app = 0x01; 262227825Stheraven static const openmode ate = 0x02; 263227825Stheraven static const openmode binary = 0x04; 264227825Stheraven static const openmode in = 0x08; 265227825Stheraven static const openmode out = 0x10; 266227825Stheraven static const openmode trunc = 0x20; 267227825Stheraven 268227825Stheraven enum seekdir {beg, cur, end}; 269227825Stheraven typedef seekdir seek_dir; 270227825Stheraven 271227825Stheraven typedef _VSTD::streamoff streamoff; 272227825Stheraven typedef _VSTD::streampos streampos; 273227825Stheraven 274249989Sdim class _LIBCPP_TYPE_VIS Init; 275227825Stheraven 276227825Stheraven // 27.5.2.2 fmtflags state: 277227825Stheraven _LIBCPP_INLINE_VISIBILITY fmtflags flags() const; 278227825Stheraven _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl); 279227825Stheraven _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl); 280227825Stheraven _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask); 281227825Stheraven _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask); 282227825Stheraven 283227825Stheraven _LIBCPP_INLINE_VISIBILITY streamsize precision() const; 284227825Stheraven _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec); 285227825Stheraven _LIBCPP_INLINE_VISIBILITY streamsize width() const; 286227825Stheraven _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide); 287227825Stheraven 288227825Stheraven // 27.5.2.3 locales: 289227825Stheraven locale imbue(const locale& __loc); 290227825Stheraven locale getloc() const; 291227825Stheraven 292227825Stheraven // 27.5.2.5 storage: 293227825Stheraven static int xalloc(); 294227825Stheraven long& iword(int __index); 295227825Stheraven void*& pword(int __index); 296227825Stheraven 297227825Stheraven // destructor 298227825Stheraven virtual ~ios_base(); 299227825Stheraven 300227825Stheraven // 27.5.2.6 callbacks; 301227825Stheraven enum event { erase_event, imbue_event, copyfmt_event }; 302227825Stheraven typedef void (*event_callback)(event, ios_base&, int __index); 303227825Stheraven void register_callback(event_callback __fn, int __index); 304227825Stheraven 305227825Stheravenprivate: 306227825Stheraven ios_base(const ios_base&); // = delete; 307227825Stheraven ios_base& operator=(const ios_base&); // = delete; 308227825Stheraven 309227825Stheravenpublic: 310227825Stheraven static bool sync_with_stdio(bool __sync = true); 311227825Stheraven 312227825Stheraven _LIBCPP_INLINE_VISIBILITY iostate rdstate() const; 313227825Stheraven void clear(iostate __state = goodbit); 314227825Stheraven _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state); 315227825Stheraven 316227825Stheraven _LIBCPP_INLINE_VISIBILITY bool good() const; 317227825Stheraven _LIBCPP_INLINE_VISIBILITY bool eof() const; 318227825Stheraven _LIBCPP_INLINE_VISIBILITY bool fail() const; 319227825Stheraven _LIBCPP_INLINE_VISIBILITY bool bad() const; 320227825Stheraven 321227825Stheraven _LIBCPP_INLINE_VISIBILITY iostate exceptions() const; 322227825Stheraven _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except); 323227825Stheraven 324227825Stheraven void __set_badbit_and_consider_rethrow(); 325227825Stheraven void __set_failbit_and_consider_rethrow(); 326227825Stheraven 327227825Stheravenprotected: 328227825Stheraven _LIBCPP_INLINE_VISIBILITY 329227825Stheraven ios_base() {// purposefully does no initialization 330227825Stheraven } 331227825Stheraven 332227825Stheraven void init(void* __sb); 333227825Stheraven _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;} 334227825Stheraven 335227825Stheraven _LIBCPP_ALWAYS_INLINE 336227825Stheraven void rdbuf(void* __sb) 337227825Stheraven { 338227825Stheraven __rdbuf_ = __sb; 339227825Stheraven clear(); 340227825Stheraven } 341227825Stheraven 342227825Stheraven void __call_callbacks(event); 343227825Stheraven void copyfmt(const ios_base&); 344227825Stheraven void move(ios_base&); 345241900Sdim void swap(ios_base&) _NOEXCEPT; 346227825Stheraven 347227825Stheraven _LIBCPP_ALWAYS_INLINE 348227825Stheraven void set_rdbuf(void* __sb) 349227825Stheraven { 350227825Stheraven __rdbuf_ = __sb; 351227825Stheraven } 352227825Stheraven 353227825Stheravenprivate: 354227825Stheraven // All data members must be scalars 355227825Stheraven fmtflags __fmtflags_; 356227825Stheraven streamsize __precision_; 357227825Stheraven streamsize __width_; 358227825Stheraven iostate __rdstate_; 359227825Stheraven iostate __exceptions_; 360227825Stheraven void* __rdbuf_; 361227825Stheraven void* __loc_; 362227825Stheraven event_callback* __fn_; 363227825Stheraven int* __index_; 364227825Stheraven size_t __event_size_; 365227825Stheraven size_t __event_cap_; 366227825Stheraven static int __xindex_; 367227825Stheraven long* __iarray_; 368227825Stheraven size_t __iarray_size_; 369227825Stheraven size_t __iarray_cap_; 370227825Stheraven void** __parray_; 371227825Stheraven size_t __parray_size_; 372227825Stheraven size_t __parray_cap_; 373227825Stheraven}; 374227825Stheraven 375227825Stheraven//enum class io_errc 376232924Stheraven_LIBCPP_DECLARE_STRONG_ENUM(io_errc) 377227825Stheraven{ 378227825Stheraven stream = 1 379227825Stheraven}; 380232924Stheraven_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc) 381227825Stheraven 382227825Stheraventemplate <> 383249989Sdimstruct _LIBCPP_TYPE_VIS is_error_code_enum<io_errc> : public true_type { }; 384232924Stheraven 385232924Stheraven#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS 386227825Stheraventemplate <> 387249989Sdimstruct _LIBCPP_TYPE_VIS is_error_code_enum<io_errc::__lx> : public true_type { }; 388232924Stheraven#endif 389227825Stheraven 390249989Sdim_LIBCPP_FUNC_VIS 391227825Stheravenconst error_category& iostream_category(); 392227825Stheraven 393227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 394227825Stheravenerror_code 395227825Stheravenmake_error_code(io_errc __e) 396227825Stheraven{ 397227825Stheraven return error_code(static_cast<int>(__e), iostream_category()); 398227825Stheraven} 399227825Stheraven 400227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 401227825Stheravenerror_condition 402227825Stheravenmake_error_condition(io_errc __e) 403227825Stheraven{ 404227825Stheraven return error_condition(static_cast<int>(__e), iostream_category()); 405227825Stheraven} 406227825Stheraven 407227825Stheravenclass _LIBCPP_EXCEPTION_ABI ios_base::failure 408227825Stheraven : public system_error 409227825Stheraven{ 410227825Stheravenpublic: 411227825Stheraven explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); 412227825Stheraven explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); 413227825Stheraven virtual ~failure() throw(); 414227825Stheraven}; 415227825Stheraven 416249989Sdimclass _LIBCPP_TYPE_VIS ios_base::Init 417227825Stheraven{ 418227825Stheravenpublic: 419227825Stheraven Init(); 420227825Stheraven ~Init(); 421227825Stheraven}; 422227825Stheraven 423227825Stheraven// fmtflags 424227825Stheraven 425227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 426227825Stheravenios_base::fmtflags 427227825Stheravenios_base::flags() const 428227825Stheraven{ 429227825Stheraven return __fmtflags_; 430227825Stheraven} 431227825Stheraven 432227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 433227825Stheravenios_base::fmtflags 434227825Stheravenios_base::flags(fmtflags __fmtfl) 435227825Stheraven{ 436227825Stheraven fmtflags __r = __fmtflags_; 437227825Stheraven __fmtflags_ = __fmtfl; 438227825Stheraven return __r; 439227825Stheraven} 440227825Stheraven 441227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 442227825Stheravenios_base::fmtflags 443227825Stheravenios_base::setf(fmtflags __fmtfl) 444227825Stheraven{ 445227825Stheraven fmtflags __r = __fmtflags_; 446227825Stheraven __fmtflags_ |= __fmtfl; 447227825Stheraven return __r; 448227825Stheraven} 449227825Stheraven 450227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 451227825Stheravenvoid 452227825Stheravenios_base::unsetf(fmtflags __mask) 453227825Stheraven{ 454227825Stheraven __fmtflags_ &= ~__mask; 455227825Stheraven} 456227825Stheraven 457227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 458227825Stheravenios_base::fmtflags 459227825Stheravenios_base::setf(fmtflags __fmtfl, fmtflags __mask) 460227825Stheraven{ 461227825Stheraven fmtflags __r = __fmtflags_; 462227825Stheraven unsetf(__mask); 463227825Stheraven __fmtflags_ |= __fmtfl & __mask; 464227825Stheraven return __r; 465227825Stheraven} 466227825Stheraven 467227825Stheraven// precision 468227825Stheraven 469227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 470227825Stheravenstreamsize 471227825Stheravenios_base::precision() const 472227825Stheraven{ 473227825Stheraven return __precision_; 474227825Stheraven} 475227825Stheraven 476227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 477227825Stheravenstreamsize 478227825Stheravenios_base::precision(streamsize __prec) 479227825Stheraven{ 480227825Stheraven streamsize __r = __precision_; 481227825Stheraven __precision_ = __prec; 482227825Stheraven return __r; 483227825Stheraven} 484227825Stheraven 485227825Stheraven// width 486227825Stheraven 487227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 488227825Stheravenstreamsize 489227825Stheravenios_base::width() const 490227825Stheraven{ 491227825Stheraven return __width_; 492227825Stheraven} 493227825Stheraven 494227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 495227825Stheravenstreamsize 496227825Stheravenios_base::width(streamsize __wide) 497227825Stheraven{ 498227825Stheraven streamsize __r = __width_; 499227825Stheraven __width_ = __wide; 500227825Stheraven return __r; 501227825Stheraven} 502227825Stheraven 503227825Stheraven// iostate 504227825Stheraven 505227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 506227825Stheravenios_base::iostate 507227825Stheravenios_base::rdstate() const 508227825Stheraven{ 509227825Stheraven return __rdstate_; 510227825Stheraven} 511227825Stheraven 512227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 513227825Stheravenvoid 514227825Stheravenios_base::setstate(iostate __state) 515227825Stheraven{ 516227825Stheraven clear(__rdstate_ | __state); 517227825Stheraven} 518227825Stheraven 519227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 520227825Stheravenbool 521227825Stheravenios_base::good() const 522227825Stheraven{ 523227825Stheraven return __rdstate_ == 0; 524227825Stheraven} 525227825Stheraven 526227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 527227825Stheravenbool 528227825Stheravenios_base::eof() const 529227825Stheraven{ 530227825Stheraven return __rdstate_ & eofbit; 531227825Stheraven} 532227825Stheraven 533227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 534227825Stheravenbool 535227825Stheravenios_base::fail() const 536227825Stheraven{ 537227825Stheraven return __rdstate_ & (failbit | badbit); 538227825Stheraven} 539227825Stheraven 540227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 541227825Stheravenbool 542227825Stheravenios_base::bad() const 543227825Stheraven{ 544227825Stheraven return __rdstate_ & badbit; 545227825Stheraven} 546227825Stheraven 547227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 548227825Stheravenios_base::iostate 549227825Stheravenios_base::exceptions() const 550227825Stheraven{ 551227825Stheraven return __exceptions_; 552227825Stheraven} 553227825Stheraven 554227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 555227825Stheravenvoid 556227825Stheravenios_base::exceptions(iostate __except) 557227825Stheraven{ 558227825Stheraven __exceptions_ = __except; 559227825Stheraven clear(__rdstate_); 560227825Stheraven} 561227825Stheraven 562227825Stheraventemplate <class _CharT, class _Traits> 563249989Sdimclass _LIBCPP_TYPE_VIS basic_ios 564227825Stheraven : public ios_base 565227825Stheraven{ 566227825Stheravenpublic: 567227825Stheraven // types: 568227825Stheraven typedef _CharT char_type; 569227825Stheraven typedef _Traits traits_type; 570227825Stheraven 571227825Stheraven typedef typename traits_type::int_type int_type; 572227825Stheraven typedef typename traits_type::pos_type pos_type; 573227825Stheraven typedef typename traits_type::off_type off_type; 574227825Stheraven 575232924Stheraven _LIBCPP_ALWAYS_INLINE 576232924Stheraven _LIBCPP_EXPLICIT 577227825Stheraven operator bool() const {return !fail();} 578227825Stheraven _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} 579227825Stheraven _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} 580227825Stheraven _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);} 581227825Stheraven _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);} 582227825Stheraven _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();} 583227825Stheraven _LIBCPP_ALWAYS_INLINE bool eof() const {return ios_base::eof();} 584227825Stheraven _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();} 585227825Stheraven _LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();} 586227825Stheraven 587227825Stheraven _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();} 588227825Stheraven _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);} 589227825Stheraven 590227825Stheraven // 27.5.4.1 Constructor/destructor: 591227825Stheraven _LIBCPP_INLINE_VISIBILITY 592227825Stheraven explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb); 593227825Stheraven virtual ~basic_ios(); 594227825Stheraven 595227825Stheraven // 27.5.4.2 Members: 596227825Stheraven _LIBCPP_INLINE_VISIBILITY 597227825Stheraven basic_ostream<char_type, traits_type>* tie() const; 598227825Stheraven _LIBCPP_INLINE_VISIBILITY 599227825Stheraven basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr); 600227825Stheraven 601227825Stheraven _LIBCPP_INLINE_VISIBILITY 602227825Stheraven basic_streambuf<char_type, traits_type>* rdbuf() const; 603227825Stheraven _LIBCPP_INLINE_VISIBILITY 604227825Stheraven basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb); 605227825Stheraven 606227825Stheraven basic_ios& copyfmt(const basic_ios& __rhs); 607227825Stheraven 608227825Stheraven _LIBCPP_INLINE_VISIBILITY 609227825Stheraven char_type fill() const; 610227825Stheraven _LIBCPP_INLINE_VISIBILITY 611227825Stheraven char_type fill(char_type __ch); 612227825Stheraven 613227825Stheraven _LIBCPP_INLINE_VISIBILITY 614227825Stheraven locale imbue(const locale& __loc); 615227825Stheraven 616227825Stheraven _LIBCPP_INLINE_VISIBILITY 617227825Stheraven char narrow(char_type __c, char __dfault) const; 618227825Stheraven _LIBCPP_INLINE_VISIBILITY 619227825Stheraven char_type widen(char __c) const; 620227825Stheraven 621227825Stheravenprotected: 622227825Stheraven _LIBCPP_ALWAYS_INLINE 623227825Stheraven basic_ios() {// purposefully does no initialization 624227825Stheraven } 625227825Stheraven _LIBCPP_INLINE_VISIBILITY 626227825Stheraven void init(basic_streambuf<char_type, traits_type>* __sb); 627227825Stheraven 628227825Stheraven _LIBCPP_INLINE_VISIBILITY 629227825Stheraven void move(basic_ios& __rhs); 630227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES 631227825Stheraven _LIBCPP_ALWAYS_INLINE 632227825Stheraven void move(basic_ios&& __rhs) {move(__rhs);} 633227825Stheraven#endif 634227825Stheraven _LIBCPP_INLINE_VISIBILITY 635241900Sdim void swap(basic_ios& __rhs) _NOEXCEPT; 636227825Stheraven _LIBCPP_INLINE_VISIBILITY 637227825Stheraven void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb); 638227825Stheravenprivate: 639227825Stheraven basic_ostream<char_type, traits_type>* __tie_; 640241900Sdim mutable int_type __fill_; 641227825Stheraven}; 642227825Stheraven 643227825Stheraventemplate <class _CharT, class _Traits> 644227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 645227825Stheravenbasic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb) 646227825Stheraven{ 647227825Stheraven init(__sb); 648227825Stheraven} 649227825Stheraven 650227825Stheraventemplate <class _CharT, class _Traits> 651227825Stheravenbasic_ios<_CharT, _Traits>::~basic_ios() 652227825Stheraven{ 653227825Stheraven} 654227825Stheraven 655227825Stheraventemplate <class _CharT, class _Traits> 656227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 657227825Stheravenvoid 658227825Stheravenbasic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) 659227825Stheraven{ 660227825Stheraven ios_base::init(__sb); 661227825Stheraven __tie_ = 0; 662241900Sdim __fill_ = traits_type::eof(); 663227825Stheraven} 664227825Stheraven 665227825Stheraventemplate <class _CharT, class _Traits> 666227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 667227825Stheravenbasic_ostream<_CharT, _Traits>* 668227825Stheravenbasic_ios<_CharT, _Traits>::tie() const 669227825Stheraven{ 670227825Stheraven return __tie_; 671227825Stheraven} 672227825Stheraven 673227825Stheraventemplate <class _CharT, class _Traits> 674227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 675227825Stheravenbasic_ostream<_CharT, _Traits>* 676227825Stheravenbasic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) 677227825Stheraven{ 678227825Stheraven basic_ostream<char_type, traits_type>* __r = __tie_; 679227825Stheraven __tie_ = __tiestr; 680227825Stheraven return __r; 681227825Stheraven} 682227825Stheraven 683227825Stheraventemplate <class _CharT, class _Traits> 684227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 685227825Stheravenbasic_streambuf<_CharT, _Traits>* 686227825Stheravenbasic_ios<_CharT, _Traits>::rdbuf() const 687227825Stheraven{ 688227825Stheraven return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf()); 689227825Stheraven} 690227825Stheraven 691227825Stheraventemplate <class _CharT, class _Traits> 692227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 693227825Stheravenbasic_streambuf<_CharT, _Traits>* 694227825Stheravenbasic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) 695227825Stheraven{ 696227825Stheraven basic_streambuf<char_type, traits_type>* __r = rdbuf(); 697227825Stheraven ios_base::rdbuf(__sb); 698227825Stheraven return __r; 699227825Stheraven} 700227825Stheraven 701227825Stheraventemplate <class _CharT, class _Traits> 702227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 703227825Stheravenlocale 704227825Stheravenbasic_ios<_CharT, _Traits>::imbue(const locale& __loc) 705227825Stheraven{ 706227825Stheraven locale __r = getloc(); 707227825Stheraven ios_base::imbue(__loc); 708227825Stheraven if (rdbuf()) 709227825Stheraven rdbuf()->pubimbue(__loc); 710227825Stheraven return __r; 711227825Stheraven} 712227825Stheraven 713227825Stheraventemplate <class _CharT, class _Traits> 714227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 715227825Stheravenchar 716227825Stheravenbasic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const 717227825Stheraven{ 718227825Stheraven return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault); 719227825Stheraven} 720227825Stheraven 721227825Stheraventemplate <class _CharT, class _Traits> 722227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 723227825Stheraven_CharT 724227825Stheravenbasic_ios<_CharT, _Traits>::widen(char __c) const 725227825Stheraven{ 726227825Stheraven return use_facet<ctype<char_type> >(getloc()).widen(__c); 727227825Stheraven} 728227825Stheraven 729227825Stheraventemplate <class _CharT, class _Traits> 730227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 731227825Stheraven_CharT 732227825Stheravenbasic_ios<_CharT, _Traits>::fill() const 733227825Stheraven{ 734241900Sdim if (traits_type::eq_int_type(traits_type::eof(), __fill_)) 735241900Sdim __fill_ = widen(' '); 736227825Stheraven return __fill_; 737227825Stheraven} 738227825Stheraven 739227825Stheraventemplate <class _CharT, class _Traits> 740227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 741227825Stheraven_CharT 742227825Stheravenbasic_ios<_CharT, _Traits>::fill(char_type __ch) 743227825Stheraven{ 744227825Stheraven char_type __r = __fill_; 745227825Stheraven __fill_ = __ch; 746227825Stheraven return __r; 747227825Stheraven} 748227825Stheraven 749227825Stheraventemplate <class _CharT, class _Traits> 750227825Stheravenbasic_ios<_CharT, _Traits>& 751227825Stheravenbasic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) 752227825Stheraven{ 753227825Stheraven if (this != &__rhs) 754227825Stheraven { 755227825Stheraven __call_callbacks(erase_event); 756227825Stheraven ios_base::copyfmt(__rhs); 757227825Stheraven __tie_ = __rhs.__tie_; 758227825Stheraven __fill_ = __rhs.__fill_; 759227825Stheraven __call_callbacks(copyfmt_event); 760227825Stheraven exceptions(__rhs.exceptions()); 761227825Stheraven } 762227825Stheraven return *this; 763227825Stheraven} 764227825Stheraven 765227825Stheraventemplate <class _CharT, class _Traits> 766227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 767227825Stheravenvoid 768227825Stheravenbasic_ios<_CharT, _Traits>::move(basic_ios& __rhs) 769227825Stheraven{ 770227825Stheraven ios_base::move(__rhs); 771227825Stheraven __tie_ = __rhs.__tie_; 772227825Stheraven __rhs.__tie_ = 0; 773227825Stheraven __fill_ = __rhs.__fill_; 774227825Stheraven} 775227825Stheraven 776227825Stheraventemplate <class _CharT, class _Traits> 777227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 778227825Stheravenvoid 779241900Sdimbasic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT 780227825Stheraven{ 781227825Stheraven ios_base::swap(__rhs); 782227825Stheraven _VSTD::swap(__tie_, __rhs.__tie_); 783227825Stheraven _VSTD::swap(__fill_, __rhs.__fill_); 784227825Stheraven} 785227825Stheraven 786227825Stheraventemplate <class _CharT, class _Traits> 787227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 788227825Stheravenvoid 789227825Stheravenbasic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) 790227825Stheraven{ 791227825Stheraven ios_base::set_rdbuf(__sb); 792227825Stheraven} 793227825Stheraven 794227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 795227825Stheravenios_base& 796227825Stheravenboolalpha(ios_base& __str) 797227825Stheraven{ 798227825Stheraven __str.setf(ios_base::boolalpha); 799227825Stheraven return __str; 800227825Stheraven} 801227825Stheraven 802227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 803227825Stheravenios_base& 804227825Stheravennoboolalpha(ios_base& __str) 805227825Stheraven{ 806227825Stheraven __str.unsetf(ios_base::boolalpha); 807227825Stheraven return __str; 808227825Stheraven} 809227825Stheraven 810227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 811227825Stheravenios_base& 812227825Stheravenshowbase(ios_base& __str) 813227825Stheraven{ 814227825Stheraven __str.setf(ios_base::showbase); 815227825Stheraven return __str; 816227825Stheraven} 817227825Stheraven 818227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 819227825Stheravenios_base& 820227825Stheravennoshowbase(ios_base& __str) 821227825Stheraven{ 822227825Stheraven __str.unsetf(ios_base::showbase); 823227825Stheraven return __str; 824227825Stheraven} 825227825Stheraven 826227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 827227825Stheravenios_base& 828227825Stheravenshowpoint(ios_base& __str) 829227825Stheraven{ 830227825Stheraven __str.setf(ios_base::showpoint); 831227825Stheraven return __str; 832227825Stheraven} 833227825Stheraven 834227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 835227825Stheravenios_base& 836227825Stheravennoshowpoint(ios_base& __str) 837227825Stheraven{ 838227825Stheraven __str.unsetf(ios_base::showpoint); 839227825Stheraven return __str; 840227825Stheraven} 841227825Stheraven 842227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 843227825Stheravenios_base& 844227825Stheravenshowpos(ios_base& __str) 845227825Stheraven{ 846227825Stheraven __str.setf(ios_base::showpos); 847227825Stheraven return __str; 848227825Stheraven} 849227825Stheraven 850227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 851227825Stheravenios_base& 852227825Stheravennoshowpos(ios_base& __str) 853227825Stheraven{ 854227825Stheraven __str.unsetf(ios_base::showpos); 855227825Stheraven return __str; 856227825Stheraven} 857227825Stheraven 858227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 859227825Stheravenios_base& 860227825Stheravenskipws(ios_base& __str) 861227825Stheraven{ 862227825Stheraven __str.setf(ios_base::skipws); 863227825Stheraven return __str; 864227825Stheraven} 865227825Stheraven 866227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 867227825Stheravenios_base& 868227825Stheravennoskipws(ios_base& __str) 869227825Stheraven{ 870227825Stheraven __str.unsetf(ios_base::skipws); 871227825Stheraven return __str; 872227825Stheraven} 873227825Stheraven 874227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 875227825Stheravenios_base& 876227825Stheravenuppercase(ios_base& __str) 877227825Stheraven{ 878227825Stheraven __str.setf(ios_base::uppercase); 879227825Stheraven return __str; 880227825Stheraven} 881227825Stheraven 882227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 883227825Stheravenios_base& 884227825Stheravennouppercase(ios_base& __str) 885227825Stheraven{ 886227825Stheraven __str.unsetf(ios_base::uppercase); 887227825Stheraven return __str; 888227825Stheraven} 889227825Stheraven 890227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 891227825Stheravenios_base& 892227825Stheravenunitbuf(ios_base& __str) 893227825Stheraven{ 894227825Stheraven __str.setf(ios_base::unitbuf); 895227825Stheraven return __str; 896227825Stheraven} 897227825Stheraven 898227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 899227825Stheravenios_base& 900227825Stheravennounitbuf(ios_base& __str) 901227825Stheraven{ 902227825Stheraven __str.unsetf(ios_base::unitbuf); 903227825Stheraven return __str; 904227825Stheraven} 905227825Stheraven 906227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 907227825Stheravenios_base& 908227825Stheraveninternal(ios_base& __str) 909227825Stheraven{ 910227825Stheraven __str.setf(ios_base::internal, ios_base::adjustfield); 911227825Stheraven return __str; 912227825Stheraven} 913227825Stheraven 914227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 915227825Stheravenios_base& 916227825Stheravenleft(ios_base& __str) 917227825Stheraven{ 918227825Stheraven __str.setf(ios_base::left, ios_base::adjustfield); 919227825Stheraven return __str; 920227825Stheraven} 921227825Stheraven 922227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 923227825Stheravenios_base& 924227825Stheravenright(ios_base& __str) 925227825Stheraven{ 926227825Stheraven __str.setf(ios_base::right, ios_base::adjustfield); 927227825Stheraven return __str; 928227825Stheraven} 929227825Stheraven 930227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 931227825Stheravenios_base& 932227825Stheravendec(ios_base& __str) 933227825Stheraven{ 934227825Stheraven __str.setf(ios_base::dec, ios_base::basefield); 935227825Stheraven return __str; 936227825Stheraven} 937227825Stheraven 938227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 939227825Stheravenios_base& 940227825Stheravenhex(ios_base& __str) 941227825Stheraven{ 942227825Stheraven __str.setf(ios_base::hex, ios_base::basefield); 943227825Stheraven return __str; 944227825Stheraven} 945227825Stheraven 946227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 947227825Stheravenios_base& 948227825Stheravenoct(ios_base& __str) 949227825Stheraven{ 950227825Stheraven __str.setf(ios_base::oct, ios_base::basefield); 951227825Stheraven return __str; 952227825Stheraven} 953227825Stheraven 954227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 955227825Stheravenios_base& 956227825Stheravenfixed(ios_base& __str) 957227825Stheraven{ 958227825Stheraven __str.setf(ios_base::fixed, ios_base::floatfield); 959227825Stheraven return __str; 960227825Stheraven} 961227825Stheraven 962227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 963227825Stheravenios_base& 964227825Stheravenscientific(ios_base& __str) 965227825Stheraven{ 966227825Stheraven __str.setf(ios_base::scientific, ios_base::floatfield); 967227825Stheraven return __str; 968227825Stheraven} 969227825Stheraven 970227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 971227825Stheravenios_base& 972227825Stheravenhexfloat(ios_base& __str) 973227825Stheraven{ 974227825Stheraven __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); 975227825Stheraven return __str; 976227825Stheraven} 977227825Stheraven 978227825Stheraveninline _LIBCPP_INLINE_VISIBILITY 979227825Stheravenios_base& 980227825Stheravendefaultfloat(ios_base& __str) 981227825Stheraven{ 982227825Stheraven __str.unsetf(ios_base::floatfield); 983227825Stheraven return __str; 984227825Stheraven} 985227825Stheraven 986227825Stheraven_LIBCPP_END_NAMESPACE_STD 987227825Stheraven 988227825Stheraven#endif // _LIBCPP_IOS 989