ios revision 227825
1// -*- C++ -*-
2//===---------------------------- ios -------------------------------------===//
3//
4//                     The LLVM Compiler Infrastructure
5//
6// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
8//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_IOS
12#define _LIBCPP_IOS
13
14/*
15    ios synopsis
16
17#include <iosfwd>
18
19namespace std
20{
21
22typedef OFF_T streamoff;
23typedef SZ_T streamsize;
24template <class stateT> class fpos;
25
26class ios_base
27{
28public:
29    class failure;
30
31    typedef T1 fmtflags;
32    static const fmtflags boolalpha;
33    static const fmtflags dec;
34    static const fmtflags fixed;
35    static const fmtflags hex;
36    static const fmtflags internal;
37    static const fmtflags left;
38    static const fmtflags oct;
39    static const fmtflags right;
40    static const fmtflags scientific;
41    static const fmtflags showbase;
42    static const fmtflags showpoint;
43    static const fmtflags showpos;
44    static const fmtflags skipws;
45    static const fmtflags unitbuf;
46    static const fmtflags uppercase;
47    static const fmtflags adjustfield;
48    static const fmtflags basefield;
49    static const fmtflags floatfield;
50
51    typedef T2 iostate;
52    static const iostate badbit;
53    static const iostate eofbit;
54    static const iostate failbit;
55    static const iostate goodbit;
56
57    typedef T3 openmode;
58    static const openmode app;
59    static const openmode ate;
60    static const openmode binary;
61    static const openmode in;
62    static const openmode out;
63    static const openmode trunc;
64
65    typedef T4 seekdir;
66    static const seekdir beg;
67    static const seekdir cur;
68    static const seekdir end;
69
70    class Init;
71
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);
78
79    streamsize precision() const;
80    streamsize precision(streamsize prec);
81    streamsize width() const;
82    streamsize width(streamsize wide);
83
84    // 27.5.2.3 locales:
85    locale imbue(const locale& loc);
86    locale getloc() const;
87
88    // 27.5.2.5 storage:
89    static int xalloc();
90    long& iword(int index);
91    void*& pword(int index);
92
93    // destructor
94    virtual ~ios_base();
95
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);
100
101    ios_base(const ios_base&) = delete;
102    ios_base& operator=(const ios_base&) = delete;
103
104    static bool sync_with_stdio(bool sync = true);
105
106protected:
107    ios_base();
108};
109
110template <class charT, class traits = char_traits<charT> >
111class basic_ios
112    : public ios_base
113{
114public:
115    // types:
116    typedef charT char_type;
117    typedef typename traits::int_type int_type;
118    typedef typename traits::pos_type pos_type;
119    typedef typename traits::off_type off_type;
120    typedef traits traits_type;
121
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);
127    bool good() const;
128    bool eof() const;
129    bool fail() const;
130    bool bad() const;
131
132    iostate exceptions() const;
133    void exceptions(iostate except);
134
135    // 27.5.4.1 Constructor/destructor:
136    explicit basic_ios(basic_streambuf<charT,traits>* sb);
137    virtual ~basic_ios();
138
139    // 27.5.4.2 Members:
140    basic_ostream<charT,traits>* tie() const;
141    basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
142
143    basic_streambuf<charT,traits>* rdbuf() const;
144    basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
145
146    basic_ios& copyfmt(const basic_ios& rhs);
147
148    char_type fill() const;
149    char_type fill(char_type ch);
150
151    locale imbue(const locale& loc);
152
153    char narrow(char_type c, char dfault) const;
154    char_type widen(char c) const;
155
156    basic_ios(const basic_ios& ) = delete;
157    basic_ios& operator=(const basic_ios&) = delete;
158
159protected:
160    basic_ios();
161    void init(basic_streambuf<charT,traits>* sb);
162    void move(basic_ios& rhs);
163    void swap(basic_ios& rhs);
164    void set_rdbuf(basic_streambuf<charT, traits>* sb);
165};
166
167// 27.5.5, manipulators:
168ios_base& boolalpha (ios_base& str);
169ios_base& noboolalpha(ios_base& str);
170ios_base& showbase (ios_base& str);
171ios_base& noshowbase (ios_base& str);
172ios_base& showpoint (ios_base& str);
173ios_base& noshowpoint(ios_base& str);
174ios_base& showpos (ios_base& str);
175ios_base& noshowpos (ios_base& str);
176ios_base& skipws (ios_base& str);
177ios_base& noskipws (ios_base& str);
178ios_base& uppercase (ios_base& str);
179ios_base& nouppercase(ios_base& str);
180ios_base& unitbuf (ios_base& str);
181ios_base& nounitbuf (ios_base& str);
182
183// 27.5.5.2 adjustfield:
184ios_base& internal (ios_base& str);
185ios_base& left (ios_base& str);
186ios_base& right (ios_base& str);
187
188// 27.5.5.3 basefield:
189ios_base& dec (ios_base& str);
190ios_base& hex (ios_base& str);
191ios_base& oct (ios_base& str);
192
193// 27.5.5.4 floatfield:
194ios_base& fixed (ios_base& str);
195ios_base& scientific (ios_base& str);
196ios_base& hexfloat (ios_base& str);
197ios_base& defaultfloat(ios_base& str);
198
199// 27.5.5.5 error reporting:
200enum class io_errc
201{
202    stream = 1
203};
204
205concept_map ErrorCodeEnum<io_errc> { };
206error_code make_error_code(io_errc e);
207error_condition make_error_condition(io_errc e);
208storage-class-specifier const error_category& iostream_category;
209
210}  // std
211
212*/
213
214#include <__config>
215#include <iosfwd>
216#include <__locale>
217#include <system_error>
218
219#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
220#pragma GCC system_header
221#endif
222
223_LIBCPP_BEGIN_NAMESPACE_STD
224
225typedef ptrdiff_t streamsize;
226
227class _LIBCPP_VISIBLE ios_base
228{
229public:
230    class failure;
231
232    typedef unsigned int fmtflags;
233    static const fmtflags boolalpha   = 0x0001;
234    static const fmtflags dec         = 0x0002;
235    static const fmtflags fixed       = 0x0004;
236    static const fmtflags hex         = 0x0008;
237    static const fmtflags internal    = 0x0010;
238    static const fmtflags left        = 0x0020;
239    static const fmtflags oct         = 0x0040;
240    static const fmtflags right       = 0x0080;
241    static const fmtflags scientific  = 0x0100;
242    static const fmtflags showbase    = 0x0200;
243    static const fmtflags showpoint   = 0x0400;
244    static const fmtflags showpos     = 0x0800;
245    static const fmtflags skipws      = 0x1000;
246    static const fmtflags unitbuf     = 0x2000;
247    static const fmtflags uppercase   = 0x4000;
248    static const fmtflags adjustfield = left | right | internal;
249    static const fmtflags basefield   = dec | oct | hex;
250    static const fmtflags floatfield  = scientific | fixed;
251
252    typedef unsigned int iostate;
253    typedef iostate      io_state;
254    static const iostate badbit  = 0x1;
255    static const iostate eofbit  = 0x2;
256    static const iostate failbit = 0x4;
257    static const iostate goodbit = 0x0;
258
259    typedef unsigned int openmode;
260    typedef openmode     open_mode;
261    static const openmode app    = 0x01;
262    static const openmode ate    = 0x02;
263    static const openmode binary = 0x04;
264    static const openmode in     = 0x08;
265    static const openmode out    = 0x10;
266    static const openmode trunc  = 0x20;
267
268    enum seekdir {beg, cur, end};
269    typedef seekdir seek_dir;
270
271    typedef _VSTD::streamoff streamoff;
272    typedef _VSTD::streampos streampos;
273
274    class Init;
275
276    // 27.5.2.2 fmtflags state:
277    _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
278    _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
279    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
280    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
281    _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
282
283    _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
284    _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
285    _LIBCPP_INLINE_VISIBILITY streamsize width() const;
286    _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
287
288    // 27.5.2.3 locales:
289    locale imbue(const locale& __loc);
290    locale getloc() const;
291
292    // 27.5.2.5 storage:
293    static int xalloc();
294    long& iword(int __index);
295    void*& pword(int __index);
296
297    // destructor
298    virtual ~ios_base();
299
300    // 27.5.2.6 callbacks;
301    enum event { erase_event, imbue_event, copyfmt_event };
302    typedef void (*event_callback)(event, ios_base&, int __index);
303    void register_callback(event_callback __fn, int __index);
304
305private:
306    ios_base(const ios_base&); // = delete;
307    ios_base& operator=(const ios_base&); // = delete;
308
309public:
310    static bool sync_with_stdio(bool __sync = true);
311
312    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
313    void clear(iostate __state = goodbit);
314    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
315
316    _LIBCPP_INLINE_VISIBILITY bool good() const;
317    _LIBCPP_INLINE_VISIBILITY bool eof() const;
318    _LIBCPP_INLINE_VISIBILITY bool fail() const;
319    _LIBCPP_INLINE_VISIBILITY bool bad() const;
320
321    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
322    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
323
324    void __set_badbit_and_consider_rethrow();
325    void __set_failbit_and_consider_rethrow();
326
327protected:
328    _LIBCPP_INLINE_VISIBILITY
329    ios_base() {// purposefully does no initialization
330               }
331
332    void init(void* __sb);
333    _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
334
335    _LIBCPP_ALWAYS_INLINE
336    void rdbuf(void* __sb)
337    {
338        __rdbuf_ = __sb;
339        clear();
340    }
341
342    void __call_callbacks(event);
343    void copyfmt(const ios_base&);
344    void move(ios_base&);
345    void swap(ios_base&);
346
347    _LIBCPP_ALWAYS_INLINE
348    void set_rdbuf(void* __sb)
349    {
350        __rdbuf_ = __sb;
351    }
352
353private:
354    // All data members must be scalars
355    fmtflags        __fmtflags_;
356    streamsize      __precision_;
357    streamsize      __width_;
358    iostate         __rdstate_;
359    iostate         __exceptions_;
360    void*           __rdbuf_;
361    void*           __loc_;
362    event_callback* __fn_;
363    int*            __index_;
364    size_t          __event_size_;
365    size_t          __event_cap_;
366    static int      __xindex_;
367    long*           __iarray_;
368    size_t          __iarray_size_;
369    size_t          __iarray_cap_;
370    void**          __parray_;
371    size_t          __parray_size_;
372    size_t          __parray_cap_;
373};
374
375//enum class io_errc
376struct _LIBCPP_VISIBLE io_errc
377{
378enum _ {
379    stream = 1
380};
381    _ __v_;
382
383    _LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
384    _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
385};
386
387template <>
388struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
389template <>
390struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
391
392_LIBCPP_VISIBLE
393const error_category& iostream_category();
394
395inline _LIBCPP_INLINE_VISIBILITY
396error_code
397make_error_code(io_errc __e)
398{
399    return error_code(static_cast<int>(__e), iostream_category());
400}
401
402inline _LIBCPP_INLINE_VISIBILITY
403error_condition
404make_error_condition(io_errc __e)
405{
406    return error_condition(static_cast<int>(__e), iostream_category());
407}
408
409class _LIBCPP_EXCEPTION_ABI ios_base::failure
410    : public system_error
411{
412public:
413    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
414    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
415    virtual ~failure() throw();
416};
417
418class _LIBCPP_VISIBLE ios_base::Init
419{
420public:
421    Init();
422    ~Init();
423};
424
425// fmtflags
426
427inline _LIBCPP_INLINE_VISIBILITY
428ios_base::fmtflags
429ios_base::flags() const
430{
431    return __fmtflags_;
432}
433
434inline _LIBCPP_INLINE_VISIBILITY
435ios_base::fmtflags
436ios_base::flags(fmtflags __fmtfl)
437{
438    fmtflags __r = __fmtflags_;
439    __fmtflags_ = __fmtfl;
440    return __r;
441}
442
443inline _LIBCPP_INLINE_VISIBILITY
444ios_base::fmtflags
445ios_base::setf(fmtflags __fmtfl)
446{
447    fmtflags __r = __fmtflags_;
448    __fmtflags_ |= __fmtfl;
449    return __r;
450}
451
452inline _LIBCPP_INLINE_VISIBILITY
453void
454ios_base::unsetf(fmtflags __mask)
455{
456    __fmtflags_ &= ~__mask;
457}
458
459inline _LIBCPP_INLINE_VISIBILITY
460ios_base::fmtflags
461ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
462{
463    fmtflags __r = __fmtflags_;
464    unsetf(__mask);
465    __fmtflags_ |= __fmtfl & __mask;
466    return __r;
467}
468
469// precision
470
471inline _LIBCPP_INLINE_VISIBILITY
472streamsize
473ios_base::precision() const
474{
475    return __precision_;
476}
477
478inline _LIBCPP_INLINE_VISIBILITY
479streamsize
480ios_base::precision(streamsize __prec)
481{
482    streamsize __r = __precision_;
483    __precision_ = __prec;
484    return __r;
485}
486
487// width
488
489inline _LIBCPP_INLINE_VISIBILITY
490streamsize
491ios_base::width() const
492{
493    return __width_;
494}
495
496inline _LIBCPP_INLINE_VISIBILITY
497streamsize
498ios_base::width(streamsize __wide)
499{
500    streamsize __r = __width_;
501    __width_ = __wide;
502    return __r;
503}
504
505// iostate
506
507inline _LIBCPP_INLINE_VISIBILITY
508ios_base::iostate
509ios_base::rdstate() const
510{
511    return __rdstate_;
512}
513
514inline _LIBCPP_INLINE_VISIBILITY
515void
516ios_base::setstate(iostate __state)
517{
518    clear(__rdstate_ | __state);
519}
520
521inline _LIBCPP_INLINE_VISIBILITY
522bool
523ios_base::good() const
524{
525    return __rdstate_ == 0;
526}
527
528inline _LIBCPP_INLINE_VISIBILITY
529bool
530ios_base::eof() const
531{
532    return __rdstate_ & eofbit;
533}
534
535inline _LIBCPP_INLINE_VISIBILITY
536bool
537ios_base::fail() const
538{
539    return __rdstate_ & (failbit | badbit);
540}
541
542inline _LIBCPP_INLINE_VISIBILITY
543bool
544ios_base::bad() const
545{
546    return __rdstate_ & badbit;
547}
548
549inline _LIBCPP_INLINE_VISIBILITY
550ios_base::iostate
551ios_base::exceptions() const
552{
553    return __exceptions_;
554}
555
556inline _LIBCPP_INLINE_VISIBILITY
557void
558ios_base::exceptions(iostate __except)
559{
560    __exceptions_ = __except;
561    clear(__rdstate_);
562}
563
564template <class _CharT, class _Traits>
565class _LIBCPP_VISIBLE basic_ios
566    : public ios_base
567{
568public:
569    // types:
570    typedef _CharT char_type;
571    typedef _Traits traits_type;
572
573    typedef typename traits_type::int_type int_type;
574    typedef typename traits_type::pos_type pos_type;
575    typedef typename traits_type::off_type off_type;
576
577    _LIBCPP_ALWAYS_INLINE // explicit
578        operator bool() const {return !fail();}
579    _LIBCPP_ALWAYS_INLINE bool operator!() const    {return  fail();}
580    _LIBCPP_ALWAYS_INLINE iostate rdstate() const   {return ios_base::rdstate();}
581    _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
582    _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
583    _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
584    _LIBCPP_ALWAYS_INLINE bool eof() const  {return ios_base::eof();}
585    _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
586    _LIBCPP_ALWAYS_INLINE bool bad() const  {return ios_base::bad();}
587
588    _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
589    _LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
590
591    // 27.5.4.1 Constructor/destructor:
592    _LIBCPP_INLINE_VISIBILITY
593    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
594    virtual ~basic_ios();
595
596    // 27.5.4.2 Members:
597    _LIBCPP_INLINE_VISIBILITY 
598    basic_ostream<char_type, traits_type>* tie() const;
599    _LIBCPP_INLINE_VISIBILITY 
600    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
601
602    _LIBCPP_INLINE_VISIBILITY 
603    basic_streambuf<char_type, traits_type>* rdbuf() const;
604    _LIBCPP_INLINE_VISIBILITY 
605    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
606
607    basic_ios& copyfmt(const basic_ios& __rhs);
608
609    _LIBCPP_INLINE_VISIBILITY 
610    char_type fill() const;
611    _LIBCPP_INLINE_VISIBILITY 
612    char_type fill(char_type __ch);
613
614    _LIBCPP_INLINE_VISIBILITY 
615    locale imbue(const locale& __loc);
616
617    _LIBCPP_INLINE_VISIBILITY 
618    char narrow(char_type __c, char __dfault) const;
619    _LIBCPP_INLINE_VISIBILITY 
620    char_type widen(char __c) const;
621
622protected:
623    _LIBCPP_ALWAYS_INLINE
624    basic_ios() {// purposefully does no initialization
625                }
626    _LIBCPP_INLINE_VISIBILITY 
627    void init(basic_streambuf<char_type, traits_type>* __sb);
628
629    _LIBCPP_INLINE_VISIBILITY 
630    void move(basic_ios& __rhs);
631#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
632    _LIBCPP_ALWAYS_INLINE
633    void move(basic_ios&& __rhs) {move(__rhs);}
634#endif
635    _LIBCPP_INLINE_VISIBILITY 
636    void swap(basic_ios& __rhs);
637    _LIBCPP_INLINE_VISIBILITY 
638    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
639private:
640    basic_ostream<char_type, traits_type>* __tie_;
641    char_type __fill_;
642};
643
644template <class _CharT, class _Traits>
645inline _LIBCPP_INLINE_VISIBILITY
646basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
647{
648    init(__sb);
649}
650
651template <class _CharT, class _Traits>
652basic_ios<_CharT, _Traits>::~basic_ios()
653{
654}
655
656template <class _CharT, class _Traits>
657inline _LIBCPP_INLINE_VISIBILITY
658void
659basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
660{
661    ios_base::init(__sb);
662    __tie_ = 0;
663    __fill_ = widen(' ');
664}
665
666template <class _CharT, class _Traits>
667inline _LIBCPP_INLINE_VISIBILITY
668basic_ostream<_CharT, _Traits>*
669basic_ios<_CharT, _Traits>::tie() const
670{
671    return __tie_;
672}
673
674template <class _CharT, class _Traits>
675inline _LIBCPP_INLINE_VISIBILITY
676basic_ostream<_CharT, _Traits>*
677basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
678{
679    basic_ostream<char_type, traits_type>* __r = __tie_;
680    __tie_ = __tiestr;
681    return __r;
682}
683
684template <class _CharT, class _Traits>
685inline _LIBCPP_INLINE_VISIBILITY
686basic_streambuf<_CharT, _Traits>*
687basic_ios<_CharT, _Traits>::rdbuf() const
688{
689    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
690}
691
692template <class _CharT, class _Traits>
693inline _LIBCPP_INLINE_VISIBILITY
694basic_streambuf<_CharT, _Traits>*
695basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
696{
697    basic_streambuf<char_type, traits_type>* __r = rdbuf();
698    ios_base::rdbuf(__sb);
699    return __r;
700}
701
702template <class _CharT, class _Traits>
703inline _LIBCPP_INLINE_VISIBILITY
704locale
705basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
706{
707    locale __r = getloc();
708    ios_base::imbue(__loc);
709    if (rdbuf())
710        rdbuf()->pubimbue(__loc);
711    return __r;
712}
713
714template <class _CharT, class _Traits>
715inline _LIBCPP_INLINE_VISIBILITY
716char
717basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
718{
719    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
720}
721
722template <class _CharT, class _Traits>
723inline _LIBCPP_INLINE_VISIBILITY
724_CharT
725basic_ios<_CharT, _Traits>::widen(char __c) const
726{
727    return use_facet<ctype<char_type> >(getloc()).widen(__c);
728}
729
730template <class _CharT, class _Traits>
731inline _LIBCPP_INLINE_VISIBILITY
732_CharT
733basic_ios<_CharT, _Traits>::fill() const
734{
735    return __fill_;
736}
737
738template <class _CharT, class _Traits>
739inline _LIBCPP_INLINE_VISIBILITY
740_CharT
741basic_ios<_CharT, _Traits>::fill(char_type __ch)
742{
743    char_type __r = __fill_;
744    __fill_ = __ch;
745    return __r;
746}
747
748template <class _CharT, class _Traits>
749basic_ios<_CharT, _Traits>&
750basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
751{
752    if (this != &__rhs)
753    {
754        __call_callbacks(erase_event);
755        ios_base::copyfmt(__rhs);
756        __tie_ = __rhs.__tie_;
757        __fill_ = __rhs.__fill_;
758        __call_callbacks(copyfmt_event);
759        exceptions(__rhs.exceptions());
760    }
761    return *this;
762}
763
764template <class _CharT, class _Traits>
765inline _LIBCPP_INLINE_VISIBILITY
766void
767basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
768{
769    ios_base::move(__rhs);
770    __tie_ = __rhs.__tie_;
771    __rhs.__tie_ = 0;
772    __fill_ = __rhs.__fill_;
773}
774
775template <class _CharT, class _Traits>
776inline _LIBCPP_INLINE_VISIBILITY
777void
778basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
779{
780    ios_base::swap(__rhs);
781    _VSTD::swap(__tie_, __rhs.__tie_);
782    _VSTD::swap(__fill_, __rhs.__fill_);
783}
784
785template <class _CharT, class _Traits>
786inline _LIBCPP_INLINE_VISIBILITY
787void
788basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
789{
790    ios_base::set_rdbuf(__sb);
791}
792
793inline _LIBCPP_INLINE_VISIBILITY
794ios_base&
795boolalpha(ios_base& __str)
796{
797    __str.setf(ios_base::boolalpha);
798    return __str;
799}
800
801inline _LIBCPP_INLINE_VISIBILITY
802ios_base&
803noboolalpha(ios_base& __str)
804{
805    __str.unsetf(ios_base::boolalpha);
806    return __str;
807}
808
809inline _LIBCPP_INLINE_VISIBILITY
810ios_base&
811showbase(ios_base& __str)
812{
813    __str.setf(ios_base::showbase);
814    return __str;
815}
816
817inline _LIBCPP_INLINE_VISIBILITY
818ios_base&
819noshowbase(ios_base& __str)
820{
821    __str.unsetf(ios_base::showbase);
822    return __str;
823}
824
825inline _LIBCPP_INLINE_VISIBILITY
826ios_base&
827showpoint(ios_base& __str)
828{
829    __str.setf(ios_base::showpoint);
830    return __str;
831}
832
833inline _LIBCPP_INLINE_VISIBILITY
834ios_base&
835noshowpoint(ios_base& __str)
836{
837    __str.unsetf(ios_base::showpoint);
838    return __str;
839}
840
841inline _LIBCPP_INLINE_VISIBILITY
842ios_base&
843showpos(ios_base& __str)
844{
845    __str.setf(ios_base::showpos);
846    return __str;
847}
848
849inline _LIBCPP_INLINE_VISIBILITY
850ios_base&
851noshowpos(ios_base& __str)
852{
853    __str.unsetf(ios_base::showpos);
854    return __str;
855}
856
857inline _LIBCPP_INLINE_VISIBILITY
858ios_base&
859skipws(ios_base& __str)
860{
861    __str.setf(ios_base::skipws);
862    return __str;
863}
864
865inline _LIBCPP_INLINE_VISIBILITY
866ios_base&
867noskipws(ios_base& __str)
868{
869    __str.unsetf(ios_base::skipws);
870    return __str;
871}
872
873inline _LIBCPP_INLINE_VISIBILITY
874ios_base&
875uppercase(ios_base& __str)
876{
877    __str.setf(ios_base::uppercase);
878    return __str;
879}
880
881inline _LIBCPP_INLINE_VISIBILITY
882ios_base&
883nouppercase(ios_base& __str)
884{
885    __str.unsetf(ios_base::uppercase);
886    return __str;
887}
888
889inline _LIBCPP_INLINE_VISIBILITY
890ios_base&
891unitbuf(ios_base& __str)
892{
893    __str.setf(ios_base::unitbuf);
894    return __str;
895}
896
897inline _LIBCPP_INLINE_VISIBILITY
898ios_base&
899nounitbuf(ios_base& __str)
900{
901    __str.unsetf(ios_base::unitbuf);
902    return __str;
903}
904
905inline _LIBCPP_INLINE_VISIBILITY
906ios_base&
907internal(ios_base& __str)
908{
909    __str.setf(ios_base::internal, ios_base::adjustfield);
910    return __str;
911}
912
913inline _LIBCPP_INLINE_VISIBILITY
914ios_base&
915left(ios_base& __str)
916{
917    __str.setf(ios_base::left, ios_base::adjustfield);
918    return __str;
919}
920
921inline _LIBCPP_INLINE_VISIBILITY
922ios_base&
923right(ios_base& __str)
924{
925    __str.setf(ios_base::right, ios_base::adjustfield);
926    return __str;
927}
928
929inline _LIBCPP_INLINE_VISIBILITY
930ios_base&
931dec(ios_base& __str)
932{
933    __str.setf(ios_base::dec, ios_base::basefield);
934    return __str;
935}
936
937inline _LIBCPP_INLINE_VISIBILITY
938ios_base&
939hex(ios_base& __str)
940{
941    __str.setf(ios_base::hex, ios_base::basefield);
942    return __str;
943}
944
945inline _LIBCPP_INLINE_VISIBILITY
946ios_base&
947oct(ios_base& __str)
948{
949    __str.setf(ios_base::oct, ios_base::basefield);
950    return __str;
951}
952
953inline _LIBCPP_INLINE_VISIBILITY
954ios_base&
955fixed(ios_base& __str)
956{
957    __str.setf(ios_base::fixed, ios_base::floatfield);
958    return __str;
959}
960
961inline _LIBCPP_INLINE_VISIBILITY
962ios_base&
963scientific(ios_base& __str)
964{
965    __str.setf(ios_base::scientific, ios_base::floatfield);
966    return __str;
967}
968
969inline _LIBCPP_INLINE_VISIBILITY
970ios_base&
971hexfloat(ios_base& __str)
972{
973    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
974    return __str;
975}
976
977inline _LIBCPP_INLINE_VISIBILITY
978ios_base&
979defaultfloat(ios_base& __str)
980{
981    __str.unsetf(ios_base::floatfield);
982    return __str;
983}
984
985_LIBCPP_END_NAMESPACE_STD
986
987#endif  // _LIBCPP_IOS
988