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