xref: /minix3/external/bsd/libc++/dist/libcxx/include/ios (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc// -*- C++ -*-
24684ddb6SLionel Sambuc//===---------------------------- ios -------------------------------------===//
34684ddb6SLionel Sambuc//
44684ddb6SLionel Sambuc//                     The LLVM Compiler Infrastructure
54684ddb6SLionel Sambuc//
64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
84684ddb6SLionel Sambuc//
94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===//
104684ddb6SLionel Sambuc
114684ddb6SLionel Sambuc#ifndef _LIBCPP_IOS
124684ddb6SLionel Sambuc#define _LIBCPP_IOS
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc/*
154684ddb6SLionel Sambuc    ios synopsis
164684ddb6SLionel Sambuc
174684ddb6SLionel Sambuc#include <iosfwd>
184684ddb6SLionel Sambuc
194684ddb6SLionel Sambucnamespace std
204684ddb6SLionel Sambuc{
214684ddb6SLionel Sambuc
224684ddb6SLionel Sambuctypedef OFF_T streamoff;
234684ddb6SLionel Sambuctypedef SZ_T streamsize;
244684ddb6SLionel Sambuctemplate <class stateT> class fpos;
254684ddb6SLionel Sambuc
264684ddb6SLionel Sambucclass ios_base
274684ddb6SLionel Sambuc{
284684ddb6SLionel Sambucpublic:
294684ddb6SLionel Sambuc    class failure;
304684ddb6SLionel Sambuc
314684ddb6SLionel Sambuc    typedef T1 fmtflags;
324684ddb6SLionel Sambuc    static constexpr fmtflags boolalpha;
334684ddb6SLionel Sambuc    static constexpr fmtflags dec;
344684ddb6SLionel Sambuc    static constexpr fmtflags fixed;
354684ddb6SLionel Sambuc    static constexpr fmtflags hex;
364684ddb6SLionel Sambuc    static constexpr fmtflags internal;
374684ddb6SLionel Sambuc    static constexpr fmtflags left;
384684ddb6SLionel Sambuc    static constexpr fmtflags oct;
394684ddb6SLionel Sambuc    static constexpr fmtflags right;
404684ddb6SLionel Sambuc    static constexpr fmtflags scientific;
414684ddb6SLionel Sambuc    static constexpr fmtflags showbase;
424684ddb6SLionel Sambuc    static constexpr fmtflags showpoint;
434684ddb6SLionel Sambuc    static constexpr fmtflags showpos;
444684ddb6SLionel Sambuc    static constexpr fmtflags skipws;
454684ddb6SLionel Sambuc    static constexpr fmtflags unitbuf;
464684ddb6SLionel Sambuc    static constexpr fmtflags uppercase;
474684ddb6SLionel Sambuc    static constexpr fmtflags adjustfield;
484684ddb6SLionel Sambuc    static constexpr fmtflags basefield;
494684ddb6SLionel Sambuc    static constexpr fmtflags floatfield;
504684ddb6SLionel Sambuc
514684ddb6SLionel Sambuc    typedef T2 iostate;
524684ddb6SLionel Sambuc    static constexpr iostate badbit;
534684ddb6SLionel Sambuc    static constexpr iostate eofbit;
544684ddb6SLionel Sambuc    static constexpr iostate failbit;
554684ddb6SLionel Sambuc    static constexpr iostate goodbit;
564684ddb6SLionel Sambuc
574684ddb6SLionel Sambuc    typedef T3 openmode;
584684ddb6SLionel Sambuc    static constexpr openmode app;
594684ddb6SLionel Sambuc    static constexpr openmode ate;
604684ddb6SLionel Sambuc    static constexpr openmode binary;
614684ddb6SLionel Sambuc    static constexpr openmode in;
624684ddb6SLionel Sambuc    static constexpr openmode out;
634684ddb6SLionel Sambuc    static constexpr openmode trunc;
644684ddb6SLionel Sambuc
654684ddb6SLionel Sambuc    typedef T4 seekdir;
664684ddb6SLionel Sambuc    static constexpr seekdir beg;
674684ddb6SLionel Sambuc    static constexpr seekdir cur;
684684ddb6SLionel Sambuc    static constexpr seekdir end;
694684ddb6SLionel Sambuc
704684ddb6SLionel Sambuc    class Init;
714684ddb6SLionel Sambuc
724684ddb6SLionel Sambuc    // 27.5.2.2 fmtflags state:
734684ddb6SLionel Sambuc    fmtflags flags() const;
744684ddb6SLionel Sambuc    fmtflags flags(fmtflags fmtfl);
754684ddb6SLionel Sambuc    fmtflags setf(fmtflags fmtfl);
764684ddb6SLionel Sambuc    fmtflags setf(fmtflags fmtfl, fmtflags mask);
774684ddb6SLionel Sambuc    void unsetf(fmtflags mask);
784684ddb6SLionel Sambuc
794684ddb6SLionel Sambuc    streamsize precision() const;
804684ddb6SLionel Sambuc    streamsize precision(streamsize prec);
814684ddb6SLionel Sambuc    streamsize width() const;
824684ddb6SLionel Sambuc    streamsize width(streamsize wide);
834684ddb6SLionel Sambuc
844684ddb6SLionel Sambuc    // 27.5.2.3 locales:
854684ddb6SLionel Sambuc    locale imbue(const locale& loc);
864684ddb6SLionel Sambuc    locale getloc() const;
874684ddb6SLionel Sambuc
884684ddb6SLionel Sambuc    // 27.5.2.5 storage:
894684ddb6SLionel Sambuc    static int xalloc();
904684ddb6SLionel Sambuc    long& iword(int index);
914684ddb6SLionel Sambuc    void*& pword(int index);
924684ddb6SLionel Sambuc
934684ddb6SLionel Sambuc    // destructor
944684ddb6SLionel Sambuc    virtual ~ios_base();
954684ddb6SLionel Sambuc
964684ddb6SLionel Sambuc    // 27.5.2.6 callbacks;
974684ddb6SLionel Sambuc    enum event { erase_event, imbue_event, copyfmt_event };
984684ddb6SLionel Sambuc    typedef void (*event_callback)(event, ios_base&, int index);
994684ddb6SLionel Sambuc    void register_callback(event_callback fn, int index);
1004684ddb6SLionel Sambuc
1014684ddb6SLionel Sambuc    ios_base(const ios_base&) = delete;
1024684ddb6SLionel Sambuc    ios_base& operator=(const ios_base&) = delete;
1034684ddb6SLionel Sambuc
1044684ddb6SLionel Sambuc    static bool sync_with_stdio(bool sync = true);
1054684ddb6SLionel Sambuc
1064684ddb6SLionel Sambucprotected:
1074684ddb6SLionel Sambuc    ios_base();
1084684ddb6SLionel Sambuc};
1094684ddb6SLionel Sambuc
1104684ddb6SLionel Sambuctemplate <class charT, class traits = char_traits<charT> >
1114684ddb6SLionel Sambucclass basic_ios
1124684ddb6SLionel Sambuc    : public ios_base
1134684ddb6SLionel Sambuc{
1144684ddb6SLionel Sambucpublic:
1154684ddb6SLionel Sambuc    // types:
1164684ddb6SLionel Sambuc    typedef charT char_type;
1174684ddb6SLionel Sambuc    typedef typename traits::int_type int_type;
1184684ddb6SLionel Sambuc    typedef typename traits::pos_type pos_type;
1194684ddb6SLionel Sambuc    typedef typename traits::off_type off_type;
1204684ddb6SLionel Sambuc    typedef traits traits_type;
1214684ddb6SLionel Sambuc
1224684ddb6SLionel Sambuc    operator unspecified-bool-type() const;
1234684ddb6SLionel Sambuc    bool operator!() const;
1244684ddb6SLionel Sambuc    iostate rdstate() const;
1254684ddb6SLionel Sambuc    void clear(iostate state = goodbit);
1264684ddb6SLionel Sambuc    void setstate(iostate state);
1274684ddb6SLionel Sambuc    bool good() const;
1284684ddb6SLionel Sambuc    bool eof() const;
1294684ddb6SLionel Sambuc    bool fail() const;
1304684ddb6SLionel Sambuc    bool bad() const;
1314684ddb6SLionel Sambuc
1324684ddb6SLionel Sambuc    iostate exceptions() const;
1334684ddb6SLionel Sambuc    void exceptions(iostate except);
1344684ddb6SLionel Sambuc
1354684ddb6SLionel Sambuc    // 27.5.4.1 Constructor/destructor:
1364684ddb6SLionel Sambuc    explicit basic_ios(basic_streambuf<charT,traits>* sb);
1374684ddb6SLionel Sambuc    virtual ~basic_ios();
1384684ddb6SLionel Sambuc
1394684ddb6SLionel Sambuc    // 27.5.4.2 Members:
1404684ddb6SLionel Sambuc    basic_ostream<charT,traits>* tie() const;
1414684ddb6SLionel Sambuc    basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
1424684ddb6SLionel Sambuc
1434684ddb6SLionel Sambuc    basic_streambuf<charT,traits>* rdbuf() const;
1444684ddb6SLionel Sambuc    basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
1454684ddb6SLionel Sambuc
1464684ddb6SLionel Sambuc    basic_ios& copyfmt(const basic_ios& rhs);
1474684ddb6SLionel Sambuc
1484684ddb6SLionel Sambuc    char_type fill() const;
1494684ddb6SLionel Sambuc    char_type fill(char_type ch);
1504684ddb6SLionel Sambuc
1514684ddb6SLionel Sambuc    locale imbue(const locale& loc);
1524684ddb6SLionel Sambuc
1534684ddb6SLionel Sambuc    char narrow(char_type c, char dfault) const;
1544684ddb6SLionel Sambuc    char_type widen(char c) const;
1554684ddb6SLionel Sambuc
1564684ddb6SLionel Sambuc    basic_ios(const basic_ios& ) = delete;
1574684ddb6SLionel Sambuc    basic_ios& operator=(const basic_ios&) = delete;
1584684ddb6SLionel Sambuc
1594684ddb6SLionel Sambucprotected:
1604684ddb6SLionel Sambuc    basic_ios();
1614684ddb6SLionel Sambuc    void init(basic_streambuf<charT,traits>* sb);
1624684ddb6SLionel Sambuc    void move(basic_ios& rhs);
1634684ddb6SLionel Sambuc    void swap(basic_ios& rhs) noexcept;
1644684ddb6SLionel Sambuc    void set_rdbuf(basic_streambuf<charT, traits>* sb);
1654684ddb6SLionel Sambuc};
1664684ddb6SLionel Sambuc
1674684ddb6SLionel Sambuc// 27.5.5, manipulators:
1684684ddb6SLionel Sambucios_base& boolalpha (ios_base& str);
1694684ddb6SLionel Sambucios_base& noboolalpha(ios_base& str);
1704684ddb6SLionel Sambucios_base& showbase (ios_base& str);
1714684ddb6SLionel Sambucios_base& noshowbase (ios_base& str);
1724684ddb6SLionel Sambucios_base& showpoint (ios_base& str);
1734684ddb6SLionel Sambucios_base& noshowpoint(ios_base& str);
1744684ddb6SLionel Sambucios_base& showpos (ios_base& str);
1754684ddb6SLionel Sambucios_base& noshowpos (ios_base& str);
1764684ddb6SLionel Sambucios_base& skipws (ios_base& str);
1774684ddb6SLionel Sambucios_base& noskipws (ios_base& str);
1784684ddb6SLionel Sambucios_base& uppercase (ios_base& str);
1794684ddb6SLionel Sambucios_base& nouppercase(ios_base& str);
1804684ddb6SLionel Sambucios_base& unitbuf (ios_base& str);
1814684ddb6SLionel Sambucios_base& nounitbuf (ios_base& str);
1824684ddb6SLionel Sambuc
1834684ddb6SLionel Sambuc// 27.5.5.2 adjustfield:
1844684ddb6SLionel Sambucios_base& internal (ios_base& str);
1854684ddb6SLionel Sambucios_base& left (ios_base& str);
1864684ddb6SLionel Sambucios_base& right (ios_base& str);
1874684ddb6SLionel Sambuc
1884684ddb6SLionel Sambuc// 27.5.5.3 basefield:
1894684ddb6SLionel Sambucios_base& dec (ios_base& str);
1904684ddb6SLionel Sambucios_base& hex (ios_base& str);
1914684ddb6SLionel Sambucios_base& oct (ios_base& str);
1924684ddb6SLionel Sambuc
1934684ddb6SLionel Sambuc// 27.5.5.4 floatfield:
1944684ddb6SLionel Sambucios_base& fixed (ios_base& str);
1954684ddb6SLionel Sambucios_base& scientific (ios_base& str);
1964684ddb6SLionel Sambucios_base& hexfloat (ios_base& str);
1974684ddb6SLionel Sambucios_base& defaultfloat(ios_base& str);
1984684ddb6SLionel Sambuc
1994684ddb6SLionel Sambuc// 27.5.5.5 error reporting:
2004684ddb6SLionel Sambucenum class io_errc
2014684ddb6SLionel Sambuc{
2024684ddb6SLionel Sambuc    stream = 1
2034684ddb6SLionel Sambuc};
2044684ddb6SLionel Sambuc
2054684ddb6SLionel Sambucconcept_map ErrorCodeEnum<io_errc> { };
2064684ddb6SLionel Sambucerror_code make_error_code(io_errc e) noexcept;
2074684ddb6SLionel Sambucerror_condition make_error_condition(io_errc e) noexcept;
2084684ddb6SLionel Sambucstorage-class-specifier const error_category& iostream_category() noexcept;
2094684ddb6SLionel Sambuc
2104684ddb6SLionel Sambuc}  // std
2114684ddb6SLionel Sambuc
2124684ddb6SLionel Sambuc*/
2134684ddb6SLionel Sambuc
2144684ddb6SLionel Sambuc#include <__config>
2154684ddb6SLionel Sambuc#include <iosfwd>
2164684ddb6SLionel Sambuc#include <__locale>
2174684ddb6SLionel Sambuc#include <system_error>
2184684ddb6SLionel Sambuc
219*0a6a1f1dSLionel Sambuc#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
2204684ddb6SLionel Sambuc#include <atomic>     // for __xindex_
2214684ddb6SLionel Sambuc#endif
2224684ddb6SLionel Sambuc
2234684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2244684ddb6SLionel Sambuc#pragma GCC system_header
2254684ddb6SLionel Sambuc#endif
2264684ddb6SLionel Sambuc
2274684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
2284684ddb6SLionel Sambuc
2294684ddb6SLionel Sambuctypedef ptrdiff_t streamsize;
2304684ddb6SLionel Sambuc
2314684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ios_base
2324684ddb6SLionel Sambuc{
2334684ddb6SLionel Sambucpublic:
2344684ddb6SLionel Sambuc    class _LIBCPP_TYPE_VIS failure;
2354684ddb6SLionel Sambuc
2364684ddb6SLionel Sambuc    typedef unsigned int fmtflags;
2374684ddb6SLionel Sambuc    static const fmtflags boolalpha   = 0x0001;
2384684ddb6SLionel Sambuc    static const fmtflags dec         = 0x0002;
2394684ddb6SLionel Sambuc    static const fmtflags fixed       = 0x0004;
2404684ddb6SLionel Sambuc    static const fmtflags hex         = 0x0008;
2414684ddb6SLionel Sambuc    static const fmtflags internal    = 0x0010;
2424684ddb6SLionel Sambuc    static const fmtflags left        = 0x0020;
2434684ddb6SLionel Sambuc    static const fmtflags oct         = 0x0040;
2444684ddb6SLionel Sambuc    static const fmtflags right       = 0x0080;
2454684ddb6SLionel Sambuc    static const fmtflags scientific  = 0x0100;
2464684ddb6SLionel Sambuc    static const fmtflags showbase    = 0x0200;
2474684ddb6SLionel Sambuc    static const fmtflags showpoint   = 0x0400;
2484684ddb6SLionel Sambuc    static const fmtflags showpos     = 0x0800;
2494684ddb6SLionel Sambuc    static const fmtflags skipws      = 0x1000;
2504684ddb6SLionel Sambuc    static const fmtflags unitbuf     = 0x2000;
2514684ddb6SLionel Sambuc    static const fmtflags uppercase   = 0x4000;
2524684ddb6SLionel Sambuc    static const fmtflags adjustfield = left | right | internal;
2534684ddb6SLionel Sambuc    static const fmtflags basefield   = dec | oct | hex;
2544684ddb6SLionel Sambuc    static const fmtflags floatfield  = scientific | fixed;
2554684ddb6SLionel Sambuc
2564684ddb6SLionel Sambuc    typedef unsigned int iostate;
2574684ddb6SLionel Sambuc    typedef iostate      io_state;
2584684ddb6SLionel Sambuc    static const iostate badbit  = 0x1;
2594684ddb6SLionel Sambuc    static const iostate eofbit  = 0x2;
2604684ddb6SLionel Sambuc    static const iostate failbit = 0x4;
2614684ddb6SLionel Sambuc    static const iostate goodbit = 0x0;
2624684ddb6SLionel Sambuc
2634684ddb6SLionel Sambuc    typedef unsigned int openmode;
2644684ddb6SLionel Sambuc    typedef openmode     open_mode;
2654684ddb6SLionel Sambuc    static const openmode app    = 0x01;
2664684ddb6SLionel Sambuc    static const openmode ate    = 0x02;
2674684ddb6SLionel Sambuc    static const openmode binary = 0x04;
2684684ddb6SLionel Sambuc    static const openmode in     = 0x08;
2694684ddb6SLionel Sambuc    static const openmode out    = 0x10;
2704684ddb6SLionel Sambuc    static const openmode trunc  = 0x20;
2714684ddb6SLionel Sambuc
2724684ddb6SLionel Sambuc    enum seekdir {beg, cur, end};
2734684ddb6SLionel Sambuc    typedef seekdir seek_dir;
2744684ddb6SLionel Sambuc
2754684ddb6SLionel Sambuc    typedef _VSTD::streamoff streamoff;
2764684ddb6SLionel Sambuc    typedef _VSTD::streampos streampos;
2774684ddb6SLionel Sambuc
2784684ddb6SLionel Sambuc    class _LIBCPP_TYPE_VIS Init;
2794684ddb6SLionel Sambuc
2804684ddb6SLionel Sambuc    // 27.5.2.2 fmtflags state:
2814684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
2824684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
2834684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
2844684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
2854684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
2864684ddb6SLionel Sambuc
2874684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
2884684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
2894684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY streamsize width() const;
2904684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
2914684ddb6SLionel Sambuc
2924684ddb6SLionel Sambuc    // 27.5.2.3 locales:
2934684ddb6SLionel Sambuc    locale imbue(const locale& __loc);
2944684ddb6SLionel Sambuc    locale getloc() const;
2954684ddb6SLionel Sambuc
2964684ddb6SLionel Sambuc    // 27.5.2.5 storage:
2974684ddb6SLionel Sambuc    static int xalloc();
2984684ddb6SLionel Sambuc    long& iword(int __index);
2994684ddb6SLionel Sambuc    void*& pword(int __index);
3004684ddb6SLionel Sambuc
3014684ddb6SLionel Sambuc    // destructor
3024684ddb6SLionel Sambuc    virtual ~ios_base();
3034684ddb6SLionel Sambuc
3044684ddb6SLionel Sambuc    // 27.5.2.6 callbacks;
3054684ddb6SLionel Sambuc    enum event { erase_event, imbue_event, copyfmt_event };
3064684ddb6SLionel Sambuc    typedef void (*event_callback)(event, ios_base&, int __index);
3074684ddb6SLionel Sambuc    void register_callback(event_callback __fn, int __index);
3084684ddb6SLionel Sambuc
3094684ddb6SLionel Sambucprivate:
3104684ddb6SLionel Sambuc    ios_base(const ios_base&); // = delete;
3114684ddb6SLionel Sambuc    ios_base& operator=(const ios_base&); // = delete;
3124684ddb6SLionel Sambuc
3134684ddb6SLionel Sambucpublic:
3144684ddb6SLionel Sambuc    static bool sync_with_stdio(bool __sync = true);
3154684ddb6SLionel Sambuc
3164684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
3174684ddb6SLionel Sambuc    void clear(iostate __state = goodbit);
3184684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
3194684ddb6SLionel Sambuc
3204684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY bool good() const;
3214684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY bool eof() const;
3224684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY bool fail() const;
3234684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY bool bad() const;
3244684ddb6SLionel Sambuc
3254684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
3264684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
3274684ddb6SLionel Sambuc
3284684ddb6SLionel Sambuc    void __set_badbit_and_consider_rethrow();
3294684ddb6SLionel Sambuc    void __set_failbit_and_consider_rethrow();
3304684ddb6SLionel Sambuc
3314684ddb6SLionel Sambucprotected:
3324684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
3334684ddb6SLionel Sambuc    ios_base() {// purposefully does no initialization
3344684ddb6SLionel Sambuc               }
3354684ddb6SLionel Sambuc
3364684ddb6SLionel Sambuc    void init(void* __sb);
3374684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE void* rdbuf() const {return __rdbuf_;}
3384684ddb6SLionel Sambuc
3394684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE
3404684ddb6SLionel Sambuc    void rdbuf(void* __sb)
3414684ddb6SLionel Sambuc    {
3424684ddb6SLionel Sambuc        __rdbuf_ = __sb;
3434684ddb6SLionel Sambuc        clear();
3444684ddb6SLionel Sambuc    }
3454684ddb6SLionel Sambuc
3464684ddb6SLionel Sambuc    void __call_callbacks(event);
3474684ddb6SLionel Sambuc    void copyfmt(const ios_base&);
3484684ddb6SLionel Sambuc    void move(ios_base&);
3494684ddb6SLionel Sambuc    void swap(ios_base&) _NOEXCEPT;
3504684ddb6SLionel Sambuc
3514684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE
3524684ddb6SLionel Sambuc    void set_rdbuf(void* __sb)
3534684ddb6SLionel Sambuc    {
3544684ddb6SLionel Sambuc        __rdbuf_ = __sb;
3554684ddb6SLionel Sambuc    }
3564684ddb6SLionel Sambuc
3574684ddb6SLionel Sambucprivate:
3584684ddb6SLionel Sambuc    // All data members must be scalars
3594684ddb6SLionel Sambuc    fmtflags        __fmtflags_;
3604684ddb6SLionel Sambuc    streamsize      __precision_;
3614684ddb6SLionel Sambuc    streamsize      __width_;
3624684ddb6SLionel Sambuc    iostate         __rdstate_;
3634684ddb6SLionel Sambuc    iostate         __exceptions_;
3644684ddb6SLionel Sambuc    void*           __rdbuf_;
3654684ddb6SLionel Sambuc    void*           __loc_;
3664684ddb6SLionel Sambuc    event_callback* __fn_;
3674684ddb6SLionel Sambuc    int*            __index_;
3684684ddb6SLionel Sambuc    size_t          __event_size_;
3694684ddb6SLionel Sambuc    size_t          __event_cap_;
370*0a6a1f1dSLionel Sambuc// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
371*0a6a1f1dSLionel Sambuc// enabled with clang.
372*0a6a1f1dSLionel Sambuc#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
3734684ddb6SLionel Sambuc    static atomic<int> __xindex_;
3744684ddb6SLionel Sambuc#else
3754684ddb6SLionel Sambuc    static int      __xindex_;
3764684ddb6SLionel Sambuc#endif
3774684ddb6SLionel Sambuc    long*           __iarray_;
3784684ddb6SLionel Sambuc    size_t          __iarray_size_;
3794684ddb6SLionel Sambuc    size_t          __iarray_cap_;
3804684ddb6SLionel Sambuc    void**          __parray_;
3814684ddb6SLionel Sambuc    size_t          __parray_size_;
3824684ddb6SLionel Sambuc    size_t          __parray_cap_;
3834684ddb6SLionel Sambuc};
3844684ddb6SLionel Sambuc
3854684ddb6SLionel Sambuc//enum class io_errc
3864684ddb6SLionel Sambuc_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
3874684ddb6SLionel Sambuc{
3884684ddb6SLionel Sambuc    stream = 1
3894684ddb6SLionel Sambuc};
3904684ddb6SLionel Sambuc_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
3914684ddb6SLionel Sambuc
3924684ddb6SLionel Sambuctemplate <>
3934684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
3944684ddb6SLionel Sambuc
3954684ddb6SLionel Sambuc#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
3964684ddb6SLionel Sambuctemplate <>
3974684ddb6SLionel Sambucstruct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
3984684ddb6SLionel Sambuc#endif
3994684ddb6SLionel Sambuc
4004684ddb6SLionel Sambuc_LIBCPP_FUNC_VIS
4014684ddb6SLionel Sambucconst error_category& iostream_category() _NOEXCEPT;
4024684ddb6SLionel Sambuc
4034684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4044684ddb6SLionel Sambucerror_code
4054684ddb6SLionel Sambucmake_error_code(io_errc __e) _NOEXCEPT
4064684ddb6SLionel Sambuc{
4074684ddb6SLionel Sambuc    return error_code(static_cast<int>(__e), iostream_category());
4084684ddb6SLionel Sambuc}
4094684ddb6SLionel Sambuc
4104684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4114684ddb6SLionel Sambucerror_condition
4124684ddb6SLionel Sambucmake_error_condition(io_errc __e) _NOEXCEPT
4134684ddb6SLionel Sambuc{
4144684ddb6SLionel Sambuc    return error_condition(static_cast<int>(__e), iostream_category());
4154684ddb6SLionel Sambuc}
4164684ddb6SLionel Sambuc
4174684ddb6SLionel Sambucclass _LIBCPP_EXCEPTION_ABI ios_base::failure
4184684ddb6SLionel Sambuc    : public system_error
4194684ddb6SLionel Sambuc{
4204684ddb6SLionel Sambucpublic:
4214684ddb6SLionel Sambuc    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
4224684ddb6SLionel Sambuc    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
4234684ddb6SLionel Sambuc    virtual ~failure() throw();
4244684ddb6SLionel Sambuc};
4254684ddb6SLionel Sambuc
4264684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS ios_base::Init
4274684ddb6SLionel Sambuc{
4284684ddb6SLionel Sambucpublic:
4294684ddb6SLionel Sambuc    Init();
4304684ddb6SLionel Sambuc    ~Init();
4314684ddb6SLionel Sambuc};
4324684ddb6SLionel Sambuc
4334684ddb6SLionel Sambuc// fmtflags
4344684ddb6SLionel Sambuc
4354684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4364684ddb6SLionel Sambucios_base::fmtflags
4374684ddb6SLionel Sambucios_base::flags() const
4384684ddb6SLionel Sambuc{
4394684ddb6SLionel Sambuc    return __fmtflags_;
4404684ddb6SLionel Sambuc}
4414684ddb6SLionel Sambuc
4424684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4434684ddb6SLionel Sambucios_base::fmtflags
4444684ddb6SLionel Sambucios_base::flags(fmtflags __fmtfl)
4454684ddb6SLionel Sambuc{
4464684ddb6SLionel Sambuc    fmtflags __r = __fmtflags_;
4474684ddb6SLionel Sambuc    __fmtflags_ = __fmtfl;
4484684ddb6SLionel Sambuc    return __r;
4494684ddb6SLionel Sambuc}
4504684ddb6SLionel Sambuc
4514684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4524684ddb6SLionel Sambucios_base::fmtflags
4534684ddb6SLionel Sambucios_base::setf(fmtflags __fmtfl)
4544684ddb6SLionel Sambuc{
4554684ddb6SLionel Sambuc    fmtflags __r = __fmtflags_;
4564684ddb6SLionel Sambuc    __fmtflags_ |= __fmtfl;
4574684ddb6SLionel Sambuc    return __r;
4584684ddb6SLionel Sambuc}
4594684ddb6SLionel Sambuc
4604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4614684ddb6SLionel Sambucvoid
4624684ddb6SLionel Sambucios_base::unsetf(fmtflags __mask)
4634684ddb6SLionel Sambuc{
4644684ddb6SLionel Sambuc    __fmtflags_ &= ~__mask;
4654684ddb6SLionel Sambuc}
4664684ddb6SLionel Sambuc
4674684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4684684ddb6SLionel Sambucios_base::fmtflags
4694684ddb6SLionel Sambucios_base::setf(fmtflags __fmtfl, fmtflags __mask)
4704684ddb6SLionel Sambuc{
4714684ddb6SLionel Sambuc    fmtflags __r = __fmtflags_;
4724684ddb6SLionel Sambuc    unsetf(__mask);
4734684ddb6SLionel Sambuc    __fmtflags_ |= __fmtfl & __mask;
4744684ddb6SLionel Sambuc    return __r;
4754684ddb6SLionel Sambuc}
4764684ddb6SLionel Sambuc
4774684ddb6SLionel Sambuc// precision
4784684ddb6SLionel Sambuc
4794684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4804684ddb6SLionel Sambucstreamsize
4814684ddb6SLionel Sambucios_base::precision() const
4824684ddb6SLionel Sambuc{
4834684ddb6SLionel Sambuc    return __precision_;
4844684ddb6SLionel Sambuc}
4854684ddb6SLionel Sambuc
4864684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4874684ddb6SLionel Sambucstreamsize
4884684ddb6SLionel Sambucios_base::precision(streamsize __prec)
4894684ddb6SLionel Sambuc{
4904684ddb6SLionel Sambuc    streamsize __r = __precision_;
4914684ddb6SLionel Sambuc    __precision_ = __prec;
4924684ddb6SLionel Sambuc    return __r;
4934684ddb6SLionel Sambuc}
4944684ddb6SLionel Sambuc
4954684ddb6SLionel Sambuc// width
4964684ddb6SLionel Sambuc
4974684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
4984684ddb6SLionel Sambucstreamsize
4994684ddb6SLionel Sambucios_base::width() const
5004684ddb6SLionel Sambuc{
5014684ddb6SLionel Sambuc    return __width_;
5024684ddb6SLionel Sambuc}
5034684ddb6SLionel Sambuc
5044684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5054684ddb6SLionel Sambucstreamsize
5064684ddb6SLionel Sambucios_base::width(streamsize __wide)
5074684ddb6SLionel Sambuc{
5084684ddb6SLionel Sambuc    streamsize __r = __width_;
5094684ddb6SLionel Sambuc    __width_ = __wide;
5104684ddb6SLionel Sambuc    return __r;
5114684ddb6SLionel Sambuc}
5124684ddb6SLionel Sambuc
5134684ddb6SLionel Sambuc// iostate
5144684ddb6SLionel Sambuc
5154684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5164684ddb6SLionel Sambucios_base::iostate
5174684ddb6SLionel Sambucios_base::rdstate() const
5184684ddb6SLionel Sambuc{
5194684ddb6SLionel Sambuc    return __rdstate_;
5204684ddb6SLionel Sambuc}
5214684ddb6SLionel Sambuc
5224684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5234684ddb6SLionel Sambucvoid
5244684ddb6SLionel Sambucios_base::setstate(iostate __state)
5254684ddb6SLionel Sambuc{
5264684ddb6SLionel Sambuc    clear(__rdstate_ | __state);
5274684ddb6SLionel Sambuc}
5284684ddb6SLionel Sambuc
5294684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5304684ddb6SLionel Sambucbool
5314684ddb6SLionel Sambucios_base::good() const
5324684ddb6SLionel Sambuc{
5334684ddb6SLionel Sambuc    return __rdstate_ == 0;
5344684ddb6SLionel Sambuc}
5354684ddb6SLionel Sambuc
5364684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5374684ddb6SLionel Sambucbool
5384684ddb6SLionel Sambucios_base::eof() const
5394684ddb6SLionel Sambuc{
5404684ddb6SLionel Sambuc    return (__rdstate_ & eofbit) != 0;
5414684ddb6SLionel Sambuc}
5424684ddb6SLionel Sambuc
5434684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5444684ddb6SLionel Sambucbool
5454684ddb6SLionel Sambucios_base::fail() const
5464684ddb6SLionel Sambuc{
5474684ddb6SLionel Sambuc    return (__rdstate_ & (failbit | badbit)) != 0;
5484684ddb6SLionel Sambuc}
5494684ddb6SLionel Sambuc
5504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5514684ddb6SLionel Sambucbool
5524684ddb6SLionel Sambucios_base::bad() const
5534684ddb6SLionel Sambuc{
5544684ddb6SLionel Sambuc    return (__rdstate_ & badbit) != 0;
5554684ddb6SLionel Sambuc}
5564684ddb6SLionel Sambuc
5574684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5584684ddb6SLionel Sambucios_base::iostate
5594684ddb6SLionel Sambucios_base::exceptions() const
5604684ddb6SLionel Sambuc{
5614684ddb6SLionel Sambuc    return __exceptions_;
5624684ddb6SLionel Sambuc}
5634684ddb6SLionel Sambuc
5644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
5654684ddb6SLionel Sambucvoid
5664684ddb6SLionel Sambucios_base::exceptions(iostate __iostate)
5674684ddb6SLionel Sambuc{
5684684ddb6SLionel Sambuc    __exceptions_ = __iostate;
5694684ddb6SLionel Sambuc    clear(__rdstate_);
5704684ddb6SLionel Sambuc}
5714684ddb6SLionel Sambuc
5724684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
5734684ddb6SLionel Sambucclass _LIBCPP_TYPE_VIS_ONLY basic_ios
5744684ddb6SLionel Sambuc    : public ios_base
5754684ddb6SLionel Sambuc{
5764684ddb6SLionel Sambucpublic:
5774684ddb6SLionel Sambuc    // types:
5784684ddb6SLionel Sambuc    typedef _CharT char_type;
5794684ddb6SLionel Sambuc    typedef _Traits traits_type;
5804684ddb6SLionel Sambuc
5814684ddb6SLionel Sambuc    typedef typename traits_type::int_type int_type;
5824684ddb6SLionel Sambuc    typedef typename traits_type::pos_type pos_type;
5834684ddb6SLionel Sambuc    typedef typename traits_type::off_type off_type;
5844684ddb6SLionel Sambuc
5854684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE
5864684ddb6SLionel Sambuc        _LIBCPP_EXPLICIT
5874684ddb6SLionel Sambuc        operator bool() const {return !fail();}
5884684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE bool operator!() const    {return  fail();}
5894684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE iostate rdstate() const   {return ios_base::rdstate();}
5904684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE void clear(iostate __state = goodbit) {ios_base::clear(__state);}
5914684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE void setstate(iostate __state) {ios_base::setstate(__state);}
5924684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE bool good() const {return ios_base::good();}
5934684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE bool eof() const  {return ios_base::eof();}
5944684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE bool fail() const {return ios_base::fail();}
5954684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE bool bad() const  {return ios_base::bad();}
5964684ddb6SLionel Sambuc
5974684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
5984684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
5994684ddb6SLionel Sambuc
6004684ddb6SLionel Sambuc    // 27.5.4.1 Constructor/destructor:
6014684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6024684ddb6SLionel Sambuc    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
6034684ddb6SLionel Sambuc    virtual ~basic_ios();
6044684ddb6SLionel Sambuc
6054684ddb6SLionel Sambuc    // 27.5.4.2 Members:
6064684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6074684ddb6SLionel Sambuc    basic_ostream<char_type, traits_type>* tie() const;
6084684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6094684ddb6SLionel Sambuc    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
6104684ddb6SLionel Sambuc
6114684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6124684ddb6SLionel Sambuc    basic_streambuf<char_type, traits_type>* rdbuf() const;
6134684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6144684ddb6SLionel Sambuc    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
6154684ddb6SLionel Sambuc
6164684ddb6SLionel Sambuc    basic_ios& copyfmt(const basic_ios& __rhs);
6174684ddb6SLionel Sambuc
6184684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6194684ddb6SLionel Sambuc    char_type fill() const;
6204684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6214684ddb6SLionel Sambuc    char_type fill(char_type __ch);
6224684ddb6SLionel Sambuc
6234684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6244684ddb6SLionel Sambuc    locale imbue(const locale& __loc);
6254684ddb6SLionel Sambuc
6264684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6274684ddb6SLionel Sambuc    char narrow(char_type __c, char __dfault) const;
6284684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6294684ddb6SLionel Sambuc    char_type widen(char __c) const;
6304684ddb6SLionel Sambuc
6314684ddb6SLionel Sambucprotected:
6324684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE
6334684ddb6SLionel Sambuc    basic_ios() {// purposefully does no initialization
6344684ddb6SLionel Sambuc                }
6354684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6364684ddb6SLionel Sambuc    void init(basic_streambuf<char_type, traits_type>* __sb);
6374684ddb6SLionel Sambuc
6384684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6394684ddb6SLionel Sambuc    void move(basic_ios& __rhs);
6404684ddb6SLionel Sambuc#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
6414684ddb6SLionel Sambuc    _LIBCPP_ALWAYS_INLINE
6424684ddb6SLionel Sambuc    void move(basic_ios&& __rhs) {move(__rhs);}
6434684ddb6SLionel Sambuc#endif
6444684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6454684ddb6SLionel Sambuc    void swap(basic_ios& __rhs) _NOEXCEPT;
6464684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
6474684ddb6SLionel Sambuc    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
6484684ddb6SLionel Sambucprivate:
6494684ddb6SLionel Sambuc    basic_ostream<char_type, traits_type>* __tie_;
6504684ddb6SLionel Sambuc     mutable int_type __fill_;
6514684ddb6SLionel Sambuc};
6524684ddb6SLionel Sambuc
6534684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6544684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
6554684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
6564684ddb6SLionel Sambuc{
6574684ddb6SLionel Sambuc    init(__sb);
6584684ddb6SLionel Sambuc}
6594684ddb6SLionel Sambuc
6604684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6614684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::~basic_ios()
6624684ddb6SLionel Sambuc{
6634684ddb6SLionel Sambuc}
6644684ddb6SLionel Sambuc
6654684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6664684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
6674684ddb6SLionel Sambucvoid
6684684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
6694684ddb6SLionel Sambuc{
6704684ddb6SLionel Sambuc    ios_base::init(__sb);
6714684ddb6SLionel Sambuc    __tie_ = 0;
6724684ddb6SLionel Sambuc    __fill_ = traits_type::eof();
6734684ddb6SLionel Sambuc}
6744684ddb6SLionel Sambuc
6754684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
6774684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>*
6784684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::tie() const
6794684ddb6SLionel Sambuc{
6804684ddb6SLionel Sambuc    return __tie_;
6814684ddb6SLionel Sambuc}
6824684ddb6SLionel Sambuc
6834684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
6854684ddb6SLionel Sambucbasic_ostream<_CharT, _Traits>*
6864684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
6874684ddb6SLionel Sambuc{
6884684ddb6SLionel Sambuc    basic_ostream<char_type, traits_type>* __r = __tie_;
6894684ddb6SLionel Sambuc    __tie_ = __tiestr;
6904684ddb6SLionel Sambuc    return __r;
6914684ddb6SLionel Sambuc}
6924684ddb6SLionel Sambuc
6934684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
6944684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
6954684ddb6SLionel Sambucbasic_streambuf<_CharT, _Traits>*
6964684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::rdbuf() const
6974684ddb6SLionel Sambuc{
6984684ddb6SLionel Sambuc    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
6994684ddb6SLionel Sambuc}
7004684ddb6SLionel Sambuc
7014684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7024684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7034684ddb6SLionel Sambucbasic_streambuf<_CharT, _Traits>*
7044684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
7054684ddb6SLionel Sambuc{
7064684ddb6SLionel Sambuc    basic_streambuf<char_type, traits_type>* __r = rdbuf();
7074684ddb6SLionel Sambuc    ios_base::rdbuf(__sb);
7084684ddb6SLionel Sambuc    return __r;
7094684ddb6SLionel Sambuc}
7104684ddb6SLionel Sambuc
7114684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7124684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7134684ddb6SLionel Sambuclocale
7144684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::imbue(const locale& __loc)
7154684ddb6SLionel Sambuc{
7164684ddb6SLionel Sambuc    locale __r = getloc();
7174684ddb6SLionel Sambuc    ios_base::imbue(__loc);
7184684ddb6SLionel Sambuc    if (rdbuf())
7194684ddb6SLionel Sambuc        rdbuf()->pubimbue(__loc);
7204684ddb6SLionel Sambuc    return __r;
7214684ddb6SLionel Sambuc}
7224684ddb6SLionel Sambuc
7234684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7254684ddb6SLionel Sambucchar
7264684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
7274684ddb6SLionel Sambuc{
7284684ddb6SLionel Sambuc    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
7294684ddb6SLionel Sambuc}
7304684ddb6SLionel Sambuc
7314684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7334684ddb6SLionel Sambuc_CharT
7344684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::widen(char __c) const
7354684ddb6SLionel Sambuc{
7364684ddb6SLionel Sambuc    return use_facet<ctype<char_type> >(getloc()).widen(__c);
7374684ddb6SLionel Sambuc}
7384684ddb6SLionel Sambuc
7394684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7414684ddb6SLionel Sambuc_CharT
7424684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::fill() const
7434684ddb6SLionel Sambuc{
7444684ddb6SLionel Sambuc    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
7454684ddb6SLionel Sambuc        __fill_ = widen(' ');
7464684ddb6SLionel Sambuc    return __fill_;
7474684ddb6SLionel Sambuc}
7484684ddb6SLionel Sambuc
7494684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7504684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7514684ddb6SLionel Sambuc_CharT
7524684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::fill(char_type __ch)
7534684ddb6SLionel Sambuc{
7544684ddb6SLionel Sambuc    char_type __r = __fill_;
7554684ddb6SLionel Sambuc    __fill_ = __ch;
7564684ddb6SLionel Sambuc    return __r;
7574684ddb6SLionel Sambuc}
7584684ddb6SLionel Sambuc
7594684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7604684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>&
7614684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
7624684ddb6SLionel Sambuc{
7634684ddb6SLionel Sambuc    if (this != &__rhs)
7644684ddb6SLionel Sambuc    {
7654684ddb6SLionel Sambuc        __call_callbacks(erase_event);
7664684ddb6SLionel Sambuc        ios_base::copyfmt(__rhs);
7674684ddb6SLionel Sambuc        __tie_ = __rhs.__tie_;
7684684ddb6SLionel Sambuc        __fill_ = __rhs.__fill_;
7694684ddb6SLionel Sambuc        __call_callbacks(copyfmt_event);
7704684ddb6SLionel Sambuc        exceptions(__rhs.exceptions());
7714684ddb6SLionel Sambuc    }
7724684ddb6SLionel Sambuc    return *this;
7734684ddb6SLionel Sambuc}
7744684ddb6SLionel Sambuc
7754684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7774684ddb6SLionel Sambucvoid
7784684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
7794684ddb6SLionel Sambuc{
7804684ddb6SLionel Sambuc    ios_base::move(__rhs);
7814684ddb6SLionel Sambuc    __tie_ = __rhs.__tie_;
7824684ddb6SLionel Sambuc    __rhs.__tie_ = 0;
7834684ddb6SLionel Sambuc    __fill_ = __rhs.__fill_;
7844684ddb6SLionel Sambuc}
7854684ddb6SLionel Sambuc
7864684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7874684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7884684ddb6SLionel Sambucvoid
7894684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
7904684ddb6SLionel Sambuc{
7914684ddb6SLionel Sambuc    ios_base::swap(__rhs);
7924684ddb6SLionel Sambuc    _VSTD::swap(__tie_, __rhs.__tie_);
7934684ddb6SLionel Sambuc    _VSTD::swap(__fill_, __rhs.__fill_);
7944684ddb6SLionel Sambuc}
7954684ddb6SLionel Sambuc
7964684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
7974684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
7984684ddb6SLionel Sambucvoid
7994684ddb6SLionel Sambucbasic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
8004684ddb6SLionel Sambuc{
8014684ddb6SLionel Sambuc    ios_base::set_rdbuf(__sb);
8024684ddb6SLionel Sambuc}
8034684ddb6SLionel Sambuc
8044684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8054684ddb6SLionel Sambucios_base&
8064684ddb6SLionel Sambucboolalpha(ios_base& __str)
8074684ddb6SLionel Sambuc{
8084684ddb6SLionel Sambuc    __str.setf(ios_base::boolalpha);
8094684ddb6SLionel Sambuc    return __str;
8104684ddb6SLionel Sambuc}
8114684ddb6SLionel Sambuc
8124684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8134684ddb6SLionel Sambucios_base&
8144684ddb6SLionel Sambucnoboolalpha(ios_base& __str)
8154684ddb6SLionel Sambuc{
8164684ddb6SLionel Sambuc    __str.unsetf(ios_base::boolalpha);
8174684ddb6SLionel Sambuc    return __str;
8184684ddb6SLionel Sambuc}
8194684ddb6SLionel Sambuc
8204684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8214684ddb6SLionel Sambucios_base&
8224684ddb6SLionel Sambucshowbase(ios_base& __str)
8234684ddb6SLionel Sambuc{
8244684ddb6SLionel Sambuc    __str.setf(ios_base::showbase);
8254684ddb6SLionel Sambuc    return __str;
8264684ddb6SLionel Sambuc}
8274684ddb6SLionel Sambuc
8284684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8294684ddb6SLionel Sambucios_base&
8304684ddb6SLionel Sambucnoshowbase(ios_base& __str)
8314684ddb6SLionel Sambuc{
8324684ddb6SLionel Sambuc    __str.unsetf(ios_base::showbase);
8334684ddb6SLionel Sambuc    return __str;
8344684ddb6SLionel Sambuc}
8354684ddb6SLionel Sambuc
8364684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8374684ddb6SLionel Sambucios_base&
8384684ddb6SLionel Sambucshowpoint(ios_base& __str)
8394684ddb6SLionel Sambuc{
8404684ddb6SLionel Sambuc    __str.setf(ios_base::showpoint);
8414684ddb6SLionel Sambuc    return __str;
8424684ddb6SLionel Sambuc}
8434684ddb6SLionel Sambuc
8444684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8454684ddb6SLionel Sambucios_base&
8464684ddb6SLionel Sambucnoshowpoint(ios_base& __str)
8474684ddb6SLionel Sambuc{
8484684ddb6SLionel Sambuc    __str.unsetf(ios_base::showpoint);
8494684ddb6SLionel Sambuc    return __str;
8504684ddb6SLionel Sambuc}
8514684ddb6SLionel Sambuc
8524684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8534684ddb6SLionel Sambucios_base&
8544684ddb6SLionel Sambucshowpos(ios_base& __str)
8554684ddb6SLionel Sambuc{
8564684ddb6SLionel Sambuc    __str.setf(ios_base::showpos);
8574684ddb6SLionel Sambuc    return __str;
8584684ddb6SLionel Sambuc}
8594684ddb6SLionel Sambuc
8604684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8614684ddb6SLionel Sambucios_base&
8624684ddb6SLionel Sambucnoshowpos(ios_base& __str)
8634684ddb6SLionel Sambuc{
8644684ddb6SLionel Sambuc    __str.unsetf(ios_base::showpos);
8654684ddb6SLionel Sambuc    return __str;
8664684ddb6SLionel Sambuc}
8674684ddb6SLionel Sambuc
8684684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8694684ddb6SLionel Sambucios_base&
8704684ddb6SLionel Sambucskipws(ios_base& __str)
8714684ddb6SLionel Sambuc{
8724684ddb6SLionel Sambuc    __str.setf(ios_base::skipws);
8734684ddb6SLionel Sambuc    return __str;
8744684ddb6SLionel Sambuc}
8754684ddb6SLionel Sambuc
8764684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8774684ddb6SLionel Sambucios_base&
8784684ddb6SLionel Sambucnoskipws(ios_base& __str)
8794684ddb6SLionel Sambuc{
8804684ddb6SLionel Sambuc    __str.unsetf(ios_base::skipws);
8814684ddb6SLionel Sambuc    return __str;
8824684ddb6SLionel Sambuc}
8834684ddb6SLionel Sambuc
8844684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8854684ddb6SLionel Sambucios_base&
8864684ddb6SLionel Sambucuppercase(ios_base& __str)
8874684ddb6SLionel Sambuc{
8884684ddb6SLionel Sambuc    __str.setf(ios_base::uppercase);
8894684ddb6SLionel Sambuc    return __str;
8904684ddb6SLionel Sambuc}
8914684ddb6SLionel Sambuc
8924684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
8934684ddb6SLionel Sambucios_base&
8944684ddb6SLionel Sambucnouppercase(ios_base& __str)
8954684ddb6SLionel Sambuc{
8964684ddb6SLionel Sambuc    __str.unsetf(ios_base::uppercase);
8974684ddb6SLionel Sambuc    return __str;
8984684ddb6SLionel Sambuc}
8994684ddb6SLionel Sambuc
9004684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9014684ddb6SLionel Sambucios_base&
9024684ddb6SLionel Sambucunitbuf(ios_base& __str)
9034684ddb6SLionel Sambuc{
9044684ddb6SLionel Sambuc    __str.setf(ios_base::unitbuf);
9054684ddb6SLionel Sambuc    return __str;
9064684ddb6SLionel Sambuc}
9074684ddb6SLionel Sambuc
9084684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9094684ddb6SLionel Sambucios_base&
9104684ddb6SLionel Sambucnounitbuf(ios_base& __str)
9114684ddb6SLionel Sambuc{
9124684ddb6SLionel Sambuc    __str.unsetf(ios_base::unitbuf);
9134684ddb6SLionel Sambuc    return __str;
9144684ddb6SLionel Sambuc}
9154684ddb6SLionel Sambuc
9164684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9174684ddb6SLionel Sambucios_base&
9184684ddb6SLionel Sambucinternal(ios_base& __str)
9194684ddb6SLionel Sambuc{
9204684ddb6SLionel Sambuc    __str.setf(ios_base::internal, ios_base::adjustfield);
9214684ddb6SLionel Sambuc    return __str;
9224684ddb6SLionel Sambuc}
9234684ddb6SLionel Sambuc
9244684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9254684ddb6SLionel Sambucios_base&
9264684ddb6SLionel Sambucleft(ios_base& __str)
9274684ddb6SLionel Sambuc{
9284684ddb6SLionel Sambuc    __str.setf(ios_base::left, ios_base::adjustfield);
9294684ddb6SLionel Sambuc    return __str;
9304684ddb6SLionel Sambuc}
9314684ddb6SLionel Sambuc
9324684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9334684ddb6SLionel Sambucios_base&
9344684ddb6SLionel Sambucright(ios_base& __str)
9354684ddb6SLionel Sambuc{
9364684ddb6SLionel Sambuc    __str.setf(ios_base::right, ios_base::adjustfield);
9374684ddb6SLionel Sambuc    return __str;
9384684ddb6SLionel Sambuc}
9394684ddb6SLionel Sambuc
9404684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9414684ddb6SLionel Sambucios_base&
9424684ddb6SLionel Sambucdec(ios_base& __str)
9434684ddb6SLionel Sambuc{
9444684ddb6SLionel Sambuc    __str.setf(ios_base::dec, ios_base::basefield);
9454684ddb6SLionel Sambuc    return __str;
9464684ddb6SLionel Sambuc}
9474684ddb6SLionel Sambuc
9484684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9494684ddb6SLionel Sambucios_base&
9504684ddb6SLionel Sambuchex(ios_base& __str)
9514684ddb6SLionel Sambuc{
9524684ddb6SLionel Sambuc    __str.setf(ios_base::hex, ios_base::basefield);
9534684ddb6SLionel Sambuc    return __str;
9544684ddb6SLionel Sambuc}
9554684ddb6SLionel Sambuc
9564684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9574684ddb6SLionel Sambucios_base&
9584684ddb6SLionel Sambucoct(ios_base& __str)
9594684ddb6SLionel Sambuc{
9604684ddb6SLionel Sambuc    __str.setf(ios_base::oct, ios_base::basefield);
9614684ddb6SLionel Sambuc    return __str;
9624684ddb6SLionel Sambuc}
9634684ddb6SLionel Sambuc
9644684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9654684ddb6SLionel Sambucios_base&
9664684ddb6SLionel Sambucfixed(ios_base& __str)
9674684ddb6SLionel Sambuc{
9684684ddb6SLionel Sambuc    __str.setf(ios_base::fixed, ios_base::floatfield);
9694684ddb6SLionel Sambuc    return __str;
9704684ddb6SLionel Sambuc}
9714684ddb6SLionel Sambuc
9724684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9734684ddb6SLionel Sambucios_base&
9744684ddb6SLionel Sambucscientific(ios_base& __str)
9754684ddb6SLionel Sambuc{
9764684ddb6SLionel Sambuc    __str.setf(ios_base::scientific, ios_base::floatfield);
9774684ddb6SLionel Sambuc    return __str;
9784684ddb6SLionel Sambuc}
9794684ddb6SLionel Sambuc
9804684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9814684ddb6SLionel Sambucios_base&
9824684ddb6SLionel Sambuchexfloat(ios_base& __str)
9834684ddb6SLionel Sambuc{
9844684ddb6SLionel Sambuc    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
9854684ddb6SLionel Sambuc    return __str;
9864684ddb6SLionel Sambuc}
9874684ddb6SLionel Sambuc
9884684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY
9894684ddb6SLionel Sambucios_base&
9904684ddb6SLionel Sambucdefaultfloat(ios_base& __str)
9914684ddb6SLionel Sambuc{
9924684ddb6SLionel Sambuc    __str.unsetf(ios_base::floatfield);
9934684ddb6SLionel Sambuc    return __str;
9944684ddb6SLionel Sambuc}
9954684ddb6SLionel Sambuc
9964684ddb6SLionel Sambuctemplate <class _CharT, class _Traits>
9974684ddb6SLionel Sambucclass __save_flags
9984684ddb6SLionel Sambuc{
9994684ddb6SLionel Sambuc    typedef basic_ios<_CharT, _Traits> __stream_type;
10004684ddb6SLionel Sambuc    typedef typename __stream_type::fmtflags fmtflags;
10014684ddb6SLionel Sambuc
10024684ddb6SLionel Sambuc    __stream_type& __stream_;
10034684ddb6SLionel Sambuc    fmtflags       __fmtflags_;
10044684ddb6SLionel Sambuc    _CharT         __fill_;
10054684ddb6SLionel Sambuc
10064684ddb6SLionel Sambuc    __save_flags(const __save_flags&);
10074684ddb6SLionel Sambuc    __save_flags& operator=(const __save_flags&);
10084684ddb6SLionel Sambucpublic:
10094684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10104684ddb6SLionel Sambuc    explicit __save_flags(__stream_type& __stream)
10114684ddb6SLionel Sambuc        : __stream_(__stream),
10124684ddb6SLionel Sambuc          __fmtflags_(__stream.flags()),
10134684ddb6SLionel Sambuc          __fill_(__stream.fill())
10144684ddb6SLionel Sambuc        {}
10154684ddb6SLionel Sambuc    _LIBCPP_INLINE_VISIBILITY
10164684ddb6SLionel Sambuc    ~__save_flags()
10174684ddb6SLionel Sambuc    {
10184684ddb6SLionel Sambuc        __stream_.flags(__fmtflags_);
10194684ddb6SLionel Sambuc        __stream_.fill(__fill_);
10204684ddb6SLionel Sambuc    }
10214684ddb6SLionel Sambuc};
10224684ddb6SLionel Sambuc
10234684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD
10244684ddb6SLionel Sambuc
10254684ddb6SLionel Sambuc#endif  // _LIBCPP_IOS
1026