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;
117300770Sdim    typedef typename traits::int_type int_type;  // removed in C++17
118300770Sdim    typedef typename traits::pos_type pos_type;  // removed in C++17
119300770Sdim    typedef typename traits::off_type off_type;  // removed in C++17
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> { };
206261272Sdimerror_code make_error_code(io_errc e) noexcept; 
207261272Sdimerror_condition make_error_condition(io_errc e) noexcept; 
208261272Sdimstorage-class-specifier const error_category& iostream_category() noexcept;
209227825Stheraven
210227825Stheraven}  // std
211227825Stheraven
212227825Stheraven*/
213227825Stheraven
214227825Stheraven#include <__config>
215227825Stheraven#include <iosfwd>
216227825Stheraven#include <__locale>
217227825Stheraven#include <system_error>
218227825Stheraven
219300770Sdim#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
220261272Sdim#include <atomic>     // for __xindex_
221261272Sdim#endif
222261272Sdim
223227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
224227825Stheraven#pragma GCC system_header
225227825Stheraven#endif
226227825Stheraven
227227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
228227825Stheraven
229227825Stheraventypedef ptrdiff_t streamsize;
230227825Stheraven
231249989Sdimclass _LIBCPP_TYPE_VIS ios_base
232227825Stheraven{
233227825Stheravenpublic:
234249989Sdim    class _LIBCPP_TYPE_VIS failure;
235227825Stheraven
236227825Stheraven    typedef unsigned int fmtflags;
237227825Stheraven    static const fmtflags boolalpha   = 0x0001;
238227825Stheraven    static const fmtflags dec         = 0x0002;
239227825Stheraven    static const fmtflags fixed       = 0x0004;
240227825Stheraven    static const fmtflags hex         = 0x0008;
241227825Stheraven    static const fmtflags internal    = 0x0010;
242227825Stheraven    static const fmtflags left        = 0x0020;
243227825Stheraven    static const fmtflags oct         = 0x0040;
244227825Stheraven    static const fmtflags right       = 0x0080;
245227825Stheraven    static const fmtflags scientific  = 0x0100;
246227825Stheraven    static const fmtflags showbase    = 0x0200;
247227825Stheraven    static const fmtflags showpoint   = 0x0400;
248227825Stheraven    static const fmtflags showpos     = 0x0800;
249227825Stheraven    static const fmtflags skipws      = 0x1000;
250227825Stheraven    static const fmtflags unitbuf     = 0x2000;
251227825Stheraven    static const fmtflags uppercase   = 0x4000;
252227825Stheraven    static const fmtflags adjustfield = left | right | internal;
253227825Stheraven    static const fmtflags basefield   = dec | oct | hex;
254227825Stheraven    static const fmtflags floatfield  = scientific | fixed;
255227825Stheraven
256227825Stheraven    typedef unsigned int iostate;
257227825Stheraven    static const iostate badbit  = 0x1;
258227825Stheraven    static const iostate eofbit  = 0x2;
259227825Stheraven    static const iostate failbit = 0x4;
260227825Stheraven    static const iostate goodbit = 0x0;
261227825Stheraven
262227825Stheraven    typedef unsigned int openmode;
263227825Stheraven    static const openmode app    = 0x01;
264227825Stheraven    static const openmode ate    = 0x02;
265227825Stheraven    static const openmode binary = 0x04;
266227825Stheraven    static const openmode in     = 0x08;
267227825Stheraven    static const openmode out    = 0x10;
268227825Stheraven    static const openmode trunc  = 0x20;
269227825Stheraven
270227825Stheraven    enum seekdir {beg, cur, end};
271227825Stheraven
272300770Sdim#if _LIBCPP_STD_VER <= 14
273300770Sdim    typedef iostate      io_state;
274300770Sdim    typedef openmode     open_mode;
275300770Sdim    typedef seekdir      seek_dir;
276300770Sdim
277227825Stheraven    typedef _VSTD::streamoff streamoff;
278227825Stheraven    typedef _VSTD::streampos streampos;
279300770Sdim#endif
280227825Stheraven
281249989Sdim    class _LIBCPP_TYPE_VIS Init;
282227825Stheraven
283227825Stheraven    // 27.5.2.2 fmtflags state:
284227825Stheraven    _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
285227825Stheraven    _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
286227825Stheraven    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
287227825Stheraven    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
288227825Stheraven    _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
289227825Stheraven
290227825Stheraven    _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
291227825Stheraven    _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
292227825Stheraven    _LIBCPP_INLINE_VISIBILITY streamsize width() const;
293227825Stheraven    _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
294227825Stheraven
295227825Stheraven    // 27.5.2.3 locales:
296227825Stheraven    locale imbue(const locale& __loc);
297227825Stheraven    locale getloc() const;
298227825Stheraven
299227825Stheraven    // 27.5.2.5 storage:
300227825Stheraven    static int xalloc();
301227825Stheraven    long& iword(int __index);
302227825Stheraven    void*& pword(int __index);
303227825Stheraven
304227825Stheraven    // destructor
305227825Stheraven    virtual ~ios_base();
306227825Stheraven
307227825Stheraven    // 27.5.2.6 callbacks;
308227825Stheraven    enum event { erase_event, imbue_event, copyfmt_event };
309227825Stheraven    typedef void (*event_callback)(event, ios_base&, int __index);
310227825Stheraven    void register_callback(event_callback __fn, int __index);
311227825Stheraven
312227825Stheravenprivate:
313227825Stheraven    ios_base(const ios_base&); // = delete;
314227825Stheraven    ios_base& operator=(const ios_base&); // = delete;
315227825Stheraven
316227825Stheravenpublic:
317227825Stheraven    static bool sync_with_stdio(bool __sync = true);
318227825Stheraven
319227825Stheraven    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
320227825Stheraven    void clear(iostate __state = goodbit);
321227825Stheraven    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
322227825Stheraven
323227825Stheraven    _LIBCPP_INLINE_VISIBILITY bool good() const;
324227825Stheraven    _LIBCPP_INLINE_VISIBILITY bool eof() const;
325227825Stheraven    _LIBCPP_INLINE_VISIBILITY bool fail() const;
326227825Stheraven    _LIBCPP_INLINE_VISIBILITY bool bad() const;
327227825Stheraven
328227825Stheraven    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
329261272Sdim    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
330227825Stheraven
331227825Stheraven    void __set_badbit_and_consider_rethrow();
332227825Stheraven    void __set_failbit_and_consider_rethrow();
333227825Stheraven
334227825Stheravenprotected:
335227825Stheraven    _LIBCPP_INLINE_VISIBILITY
336227825Stheraven    ios_base() {// purposefully does no initialization
337227825Stheraven               }
338227825Stheraven
339227825Stheraven    void init(void* __sb);
340227825Stheraven    _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
341227825Stheraven
342227825Stheraven    _LIBCPP_ALWAYS_INLINE
343227825Stheraven    void rdbuf(void* __sb)
344227825Stheraven    {
345227825Stheraven        __rdbuf_ = __sb;
346227825Stheraven        clear();
347227825Stheraven    }
348227825Stheraven
349227825Stheraven    void __call_callbacks(event);
350227825Stheraven    void copyfmt(const ios_base&);
351227825Stheraven    void move(ios_base&);
352241900Sdim    void swap(ios_base&) _NOEXCEPT;
353227825Stheraven
354227825Stheraven    _LIBCPP_ALWAYS_INLINE
355227825Stheraven    void set_rdbuf(void* __sb)
356227825Stheraven    {
357227825Stheraven        __rdbuf_ = __sb;
358227825Stheraven    }
359227825Stheraven
360227825Stheravenprivate:
361227825Stheraven    // All data members must be scalars
362227825Stheraven    fmtflags        __fmtflags_;
363227825Stheraven    streamsize      __precision_;
364227825Stheraven    streamsize      __width_;
365227825Stheraven    iostate         __rdstate_;
366227825Stheraven    iostate         __exceptions_;
367227825Stheraven    void*           __rdbuf_;
368227825Stheraven    void*           __loc_;
369227825Stheraven    event_callback* __fn_;
370227825Stheraven    int*            __index_;
371227825Stheraven    size_t          __event_size_;
372227825Stheraven    size_t          __event_cap_;
373300770Sdim// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
374300770Sdim// enabled with clang.
375300770Sdim#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
376261272Sdim    static atomic<int> __xindex_;
377261272Sdim#else
378227825Stheraven    static int      __xindex_;
379261272Sdim#endif
380227825Stheraven    long*           __iarray_;
381227825Stheraven    size_t          __iarray_size_;
382227825Stheraven    size_t          __iarray_cap_;
383227825Stheraven    void**          __parray_;
384227825Stheraven    size_t          __parray_size_;
385227825Stheraven    size_t          __parray_cap_;
386227825Stheraven};
387227825Stheraven
388227825Stheraven//enum class io_errc
389232924Stheraven_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
390227825Stheraven{
391227825Stheraven    stream = 1
392227825Stheraven};
393232924Stheraven_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
394227825Stheraven
395227825Stheraventemplate <>
396261272Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
397232924Stheraven
398232924Stheraven#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
399227825Stheraventemplate <>
400261272Sdimstruct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
401232924Stheraven#endif
402227825Stheraven
403249989Sdim_LIBCPP_FUNC_VIS
404261272Sdimconst error_category& iostream_category() _NOEXCEPT;
405227825Stheraven
406227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
407227825Stheravenerror_code
408261272Sdimmake_error_code(io_errc __e) _NOEXCEPT
409227825Stheraven{
410227825Stheraven    return error_code(static_cast<int>(__e), iostream_category());
411227825Stheraven}
412227825Stheraven
413227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
414227825Stheravenerror_condition
415261272Sdimmake_error_condition(io_errc __e) _NOEXCEPT
416227825Stheraven{
417227825Stheraven    return error_condition(static_cast<int>(__e), iostream_category());
418227825Stheraven}
419227825Stheraven
420227825Stheravenclass _LIBCPP_EXCEPTION_ABI ios_base::failure
421227825Stheraven    : public system_error
422227825Stheraven{
423227825Stheravenpublic:
424227825Stheraven    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
425227825Stheraven    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
426227825Stheraven    virtual ~failure() throw();
427227825Stheraven};
428227825Stheraven
429249989Sdimclass _LIBCPP_TYPE_VIS ios_base::Init
430227825Stheraven{
431227825Stheravenpublic:
432227825Stheraven    Init();
433227825Stheraven    ~Init();
434227825Stheraven};
435227825Stheraven
436227825Stheraven// fmtflags
437227825Stheraven
438227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
439227825Stheravenios_base::fmtflags
440227825Stheravenios_base::flags() const
441227825Stheraven{
442227825Stheraven    return __fmtflags_;
443227825Stheraven}
444227825Stheraven
445227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
446227825Stheravenios_base::fmtflags
447227825Stheravenios_base::flags(fmtflags __fmtfl)
448227825Stheraven{
449227825Stheraven    fmtflags __r = __fmtflags_;
450227825Stheraven    __fmtflags_ = __fmtfl;
451227825Stheraven    return __r;
452227825Stheraven}
453227825Stheraven
454227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
455227825Stheravenios_base::fmtflags
456227825Stheravenios_base::setf(fmtflags __fmtfl)
457227825Stheraven{
458227825Stheraven    fmtflags __r = __fmtflags_;
459227825Stheraven    __fmtflags_ |= __fmtfl;
460227825Stheraven    return __r;
461227825Stheraven}
462227825Stheraven
463227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
464227825Stheravenvoid
465227825Stheravenios_base::unsetf(fmtflags __mask)
466227825Stheraven{
467227825Stheraven    __fmtflags_ &= ~__mask;
468227825Stheraven}
469227825Stheraven
470227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
471227825Stheravenios_base::fmtflags
472227825Stheravenios_base::setf(fmtflags __fmtfl, fmtflags __mask)
473227825Stheraven{
474227825Stheraven    fmtflags __r = __fmtflags_;
475227825Stheraven    unsetf(__mask);
476227825Stheraven    __fmtflags_ |= __fmtfl & __mask;
477227825Stheraven    return __r;
478227825Stheraven}
479227825Stheraven
480227825Stheraven// precision
481227825Stheraven
482227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
483227825Stheravenstreamsize
484227825Stheravenios_base::precision() const
485227825Stheraven{
486227825Stheraven    return __precision_;
487227825Stheraven}
488227825Stheraven
489227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
490227825Stheravenstreamsize
491227825Stheravenios_base::precision(streamsize __prec)
492227825Stheraven{
493227825Stheraven    streamsize __r = __precision_;
494227825Stheraven    __precision_ = __prec;
495227825Stheraven    return __r;
496227825Stheraven}
497227825Stheraven
498227825Stheraven// width
499227825Stheraven
500227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
501227825Stheravenstreamsize
502227825Stheravenios_base::width() const
503227825Stheraven{
504227825Stheraven    return __width_;
505227825Stheraven}
506227825Stheraven
507227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
508227825Stheravenstreamsize
509227825Stheravenios_base::width(streamsize __wide)
510227825Stheraven{
511227825Stheraven    streamsize __r = __width_;
512227825Stheraven    __width_ = __wide;
513227825Stheraven    return __r;
514227825Stheraven}
515227825Stheraven
516227825Stheraven// iostate
517227825Stheraven
518227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
519227825Stheravenios_base::iostate
520227825Stheravenios_base::rdstate() const
521227825Stheraven{
522227825Stheraven    return __rdstate_;
523227825Stheraven}
524227825Stheraven
525227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
526227825Stheravenvoid
527227825Stheravenios_base::setstate(iostate __state)
528227825Stheraven{
529227825Stheraven    clear(__rdstate_ | __state);
530227825Stheraven}
531227825Stheraven
532227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
533227825Stheravenbool
534227825Stheravenios_base::good() const
535227825Stheraven{
536227825Stheraven    return __rdstate_ == 0;
537227825Stheraven}
538227825Stheraven
539227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
540227825Stheravenbool
541227825Stheravenios_base::eof() const
542227825Stheraven{
543261272Sdim    return (__rdstate_ & eofbit) != 0;
544227825Stheraven}
545227825Stheraven
546227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
547227825Stheravenbool
548227825Stheravenios_base::fail() const
549227825Stheraven{
550261272Sdim    return (__rdstate_ & (failbit | badbit)) != 0;
551227825Stheraven}
552227825Stheraven
553227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
554227825Stheravenbool
555227825Stheravenios_base::bad() const
556227825Stheraven{
557261272Sdim    return (__rdstate_ & badbit) != 0;
558227825Stheraven}
559227825Stheraven
560227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
561227825Stheravenios_base::iostate
562227825Stheravenios_base::exceptions() const
563227825Stheraven{
564227825Stheraven    return __exceptions_;
565227825Stheraven}
566227825Stheraven
567227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
568227825Stheravenvoid
569261272Sdimios_base::exceptions(iostate __iostate)
570227825Stheraven{
571261272Sdim    __exceptions_ = __iostate;
572227825Stheraven    clear(__rdstate_);
573227825Stheraven}
574227825Stheraven
575227825Stheraventemplate <class _CharT, class _Traits>
576261272Sdimclass _LIBCPP_TYPE_VIS_ONLY basic_ios
577227825Stheraven    : public ios_base
578227825Stheraven{
579227825Stheravenpublic:
580227825Stheraven    // types:
581227825Stheraven    typedef _CharT char_type;
582227825Stheraven    typedef _Traits traits_type;
583227825Stheraven
584227825Stheraven    typedef typename traits_type::int_type int_type;
585227825Stheraven    typedef typename traits_type::pos_type pos_type;
586227825Stheraven    typedef typename traits_type::off_type off_type;
587227825Stheraven
588232924Stheraven    _LIBCPP_ALWAYS_INLINE
589232924Stheraven        _LIBCPP_EXPLICIT
590227825Stheraven        operator bool() const {return !fail();}
591227825Stheraven    _LIBCPP_ALWAYS_INLINE bool operator!() const    {return  fail();}
592227825Stheraven    _LIBCPP_ALWAYS_INLINE iostate rdstate() const   {return ios_base::rdstate();}
593227825Stheraven    _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
594227825Stheraven    _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
595227825Stheraven    _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
596227825Stheraven    _LIBCPP_ALWAYS_INLINE bool eof() const  {return ios_base::eof();}
597227825Stheraven    _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
598227825Stheraven    _LIBCPP_ALWAYS_INLINE bool bad() const  {return ios_base::bad();}
599227825Stheraven
600227825Stheraven    _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
601261272Sdim    _LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
602227825Stheraven
603227825Stheraven    // 27.5.4.1 Constructor/destructor:
604227825Stheraven    _LIBCPP_INLINE_VISIBILITY
605227825Stheraven    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
606227825Stheraven    virtual ~basic_ios();
607227825Stheraven
608227825Stheraven    // 27.5.4.2 Members:
609227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
610227825Stheraven    basic_ostream<char_type, traits_type>* tie() const;
611227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
612227825Stheraven    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
613227825Stheraven
614227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
615227825Stheraven    basic_streambuf<char_type, traits_type>* rdbuf() const;
616227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
617227825Stheraven    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
618227825Stheraven
619227825Stheraven    basic_ios& copyfmt(const basic_ios& __rhs);
620227825Stheraven
621227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
622227825Stheraven    char_type fill() const;
623227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
624227825Stheraven    char_type fill(char_type __ch);
625227825Stheraven
626227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
627227825Stheraven    locale imbue(const locale& __loc);
628227825Stheraven
629227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
630227825Stheraven    char narrow(char_type __c, char __dfault) const;
631227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
632227825Stheraven    char_type widen(char __c) const;
633227825Stheraven
634227825Stheravenprotected:
635227825Stheraven    _LIBCPP_ALWAYS_INLINE
636227825Stheraven    basic_ios() {// purposefully does no initialization
637227825Stheraven                }
638227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
639227825Stheraven    void init(basic_streambuf<char_type, traits_type>* __sb);
640227825Stheraven
641227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
642227825Stheraven    void move(basic_ios& __rhs);
643227825Stheraven#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
644227825Stheraven    _LIBCPP_ALWAYS_INLINE
645227825Stheraven    void move(basic_ios&& __rhs) {move(__rhs);}
646227825Stheraven#endif
647227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
648241900Sdim    void swap(basic_ios& __rhs) _NOEXCEPT;
649227825Stheraven    _LIBCPP_INLINE_VISIBILITY 
650227825Stheraven    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
651227825Stheravenprivate:
652227825Stheraven    basic_ostream<char_type, traits_type>* __tie_;
653241900Sdim     mutable int_type __fill_;
654227825Stheraven};
655227825Stheraven
656227825Stheraventemplate <class _CharT, class _Traits>
657227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
658227825Stheravenbasic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
659227825Stheraven{
660227825Stheraven    init(__sb);
661227825Stheraven}
662227825Stheraven
663227825Stheraventemplate <class _CharT, class _Traits>
664227825Stheravenbasic_ios<_CharT, _Traits>::~basic_ios()
665227825Stheraven{
666227825Stheraven}
667227825Stheraven
668227825Stheraventemplate <class _CharT, class _Traits>
669227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
670227825Stheravenvoid
671227825Stheravenbasic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
672227825Stheraven{
673227825Stheraven    ios_base::init(__sb);
674227825Stheraven    __tie_ = 0;
675241900Sdim    __fill_ = traits_type::eof();
676227825Stheraven}
677227825Stheraven
678227825Stheraventemplate <class _CharT, class _Traits>
679227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
680227825Stheravenbasic_ostream<_CharT, _Traits>*
681227825Stheravenbasic_ios<_CharT, _Traits>::tie() const
682227825Stheraven{
683227825Stheraven    return __tie_;
684227825Stheraven}
685227825Stheraven
686227825Stheraventemplate <class _CharT, class _Traits>
687227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
688227825Stheravenbasic_ostream<_CharT, _Traits>*
689227825Stheravenbasic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
690227825Stheraven{
691227825Stheraven    basic_ostream<char_type, traits_type>* __r = __tie_;
692227825Stheraven    __tie_ = __tiestr;
693227825Stheraven    return __r;
694227825Stheraven}
695227825Stheraven
696227825Stheraventemplate <class _CharT, class _Traits>
697227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
698227825Stheravenbasic_streambuf<_CharT, _Traits>*
699227825Stheravenbasic_ios<_CharT, _Traits>::rdbuf() const
700227825Stheraven{
701227825Stheraven    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
702227825Stheraven}
703227825Stheraven
704227825Stheraventemplate <class _CharT, class _Traits>
705227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
706227825Stheravenbasic_streambuf<_CharT, _Traits>*
707227825Stheravenbasic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
708227825Stheraven{
709227825Stheraven    basic_streambuf<char_type, traits_type>* __r = rdbuf();
710227825Stheraven    ios_base::rdbuf(__sb);
711227825Stheraven    return __r;
712227825Stheraven}
713227825Stheraven
714227825Stheraventemplate <class _CharT, class _Traits>
715227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
716227825Stheravenlocale
717227825Stheravenbasic_ios<_CharT, _Traits>::imbue(const locale& __loc)
718227825Stheraven{
719227825Stheraven    locale __r = getloc();
720227825Stheraven    ios_base::imbue(__loc);
721227825Stheraven    if (rdbuf())
722227825Stheraven        rdbuf()->pubimbue(__loc);
723227825Stheraven    return __r;
724227825Stheraven}
725227825Stheraven
726227825Stheraventemplate <class _CharT, class _Traits>
727227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
728227825Stheravenchar
729227825Stheravenbasic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
730227825Stheraven{
731227825Stheraven    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
732227825Stheraven}
733227825Stheraven
734227825Stheraventemplate <class _CharT, class _Traits>
735227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
736227825Stheraven_CharT
737227825Stheravenbasic_ios<_CharT, _Traits>::widen(char __c) const
738227825Stheraven{
739227825Stheraven    return use_facet<ctype<char_type> >(getloc()).widen(__c);
740227825Stheraven}
741227825Stheraven
742227825Stheraventemplate <class _CharT, class _Traits>
743227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
744227825Stheraven_CharT
745227825Stheravenbasic_ios<_CharT, _Traits>::fill() const
746227825Stheraven{
747241900Sdim    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
748241900Sdim        __fill_ = widen(' ');
749227825Stheraven    return __fill_;
750227825Stheraven}
751227825Stheraven
752227825Stheraventemplate <class _CharT, class _Traits>
753227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
754227825Stheraven_CharT
755227825Stheravenbasic_ios<_CharT, _Traits>::fill(char_type __ch)
756227825Stheraven{
757227825Stheraven    char_type __r = __fill_;
758227825Stheraven    __fill_ = __ch;
759227825Stheraven    return __r;
760227825Stheraven}
761227825Stheraven
762227825Stheraventemplate <class _CharT, class _Traits>
763227825Stheravenbasic_ios<_CharT, _Traits>&
764227825Stheravenbasic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
765227825Stheraven{
766227825Stheraven    if (this != &__rhs)
767227825Stheraven    {
768227825Stheraven        __call_callbacks(erase_event);
769227825Stheraven        ios_base::copyfmt(__rhs);
770227825Stheraven        __tie_ = __rhs.__tie_;
771227825Stheraven        __fill_ = __rhs.__fill_;
772227825Stheraven        __call_callbacks(copyfmt_event);
773227825Stheraven        exceptions(__rhs.exceptions());
774227825Stheraven    }
775227825Stheraven    return *this;
776227825Stheraven}
777227825Stheraven
778227825Stheraventemplate <class _CharT, class _Traits>
779227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
780227825Stheravenvoid
781227825Stheravenbasic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
782227825Stheraven{
783227825Stheraven    ios_base::move(__rhs);
784227825Stheraven    __tie_ = __rhs.__tie_;
785227825Stheraven    __rhs.__tie_ = 0;
786227825Stheraven    __fill_ = __rhs.__fill_;
787227825Stheraven}
788227825Stheraven
789227825Stheraventemplate <class _CharT, class _Traits>
790227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
791227825Stheravenvoid
792241900Sdimbasic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
793227825Stheraven{
794227825Stheraven    ios_base::swap(__rhs);
795227825Stheraven    _VSTD::swap(__tie_, __rhs.__tie_);
796227825Stheraven    _VSTD::swap(__fill_, __rhs.__fill_);
797227825Stheraven}
798227825Stheraven
799227825Stheraventemplate <class _CharT, class _Traits>
800227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
801227825Stheravenvoid
802227825Stheravenbasic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
803227825Stheraven{
804227825Stheraven    ios_base::set_rdbuf(__sb);
805227825Stheraven}
806227825Stheraven
807227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
808227825Stheravenios_base&
809227825Stheravenboolalpha(ios_base& __str)
810227825Stheraven{
811227825Stheraven    __str.setf(ios_base::boolalpha);
812227825Stheraven    return __str;
813227825Stheraven}
814227825Stheraven
815227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
816227825Stheravenios_base&
817227825Stheravennoboolalpha(ios_base& __str)
818227825Stheraven{
819227825Stheraven    __str.unsetf(ios_base::boolalpha);
820227825Stheraven    return __str;
821227825Stheraven}
822227825Stheraven
823227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
824227825Stheravenios_base&
825227825Stheravenshowbase(ios_base& __str)
826227825Stheraven{
827227825Stheraven    __str.setf(ios_base::showbase);
828227825Stheraven    return __str;
829227825Stheraven}
830227825Stheraven
831227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
832227825Stheravenios_base&
833227825Stheravennoshowbase(ios_base& __str)
834227825Stheraven{
835227825Stheraven    __str.unsetf(ios_base::showbase);
836227825Stheraven    return __str;
837227825Stheraven}
838227825Stheraven
839227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
840227825Stheravenios_base&
841227825Stheravenshowpoint(ios_base& __str)
842227825Stheraven{
843227825Stheraven    __str.setf(ios_base::showpoint);
844227825Stheraven    return __str;
845227825Stheraven}
846227825Stheraven
847227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
848227825Stheravenios_base&
849227825Stheravennoshowpoint(ios_base& __str)
850227825Stheraven{
851227825Stheraven    __str.unsetf(ios_base::showpoint);
852227825Stheraven    return __str;
853227825Stheraven}
854227825Stheraven
855227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
856227825Stheravenios_base&
857227825Stheravenshowpos(ios_base& __str)
858227825Stheraven{
859227825Stheraven    __str.setf(ios_base::showpos);
860227825Stheraven    return __str;
861227825Stheraven}
862227825Stheraven
863227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
864227825Stheravenios_base&
865227825Stheravennoshowpos(ios_base& __str)
866227825Stheraven{
867227825Stheraven    __str.unsetf(ios_base::showpos);
868227825Stheraven    return __str;
869227825Stheraven}
870227825Stheraven
871227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
872227825Stheravenios_base&
873227825Stheravenskipws(ios_base& __str)
874227825Stheraven{
875227825Stheraven    __str.setf(ios_base::skipws);
876227825Stheraven    return __str;
877227825Stheraven}
878227825Stheraven
879227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
880227825Stheravenios_base&
881227825Stheravennoskipws(ios_base& __str)
882227825Stheraven{
883227825Stheraven    __str.unsetf(ios_base::skipws);
884227825Stheraven    return __str;
885227825Stheraven}
886227825Stheraven
887227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
888227825Stheravenios_base&
889227825Stheravenuppercase(ios_base& __str)
890227825Stheraven{
891227825Stheraven    __str.setf(ios_base::uppercase);
892227825Stheraven    return __str;
893227825Stheraven}
894227825Stheraven
895227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
896227825Stheravenios_base&
897227825Stheravennouppercase(ios_base& __str)
898227825Stheraven{
899227825Stheraven    __str.unsetf(ios_base::uppercase);
900227825Stheraven    return __str;
901227825Stheraven}
902227825Stheraven
903227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
904227825Stheravenios_base&
905227825Stheravenunitbuf(ios_base& __str)
906227825Stheraven{
907227825Stheraven    __str.setf(ios_base::unitbuf);
908227825Stheraven    return __str;
909227825Stheraven}
910227825Stheraven
911227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
912227825Stheravenios_base&
913227825Stheravennounitbuf(ios_base& __str)
914227825Stheraven{
915227825Stheraven    __str.unsetf(ios_base::unitbuf);
916227825Stheraven    return __str;
917227825Stheraven}
918227825Stheraven
919227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
920227825Stheravenios_base&
921227825Stheraveninternal(ios_base& __str)
922227825Stheraven{
923227825Stheraven    __str.setf(ios_base::internal, ios_base::adjustfield);
924227825Stheraven    return __str;
925227825Stheraven}
926227825Stheraven
927227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
928227825Stheravenios_base&
929227825Stheravenleft(ios_base& __str)
930227825Stheraven{
931227825Stheraven    __str.setf(ios_base::left, ios_base::adjustfield);
932227825Stheraven    return __str;
933227825Stheraven}
934227825Stheraven
935227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
936227825Stheravenios_base&
937227825Stheravenright(ios_base& __str)
938227825Stheraven{
939227825Stheraven    __str.setf(ios_base::right, ios_base::adjustfield);
940227825Stheraven    return __str;
941227825Stheraven}
942227825Stheraven
943227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
944227825Stheravenios_base&
945227825Stheravendec(ios_base& __str)
946227825Stheraven{
947227825Stheraven    __str.setf(ios_base::dec, ios_base::basefield);
948227825Stheraven    return __str;
949227825Stheraven}
950227825Stheraven
951227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
952227825Stheravenios_base&
953227825Stheravenhex(ios_base& __str)
954227825Stheraven{
955227825Stheraven    __str.setf(ios_base::hex, ios_base::basefield);
956227825Stheraven    return __str;
957227825Stheraven}
958227825Stheraven
959227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
960227825Stheravenios_base&
961227825Stheravenoct(ios_base& __str)
962227825Stheraven{
963227825Stheraven    __str.setf(ios_base::oct, ios_base::basefield);
964227825Stheraven    return __str;
965227825Stheraven}
966227825Stheraven
967227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
968227825Stheravenios_base&
969227825Stheravenfixed(ios_base& __str)
970227825Stheraven{
971227825Stheraven    __str.setf(ios_base::fixed, ios_base::floatfield);
972227825Stheraven    return __str;
973227825Stheraven}
974227825Stheraven
975227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
976227825Stheravenios_base&
977227825Stheravenscientific(ios_base& __str)
978227825Stheraven{
979227825Stheraven    __str.setf(ios_base::scientific, ios_base::floatfield);
980227825Stheraven    return __str;
981227825Stheraven}
982227825Stheraven
983227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
984227825Stheravenios_base&
985227825Stheravenhexfloat(ios_base& __str)
986227825Stheraven{
987227825Stheraven    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
988227825Stheraven    return __str;
989227825Stheraven}
990227825Stheraven
991227825Stheraveninline _LIBCPP_INLINE_VISIBILITY
992227825Stheravenios_base&
993227825Stheravendefaultfloat(ios_base& __str)
994227825Stheraven{
995227825Stheraven    __str.unsetf(ios_base::floatfield);
996227825Stheraven    return __str;
997227825Stheraven}
998227825Stheraven
999261272Sdimtemplate <class _CharT, class _Traits>
1000261272Sdimclass __save_flags
1001261272Sdim{
1002261272Sdim    typedef basic_ios<_CharT, _Traits> __stream_type;
1003261272Sdim    typedef typename __stream_type::fmtflags fmtflags;
1004261272Sdim
1005261272Sdim    __stream_type& __stream_;
1006261272Sdim    fmtflags       __fmtflags_;
1007261272Sdim    _CharT         __fill_;
1008261272Sdim
1009261272Sdim    __save_flags(const __save_flags&);
1010261272Sdim    __save_flags& operator=(const __save_flags&);
1011261272Sdimpublic:
1012261272Sdim    _LIBCPP_INLINE_VISIBILITY
1013261272Sdim    explicit __save_flags(__stream_type& __stream)
1014261272Sdim        : __stream_(__stream),
1015261272Sdim          __fmtflags_(__stream.flags()),
1016261272Sdim          __fill_(__stream.fill())
1017261272Sdim        {}
1018261272Sdim    _LIBCPP_INLINE_VISIBILITY
1019261272Sdim    ~__save_flags()
1020261272Sdim    {
1021261272Sdim        __stream_.flags(__fmtflags_);
1022261272Sdim        __stream_.fill(__fill_);
1023261272Sdim    }
1024261272Sdim};
1025261272Sdim
1026227825Stheraven_LIBCPP_END_NAMESPACE_STD
1027227825Stheraven
1028227825Stheraven#endif  // _LIBCPP_IOS
1029