2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
21 typedef OFF_T streamoff;
22 typedef SZ_T streamsize;
23 template <class stateT> class fpos;
31 static constexpr fmtflags boolalpha;
32 static constexpr fmtflags dec;
33 static constexpr fmtflags fixed;
34 static constexpr fmtflags hex;
35 static constexpr fmtflags internal;
36 static constexpr fmtflags left;
37 static constexpr fmtflags oct;
38 static constexpr fmtflags right;
39 static constexpr fmtflags scientific;
40 static constexpr fmtflags showbase;
41 static constexpr fmtflags showpoint;
42 static constexpr fmtflags showpos;
43 static constexpr fmtflags skipws;
44 static constexpr fmtflags unitbuf;
45 static constexpr fmtflags uppercase;
46 static constexpr fmtflags adjustfield;
47 static constexpr fmtflags basefield;
48 static constexpr fmtflags floatfield;
51 static constexpr iostate badbit;
52 static constexpr iostate eofbit;
53 static constexpr iostate failbit;
54 static constexpr iostate goodbit;
57 static constexpr openmode app;
58 static constexpr openmode ate;
59 static constexpr openmode binary;
60 static constexpr openmode in;
61 static constexpr openmode noreplace; // since C++23
62 static constexpr openmode out;
63 static constexpr openmode trunc;
66 static constexpr seekdir beg;
67 static constexpr seekdir cur;
68 static constexpr seekdir end;
72 // 27.5.2.2 fmtflags state:
73 fmtflags flags() const;
74 fmtflags flags(fmtflags fmtfl);
75 fmtflags setf(fmtflags fmtfl);
76 fmtflags setf(fmtflags fmtfl, fmtflags mask);
77 void unsetf(fmtflags mask);
79 streamsize precision() const;
80 streamsize precision(streamsize prec);
81 streamsize width() const;
82 streamsize width(streamsize wide);
85 locale imbue(const locale& loc);
86 locale getloc() const;
90 long& iword(int index);
91 void*& pword(int index);
96 // 27.5.2.6 callbacks;
97 enum event { erase_event, imbue_event, copyfmt_event };
98 typedef void (*event_callback)(event, ios_base&, int index);
99 void register_callback(event_callback fn, int index);
101 ios_base(const ios_base&) = delete;
102 ios_base& operator=(const ios_base&) = delete;
104 static bool sync_with_stdio(bool sync = true);
110 template <class charT, class traits = char_traits<charT> >
116 typedef charT char_type;
117 typedef typename traits::int_type int_type; // removed in C++17
118 typedef typename traits::pos_type pos_type; // removed in C++17
119 typedef typename traits::off_type off_type; // removed in C++17
120 typedef traits traits_type;
122 operator unspecified-bool-type() const;
123 bool operator!() const;
124 iostate rdstate() const;
125 void clear(iostate state = goodbit);
126 void setstate(iostate state);
132 iostate exceptions() const;
133 void exceptions(iostate except);
135 // 27.5.4.1 Constructor/destructor:
136 explicit basic_ios(basic_streambuf<charT,traits>* sb);
137 virtual ~basic_ios();
140 basic_ostream<charT,traits>* tie() const;
141 basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
143 basic_streambuf<charT,traits>* rdbuf() const;
144 basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
146 basic_ios& copyfmt(const basic_ios& rhs);
148 char_type fill() const;
149 char_type fill(char_type ch);
151 locale imbue(const locale& loc);
153 char narrow(char_type c, char dfault) const;
154 char_type widen(char c) const;
156 basic_ios(const basic_ios& ) = delete;
157 basic_ios& operator=(const basic_ios&) = delete;
161 void init(basic_streambuf<charT,traits>* sb);
162 void move(basic_ios& rhs);
163 void swap(basic_ios& rhs) noexcept;
164 void set_rdbuf(basic_streambuf<charT, traits>* sb);
167 // 27.5.5, manipulators:
168 ios_base& boolalpha (ios_base& str);
169 ios_base& noboolalpha(ios_base& str);
170 ios_base& showbase (ios_base& str);
171 ios_base& noshowbase (ios_base& str);
172 ios_base& showpoint (ios_base& str);
173 ios_base& noshowpoint(ios_base& str);
174 ios_base& showpos (ios_base& str);
175 ios_base& noshowpos (ios_base& str);
176 ios_base& skipws (ios_base& str);
177 ios_base& noskipws (ios_base& str);
178 ios_base& uppercase (ios_base& str);
179 ios_base& nouppercase(ios_base& str);
180 ios_base& unitbuf (ios_base& str);
181 ios_base& nounitbuf (ios_base& str);
183 // 27.5.5.2 adjustfield:
184 ios_base& internal (ios_base& str);
185 ios_base& left (ios_base& str);
186 ios_base& right (ios_base& str);
188 // 27.5.5.3 basefield:
189 ios_base& dec (ios_base& str);
190 ios_base& hex (ios_base& str);
191 ios_base& oct (ios_base& str);
193 // 27.5.5.4 floatfield:
194 ios_base& fixed (ios_base& str);
195 ios_base& scientific (ios_base& str);
196 ios_base& hexfloat (ios_base& str);
197 ios_base& defaultfloat(ios_base& str);
199 // 27.5.5.5 error reporting:
205 concept_map ErrorCodeEnum<io_errc> { };
206 error_code make_error_code(io_errc e) noexcept;
207 error_condition make_error_condition(io_errc e) noexcept;
208 storage-class-specifier const error_category& iostream_category() noexcept;
216 #if defined(_LIBCPP_HAS_NO_LOCALIZATION)
217 # error "The iostreams library is not supported since libc++ has been configured without support for localization."
220 #include <__assert> // all public C++ headers provide the assertion handler
221 #include <__fwd/ios.h>
222 #include <__ios/fpos.h>
224 #include <__system_error/error_category.h>
225 #include <__system_error/error_code.h>
226 #include <__system_error/error_condition.h>
227 #include <__system_error/system_error.h>
228 #include <__utility/swap.h>
229 #include <__verbose_abort>
232 // standard-mandated includes
237 #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
238 # include <__atomic/atomic.h> // for __xindex_
241 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
242 # pragma GCC system_header
245 _LIBCPP_BEGIN_NAMESPACE_STD
247 typedef ptrdiff_t streamsize;
249 class _LIBCPP_EXPORTED_FROM_ABI ios_base {
251 class _LIBCPP_EXPORTED_FROM_ABI failure;
253 typedef unsigned int fmtflags;
254 static const fmtflags boolalpha = 0x0001;
255 static const fmtflags dec = 0x0002;
256 static const fmtflags fixed = 0x0004;
257 static const fmtflags hex = 0x0008;
258 static const fmtflags internal = 0x0010;
259 static const fmtflags left = 0x0020;
260 static const fmtflags oct = 0x0040;
261 static const fmtflags right = 0x0080;
262 static const fmtflags scientific = 0x0100;
263 static const fmtflags showbase = 0x0200;
264 static const fmtflags showpoint = 0x0400;
265 static const fmtflags showpos = 0x0800;
266 static const fmtflags skipws = 0x1000;
267 static const fmtflags unitbuf = 0x2000;
268 static const fmtflags uppercase = 0x4000;
269 static const fmtflags adjustfield = left | right | internal;
270 static const fmtflags basefield = dec | oct | hex;
271 static const fmtflags floatfield = scientific | fixed;
273 typedef unsigned int iostate;
274 static const iostate badbit = 0x1;
275 static const iostate eofbit = 0x2;
276 static const iostate failbit = 0x4;
277 static const iostate goodbit = 0x0;
279 typedef unsigned int openmode;
280 static const openmode app = 0x01;
281 static const openmode ate = 0x02;
282 static const openmode binary = 0x04;
283 static const openmode in = 0x08;
284 static const openmode out = 0x10;
285 static const openmode trunc = 0x20;
286 #if _LIBCPP_STD_VER >= 23
287 static const openmode noreplace = 0x40;
290 enum seekdir { beg, cur, end };
292 #if _LIBCPP_STD_VER <= 14
293 typedef iostate io_state;
294 typedef openmode open_mode;
295 typedef seekdir seek_dir;
297 typedef std::streamoff streamoff;
298 typedef std::streampos streampos;
301 class _LIBCPP_EXPORTED_FROM_ABI Init;
303 // 27.5.2.2 fmtflags state:
304 _LIBCPP_HIDE_FROM_ABI fmtflags flags() const;
305 _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl);
306 _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl);
307 _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
308 _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask);
310 _LIBCPP_HIDE_FROM_ABI streamsize precision() const;
311 _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec);
312 _LIBCPP_HIDE_FROM_ABI streamsize width() const;
313 _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide);
316 locale imbue(const locale& __loc);
317 locale getloc() const;
321 long& iword(int __index);
322 void*& pword(int __index);
327 // 27.5.2.6 callbacks;
328 enum event { erase_event, imbue_event, copyfmt_event };
329 typedef void (*event_callback)(event, ios_base&, int __index);
330 void register_callback(event_callback __fn, int __index);
332 ios_base(const ios_base&) = delete;
333 ios_base& operator=(const ios_base&) = delete;
335 static bool sync_with_stdio(bool __sync = true);
337 _LIBCPP_HIDE_FROM_ABI iostate rdstate() const;
338 void clear(iostate __state = goodbit);
339 _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state);
341 _LIBCPP_HIDE_FROM_ABI bool good() const;
342 _LIBCPP_HIDE_FROM_ABI bool eof() const;
343 _LIBCPP_HIDE_FROM_ABI bool fail() const;
344 _LIBCPP_HIDE_FROM_ABI bool bad() const;
346 _LIBCPP_HIDE_FROM_ABI iostate exceptions() const;
347 _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate);
349 void __set_badbit_and_consider_rethrow();
350 void __set_failbit_and_consider_rethrow();
352 _LIBCPP_HIDE_FROM_ABI void __setstate_nothrow(iostate __state) {
354 __rdstate_ |= __state;
356 __rdstate_ |= __state | ios_base::badbit;
360 _LIBCPP_HIDE_FROM_ABI ios_base() { // purposefully does no initialization
363 void init(void* __sb);
364 _LIBCPP_HIDE_FROM_ABI void* rdbuf() const { return __rdbuf_; }
366 _LIBCPP_HIDE_FROM_ABI void rdbuf(void* __sb) {
371 void __call_callbacks(event);
372 void copyfmt(const ios_base&);
373 void move(ios_base&);
374 void swap(ios_base&) _NOEXCEPT;
376 _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; }
379 // All data members must be scalars
380 fmtflags __fmtflags_;
381 streamsize __precision_;
384 iostate __exceptions_;
387 event_callback* __fn_;
389 size_t __event_size_;
391 // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
392 // enabled with clang.
393 #if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
394 static atomic<int> __xindex_;
396 static int __xindex_;
399 size_t __iarray_size_;
400 size_t __iarray_cap_;
402 size_t __parray_size_;
403 size_t __parray_cap_;
406 // enum class io_errc
407 _LIBCPP_DECLARE_STRONG_ENUM(io_errc){stream = 1};
408 _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
411 struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {};
413 #ifdef _LIBCPP_CXX03_LANG
415 struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {};
418 _LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT;
420 inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT {
421 return error_code(static_cast<int>(__e), iostream_category());
424 inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT {
425 return error_condition(static_cast<int>(__e), iostream_category());
428 class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure : public system_error {
430 explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
431 explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
432 _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default;
433 ~failure() _NOEXCEPT override;
436 _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) {
437 #ifndef _LIBCPP_HAS_NO_EXCEPTIONS
438 throw ios_base::failure(__msg);
440 _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg);
444 class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init {
452 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags() const { return __fmtflags_; }
454 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) {
455 fmtflags __r = __fmtflags_;
456 __fmtflags_ = __fmtfl;
460 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) {
461 fmtflags __r = __fmtflags_;
462 __fmtflags_ |= __fmtfl;
466 inline _LIBCPP_HIDE_FROM_ABI void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; }
468 inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) {
469 fmtflags __r = __fmtflags_;
471 __fmtflags_ |= __fmtfl & __mask;
477 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision() const { return __precision_; }
479 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision(streamsize __prec) {
480 streamsize __r = __precision_;
481 __precision_ = __prec;
487 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width() const { return __width_; }
489 inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width(streamsize __wide) {
490 streamsize __r = __width_;
497 inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::rdstate() const { return __rdstate_; }
499 inline _LIBCPP_HIDE_FROM_ABI void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); }
501 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::good() const { return __rdstate_ == 0; }
503 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; }
505 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; }
507 inline _LIBCPP_HIDE_FROM_ABI bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; }
509 inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::exceptions() const { return __exceptions_; }
511 inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) {
512 __exceptions_ = __iostate;
516 template <class _CharT, class _Traits>
517 class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base {
520 typedef _CharT char_type;
521 typedef _Traits traits_type;
523 typedef typename traits_type::int_type int_type;
524 typedef typename traits_type::pos_type pos_type;
525 typedef typename traits_type::off_type off_type;
527 static_assert((is_same<_CharT, typename traits_type::char_type>::value),
528 "traits_type::char_type must be the same type as CharT");
530 #ifdef _LIBCPP_CXX03_LANG
531 // Preserve the ability to compare with literal 0,
532 // and implicitly convert to bool, but not implicitly convert to int.
533 _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; }
535 _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); }
538 _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); }
539 _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); }
540 _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); }
541 _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); }
542 _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); }
543 _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); }
544 _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); }
545 _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); }
547 _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); }
548 _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); }
550 // 27.5.4.1 Constructor/destructor:
551 _LIBCPP_HIDE_FROM_ABI explicit basic_ios(basic_streambuf<char_type, traits_type>* __sb);
552 ~basic_ios() override;
555 _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const;
556 _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
558 _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const;
559 _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
561 basic_ios& copyfmt(const basic_ios& __rhs);
563 _LIBCPP_HIDE_FROM_ABI char_type fill() const;
564 _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch);
566 _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc);
568 _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const;
569 _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const;
572 _LIBCPP_HIDE_FROM_ABI basic_ios() { // purposefully does no initialization
574 _LIBCPP_HIDE_FROM_ABI void init(basic_streambuf<char_type, traits_type>* __sb);
576 _LIBCPP_HIDE_FROM_ABI void move(basic_ios& __rhs);
577 _LIBCPP_HIDE_FROM_ABI void move(basic_ios&& __rhs) { move(__rhs); }
578 _LIBCPP_HIDE_FROM_ABI void swap(basic_ios& __rhs) _NOEXCEPT;
579 _LIBCPP_HIDE_FROM_ABI void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
582 basic_ostream<char_type, traits_type>* __tie_;
583 mutable int_type __fill_;
586 template <class _CharT, class _Traits>
587 inline _LIBCPP_HIDE_FROM_ABI basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type, traits_type>* __sb) {
591 template <class _CharT, class _Traits>
592 basic_ios<_CharT, _Traits>::~basic_ios() {}
594 template <class _CharT, class _Traits>
595 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) {
596 ios_base::init(__sb);
598 __fill_ = traits_type::eof();
601 template <class _CharT, class _Traits>
602 inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const {
606 template <class _CharT, class _Traits>
607 inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>*
608 basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) {
609 basic_ostream<char_type, traits_type>* __r = __tie_;
614 template <class _CharT, class _Traits>
615 inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const {
616 return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
619 template <class _CharT, class _Traits>
620 inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>*
621 basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
622 basic_streambuf<char_type, traits_type>* __r = rdbuf();
623 ios_base::rdbuf(__sb);
627 template <class _CharT, class _Traits>
628 inline _LIBCPP_HIDE_FROM_ABI locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) {
629 locale __r = getloc();
630 ios_base::imbue(__loc);
632 rdbuf()->pubimbue(__loc);
636 template <class _CharT, class _Traits>
637 inline _LIBCPP_HIDE_FROM_ABI char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const {
638 return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
641 template <class _CharT, class _Traits>
642 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) const {
643 return std::use_facet<ctype<char_type> >(getloc()).widen(__c);
646 template <class _CharT, class _Traits>
647 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const {
648 if (traits_type::eq_int_type(traits_type::eof(), __fill_))
649 __fill_ = widen(' ');
653 template <class _CharT, class _Traits>
654 inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) {
655 if (traits_type::eq_int_type(traits_type::eof(), __fill_))
656 __fill_ = widen(' ');
657 char_type __r = __fill_;
662 template <class _CharT, class _Traits>
663 basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) {
664 if (this != &__rhs) {
665 __call_callbacks(erase_event);
666 ios_base::copyfmt(__rhs);
667 __tie_ = __rhs.__tie_;
668 __fill_ = __rhs.__fill_;
669 __call_callbacks(copyfmt_event);
670 exceptions(__rhs.exceptions());
675 template <class _CharT, class _Traits>
676 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) {
677 ios_base::move(__rhs);
678 __tie_ = __rhs.__tie_;
679 __rhs.__tie_ = nullptr;
680 __fill_ = __rhs.__fill_;
683 template <class _CharT, class _Traits>
684 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT {
685 ios_base::swap(__rhs);
686 std::swap(__tie_, __rhs.__tie_);
687 std::swap(__fill_, __rhs.__fill_);
690 template <class _CharT, class _Traits>
691 inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) {
692 ios_base::set_rdbuf(__sb);
695 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>;
697 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
698 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>;
701 _LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) {
702 __str.setf(ios_base::boolalpha);
706 _LIBCPP_HIDE_FROM_ABI inline ios_base& noboolalpha(ios_base& __str) {
707 __str.unsetf(ios_base::boolalpha);
711 _LIBCPP_HIDE_FROM_ABI inline ios_base& showbase(ios_base& __str) {
712 __str.setf(ios_base::showbase);
716 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowbase(ios_base& __str) {
717 __str.unsetf(ios_base::showbase);
721 _LIBCPP_HIDE_FROM_ABI inline ios_base& showpoint(ios_base& __str) {
722 __str.setf(ios_base::showpoint);
726 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpoint(ios_base& __str) {
727 __str.unsetf(ios_base::showpoint);
731 _LIBCPP_HIDE_FROM_ABI inline ios_base& showpos(ios_base& __str) {
732 __str.setf(ios_base::showpos);
736 _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpos(ios_base& __str) {
737 __str.unsetf(ios_base::showpos);
741 _LIBCPP_HIDE_FROM_ABI inline ios_base& skipws(ios_base& __str) {
742 __str.setf(ios_base::skipws);
746 _LIBCPP_HIDE_FROM_ABI inline ios_base& noskipws(ios_base& __str) {
747 __str.unsetf(ios_base::skipws);
751 _LIBCPP_HIDE_FROM_ABI inline ios_base& uppercase(ios_base& __str) {
752 __str.setf(ios_base::uppercase);
756 _LIBCPP_HIDE_FROM_ABI inline ios_base& nouppercase(ios_base& __str) {
757 __str.unsetf(ios_base::uppercase);
761 _LIBCPP_HIDE_FROM_ABI inline ios_base& unitbuf(ios_base& __str) {
762 __str.setf(ios_base::unitbuf);
766 _LIBCPP_HIDE_FROM_ABI inline ios_base& nounitbuf(ios_base& __str) {
767 __str.unsetf(ios_base::unitbuf);
771 _LIBCPP_HIDE_FROM_ABI inline ios_base& internal(ios_base& __str) {
772 __str.setf(ios_base::internal, ios_base::adjustfield);
776 _LIBCPP_HIDE_FROM_ABI inline ios_base& left(ios_base& __str) {
777 __str.setf(ios_base::left, ios_base::adjustfield);
781 _LIBCPP_HIDE_FROM_ABI inline ios_base& right(ios_base& __str) {
782 __str.setf(ios_base::right, ios_base::adjustfield);
786 _LIBCPP_HIDE_FROM_ABI inline ios_base& dec(ios_base& __str) {
787 __str.setf(ios_base::dec, ios_base::basefield);
791 _LIBCPP_HIDE_FROM_ABI inline ios_base& hex(ios_base& __str) {
792 __str.setf(ios_base::hex, ios_base::basefield);
796 _LIBCPP_HIDE_FROM_ABI inline ios_base& oct(ios_base& __str) {
797 __str.setf(ios_base::oct, ios_base::basefield);
801 _LIBCPP_HIDE_FROM_ABI inline ios_base& fixed(ios_base& __str) {
802 __str.setf(ios_base::fixed, ios_base::floatfield);
806 _LIBCPP_HIDE_FROM_ABI inline ios_base& scientific(ios_base& __str) {
807 __str.setf(ios_base::scientific, ios_base::floatfield);
811 _LIBCPP_HIDE_FROM_ABI inline ios_base& hexfloat(ios_base& __str) {
812 __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
816 _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) {
817 __str.unsetf(ios_base::floatfield);
821 _LIBCPP_END_NAMESPACE_STD
823 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
829 # include <initializer_list>
833 # include <stdexcept>
834 # include <system_error>
835 # include <type_traits>
839 #endif // _LIBCPP_IOS