Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
ios1054 linesDownload Raw Back to include
1// -*- C++ -*-2//===---------------------------- ios -------------------------------------===//3//4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.5// See https://llvm.org/LICENSE.txt for license information.6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception7//8//===----------------------------------------------------------------------===//9 10#ifndef _LIBCUDACXX_IOS11#define _LIBCUDACXX_IOS12 13/*14    ios synopsis15 16#include <iosfwd>17 18namespace std19{20 21typedef OFF_T streamoff;22typedef SZ_T streamsize;23template <class stateT> class fpos;24 25class ios_base26{27public:28    class failure;29 30    typedef T1 fmtflags;31    static constexpr fmtflags boolalpha;32    static constexpr fmtflags dec;33    static constexpr fmtflags fixed;34    static constexpr fmtflags hex;35    static constexpr fmtflags internal;36    static constexpr fmtflags left;37    static constexpr fmtflags oct;38    static constexpr fmtflags right;39    static constexpr fmtflags scientific;40    static constexpr fmtflags showbase;41    static constexpr fmtflags showpoint;42    static constexpr fmtflags showpos;43    static constexpr fmtflags skipws;44    static constexpr fmtflags unitbuf;45    static constexpr fmtflags uppercase;46    static constexpr fmtflags adjustfield;47    static constexpr fmtflags basefield;48    static constexpr fmtflags floatfield;49 50    typedef T2 iostate;51    static constexpr iostate badbit;52    static constexpr iostate eofbit;53    static constexpr iostate failbit;54    static constexpr iostate goodbit;55 56    typedef T3 openmode;57    static constexpr openmode app;58    static constexpr openmode ate;59    static constexpr openmode binary;60    static constexpr openmode in;61    static constexpr openmode out;62    static constexpr openmode trunc;63 64    typedef T4 seekdir;65    static constexpr seekdir beg;66    static constexpr seekdir cur;67    static constexpr seekdir end;68 69    class Init;70 71    // 27.5.2.2 fmtflags state:72    fmtflags flags() const;73    fmtflags flags(fmtflags fmtfl);74    fmtflags setf(fmtflags fmtfl);75    fmtflags setf(fmtflags fmtfl, fmtflags mask);76    void unsetf(fmtflags mask);77 78    streamsize precision() const;79    streamsize precision(streamsize prec);80    streamsize width() const;81    streamsize width(streamsize wide);82 83    // 27.5.2.3 locales:84    locale imbue(const locale& loc);85    locale getloc() const;86 87    // 27.5.2.5 storage:88    static int xalloc();89    long& iword(int index);90    void*& pword(int index);91 92    // destructor93    virtual ~ios_base();94 95    // 27.5.2.6 callbacks;96    enum event { erase_event, imbue_event, copyfmt_event };97    typedef void (*event_callback)(event, ios_base&, int index);98    void register_callback(event_callback fn, int index);99 100    ios_base(const ios_base&) = delete;101    ios_base& operator=(const ios_base&) = delete;102 103    static bool sync_with_stdio(bool sync = true);104 105protected:106    ios_base();107};108 109template <class charT, class traits = char_traits<charT> >110class basic_ios111    : public ios_base112{113public:114    // types:115    typedef charT char_type;116    typedef typename traits::int_type int_type;  // removed in C++17117    typedef typename traits::pos_type pos_type;  // removed in C++17118    typedef typename traits::off_type off_type;  // removed in C++17119    typedef traits traits_type;120 121    operator unspecified-bool-type() const;122    bool operator!() const;123    iostate rdstate() const;124    void clear(iostate state = goodbit);125    void setstate(iostate state);126    bool good() const;127    bool eof() const;128    bool fail() const;129    bool bad() const;130 131    iostate exceptions() const;132    void exceptions(iostate except);133 134    // 27.5.4.1 Constructor/destructor:135    explicit basic_ios(basic_streambuf<charT,traits>* sb);136    virtual ~basic_ios();137 138    // 27.5.4.2 Members:139    basic_ostream<charT,traits>* tie() const;140    basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);141 142    basic_streambuf<charT,traits>* rdbuf() const;143    basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);144 145    basic_ios& copyfmt(const basic_ios& rhs);146 147    char_type fill() const;148    char_type fill(char_type ch);149 150    locale imbue(const locale& loc);151 152    char narrow(char_type c, char dfault) const;153    char_type widen(char c) const;154 155    basic_ios(const basic_ios& ) = delete;156    basic_ios& operator=(const basic_ios&) = delete;157 158protected:159    basic_ios();160    void init(basic_streambuf<charT,traits>* sb);161    void move(basic_ios& rhs);162    void swap(basic_ios& rhs) noexcept;163    void set_rdbuf(basic_streambuf<charT, traits>* sb);164};165 166// 27.5.5, manipulators:167ios_base& boolalpha (ios_base& str);168ios_base& noboolalpha(ios_base& str);169ios_base& showbase (ios_base& str);170ios_base& noshowbase (ios_base& str);171ios_base& showpoint (ios_base& str);172ios_base& noshowpoint(ios_base& str);173ios_base& showpos (ios_base& str);174ios_base& noshowpos (ios_base& str);175ios_base& skipws (ios_base& str);176ios_base& noskipws (ios_base& str);177ios_base& uppercase (ios_base& str);178ios_base& nouppercase(ios_base& str);179ios_base& unitbuf (ios_base& str);180ios_base& nounitbuf (ios_base& str);181 182// 27.5.5.2 adjustfield:183ios_base& internal (ios_base& str);184ios_base& left (ios_base& str);185ios_base& right (ios_base& str);186 187// 27.5.5.3 basefield:188ios_base& dec (ios_base& str);189ios_base& hex (ios_base& str);190ios_base& oct (ios_base& str);191 192// 27.5.5.4 floatfield:193ios_base& fixed (ios_base& str);194ios_base& scientific (ios_base& str);195ios_base& hexfloat (ios_base& str);196ios_base& defaultfloat(ios_base& str);197 198// 27.5.5.5 error reporting:199enum class io_errc200{201    stream = 1202};203 204concept_map ErrorCodeEnum<io_errc> { };205error_code make_error_code(io_errc e) noexcept;206error_condition make_error_condition(io_errc e) noexcept;207storage-class-specifier const error_category& iostream_category() noexcept;208 209}  // std210 211*/212 213#include <__config>214#include <iosfwd>215#include <__locale>216#include <system_error>217 218#if !defined(_LIBCUDACXX_HAS_NO_ATOMIC_HEADER)219#include <atomic>     // for __xindex_220#endif221 222#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)223#  pragma GCC system_header224#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)225#  pragma clang system_header226#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)227#  pragma system_header228#endif // no system header229 230_LIBCUDACXX_BEGIN_NAMESPACE_STD231 232typedef ptrdiff_t streamsize;233 234class _LIBCUDACXX_TYPE_VIS ios_base235{236public:237    class _LIBCUDACXX_EXCEPTION_ABI failure;238 239    typedef unsigned int fmtflags;240    static const fmtflags boolalpha   = 0x0001;241    static const fmtflags dec         = 0x0002;242    static const fmtflags fixed       = 0x0004;243    static const fmtflags hex         = 0x0008;244    static const fmtflags internal    = 0x0010;245    static const fmtflags left        = 0x0020;246    static const fmtflags oct         = 0x0040;247    static const fmtflags right       = 0x0080;248    static const fmtflags scientific  = 0x0100;249    static const fmtflags showbase    = 0x0200;250    static const fmtflags showpoint   = 0x0400;251    static const fmtflags showpos     = 0x0800;252    static const fmtflags skipws      = 0x1000;253    static const fmtflags unitbuf     = 0x2000;254    static const fmtflags uppercase   = 0x4000;255    static const fmtflags adjustfield = left | right | internal;256    static const fmtflags basefield   = dec | oct | hex;257    static const fmtflags floatfield  = scientific | fixed;258 259    typedef unsigned int iostate;260    static const iostate badbit  = 0x1;261    static const iostate eofbit  = 0x2;262    static const iostate failbit = 0x4;263    static const iostate goodbit = 0x0;264 265    typedef unsigned int openmode;266    static const openmode app    = 0x01;267    static const openmode ate    = 0x02;268    static const openmode binary = 0x04;269    static const openmode in     = 0x08;270    static const openmode out    = 0x10;271    static const openmode trunc  = 0x20;272 273    enum seekdir {beg, cur, end};274 275#if _LIBCUDACXX_STD_VER <= 14276    typedef iostate      io_state;277    typedef openmode     open_mode;278    typedef seekdir      seek_dir;279 280    typedef _CUDA_VSTD::streamoff streamoff;281    typedef _CUDA_VSTD::streampos streampos;282#endif283 284    class _LIBCUDACXX_TYPE_VIS Init;285 286    // 27.5.2.2 fmtflags state:287    _LIBCUDACXX_INLINE_VISIBILITY fmtflags flags() const;288    _LIBCUDACXX_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);289    _LIBCUDACXX_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);290    _LIBCUDACXX_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);291    _LIBCUDACXX_INLINE_VISIBILITY void unsetf(fmtflags __mask);292 293    _LIBCUDACXX_INLINE_VISIBILITY streamsize precision() const;294    _LIBCUDACXX_INLINE_VISIBILITY streamsize precision(streamsize __prec);295    _LIBCUDACXX_INLINE_VISIBILITY streamsize width() const;296    _LIBCUDACXX_INLINE_VISIBILITY streamsize width(streamsize __wide);297 298    // 27.5.2.3 locales:299    locale imbue(const locale& __loc);300    locale getloc() const;301 302    // 27.5.2.5 storage:303    static int xalloc();304    long& iword(int __index);305    void*& pword(int __index);306 307    // destructor308    virtual ~ios_base();309 310    // 27.5.2.6 callbacks;311    enum event { erase_event, imbue_event, copyfmt_event };312    typedef void (*event_callback)(event, ios_base&, int __index);313    void register_callback(event_callback __fn, int __index);314 315private:316    ios_base(const ios_base&); // = delete;317    ios_base& operator=(const ios_base&); // = delete;318 319public:320    static bool sync_with_stdio(bool __sync = true);321 322    _LIBCUDACXX_INLINE_VISIBILITY iostate rdstate() const;323    void clear(iostate __state = goodbit);324    _LIBCUDACXX_INLINE_VISIBILITY void setstate(iostate __state);325 326    _LIBCUDACXX_INLINE_VISIBILITY bool good() const;327    _LIBCUDACXX_INLINE_VISIBILITY bool eof() const;328    _LIBCUDACXX_INLINE_VISIBILITY bool fail() const;329    _LIBCUDACXX_INLINE_VISIBILITY bool bad() const;330 331    _LIBCUDACXX_INLINE_VISIBILITY iostate exceptions() const;332    _LIBCUDACXX_INLINE_VISIBILITY void exceptions(iostate __iostate);333 334    void __set_badbit_and_consider_rethrow();335    void __set_failbit_and_consider_rethrow();336 337    _LIBCUDACXX_INLINE_VISIBILITY338    void __setstate_nothrow(iostate __state)339    {340        if (__rdbuf_)341            __rdstate_ |= __state;342        else343            __rdstate_ |= __state | ios_base::badbit;344    }345 346protected:347    _LIBCUDACXX_INLINE_VISIBILITY348    ios_base() {// purposefully does no initialization349               }350 351    void init(void* __sb);352    _LIBCUDACXX_INLINE_VISIBILITY void* rdbuf() const {return __rdbuf_;}353 354    _LIBCUDACXX_INLINE_VISIBILITY355    void rdbuf(void* __sb)356    {357        __rdbuf_ = __sb;358        clear();359    }360 361    void __call_callbacks(event);362    void copyfmt(const ios_base&);363    void move(ios_base&);364    void swap(ios_base&) noexcept;365 366    _LIBCUDACXX_INLINE_VISIBILITY367    void set_rdbuf(void* __sb)368    {369        __rdbuf_ = __sb;370    }371 372private:373    // All data members must be scalars374    fmtflags        __fmtflags_;375    streamsize      __precision_;376    streamsize      __width_;377    iostate         __rdstate_;378    iostate         __exceptions_;379    void*           __rdbuf_;380    void*           __loc_;381    event_callback* __fn_;382    int*            __index_;383    size_t          __event_size_;384    size_t          __event_cap_;385// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only386// enabled with clang.387#if defined(_LIBCUDACXX_HAS_C_ATOMIC_IMP) && !defined(_LIBCUDACXX_HAS_NO_THREADS)388    static atomic<int> __xindex_;389#else390    static int      __xindex_;391#endif392    long*           __iarray_;393    size_t          __iarray_size_;394    size_t          __iarray_cap_;395    void**          __parray_;396    size_t          __parray_size_;397    size_t          __parray_cap_;398};399 400//enum class io_errc401_LIBCUDACXX_DECLARE_STRONG_ENUM(io_errc)402{403    stream = 1404};405_LIBCUDACXX_DECLARE_STRONG_ENUM_EPILOG(io_errc)406 407template <>408struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type { };409 410#ifdef _LIBCUDACXX_HAS_NO_STRONG_ENUMS411template <>412struct _LIBCUDACXX_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };413#endif414 415_LIBCUDACXX_FUNC_VIS416const error_category& iostream_category() noexcept;417 418inline _LIBCUDACXX_INLINE_VISIBILITY419error_code420make_error_code(io_errc __e) noexcept421{422    return error_code(static_cast<int>(__e), iostream_category());423}424 425inline _LIBCUDACXX_INLINE_VISIBILITY426error_condition427make_error_condition(io_errc __e) noexcept428{429    return error_condition(static_cast<int>(__e), iostream_category());430}431 432class _LIBCUDACXX_EXCEPTION_ABI ios_base::failure433    : public system_error434{435public:436    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);437    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);438    virtual ~failure() throw();439};440 441_LIBCUDACXX_NORETURN inline _LIBCUDACXX_INLINE_VISIBILITY442void __throw_failure(char const* __msg) {443#ifndef _LIBCUDACXX_NO_EXCEPTIONS444    throw ios_base::failure(__msg);445#else446    ((void)__msg);447    _CUDA_VSTD::abort();448#endif449}450 451class _LIBCUDACXX_TYPE_VIS ios_base::Init452{453public:454    Init();455    ~Init();456};457 458// fmtflags459 460inline _LIBCUDACXX_INLINE_VISIBILITY461ios_base::fmtflags462ios_base::flags() const463{464    return __fmtflags_;465}466 467inline _LIBCUDACXX_INLINE_VISIBILITY468ios_base::fmtflags469ios_base::flags(fmtflags __fmtfl)470{471    fmtflags __r = __fmtflags_;472    __fmtflags_ = __fmtfl;473    return __r;474}475 476inline _LIBCUDACXX_INLINE_VISIBILITY477ios_base::fmtflags478ios_base::setf(fmtflags __fmtfl)479{480    fmtflags __r = __fmtflags_;481    __fmtflags_ |= __fmtfl;482    return __r;483}484 485inline _LIBCUDACXX_INLINE_VISIBILITY486void487ios_base::unsetf(fmtflags __mask)488{489    __fmtflags_ &= ~__mask;490}491 492inline _LIBCUDACXX_INLINE_VISIBILITY493ios_base::fmtflags494ios_base::setf(fmtflags __fmtfl, fmtflags __mask)495{496    fmtflags __r = __fmtflags_;497    unsetf(__mask);498    __fmtflags_ |= __fmtfl & __mask;499    return __r;500}501 502// precision503 504inline _LIBCUDACXX_INLINE_VISIBILITY505streamsize506ios_base::precision() const507{508    return __precision_;509}510 511inline _LIBCUDACXX_INLINE_VISIBILITY512streamsize513ios_base::precision(streamsize __prec)514{515    streamsize __r = __precision_;516    __precision_ = __prec;517    return __r;518}519 520// width521 522inline _LIBCUDACXX_INLINE_VISIBILITY523streamsize524ios_base::width() const525{526    return __width_;527}528 529inline _LIBCUDACXX_INLINE_VISIBILITY530streamsize531ios_base::width(streamsize __wide)532{533    streamsize __r = __width_;534    __width_ = __wide;535    return __r;536}537 538// iostate539 540inline _LIBCUDACXX_INLINE_VISIBILITY541ios_base::iostate542ios_base::rdstate() const543{544    return __rdstate_;545}546 547inline _LIBCUDACXX_INLINE_VISIBILITY548void549ios_base::setstate(iostate __state)550{551    clear(__rdstate_ | __state);552}553 554inline _LIBCUDACXX_INLINE_VISIBILITY555bool556ios_base::good() const557{558    return __rdstate_ == 0;559}560 561inline _LIBCUDACXX_INLINE_VISIBILITY562bool563ios_base::eof() const564{565    return (__rdstate_ & eofbit) != 0;566}567 568inline _LIBCUDACXX_INLINE_VISIBILITY569bool570ios_base::fail() const571{572    return (__rdstate_ & (failbit | badbit)) != 0;573}574 575inline _LIBCUDACXX_INLINE_VISIBILITY576bool577ios_base::bad() const578{579    return (__rdstate_ & badbit) != 0;580}581 582inline _LIBCUDACXX_INLINE_VISIBILITY583ios_base::iostate584ios_base::exceptions() const585{586    return __exceptions_;587}588 589inline _LIBCUDACXX_INLINE_VISIBILITY590void591ios_base::exceptions(iostate __iostate)592{593    __exceptions_ = __iostate;594    clear(__rdstate_);595}596 597template <class _CharT, class _Traits>598class _LIBCUDACXX_TEMPLATE_VIS basic_ios599    : public ios_base600{601public:602    // types:603    typedef _CharT char_type;604    typedef _Traits traits_type;605 606    typedef typename traits_type::int_type int_type;607    typedef typename traits_type::pos_type pos_type;608    typedef typename traits_type::off_type off_type;609 610    static_assert((is_same<_CharT, typename traits_type::char_type>::value),611                  "traits_type::char_type must be the same type as CharT");612 613  // __true_value will generate undefined references when linking unless614  // we give it internal linkage.615 616    _LIBCUDACXX_INLINE_VISIBILITY617    _LIBCUDACXX_EXPLICIT operator bool() const {return !fail();}618    _LIBCUDACXX_INLINE_VISIBILITY bool operator!() const    {return  fail();}619    _LIBCUDACXX_INLINE_VISIBILITY iostate rdstate() const   {return ios_base::rdstate();}620    _LIBCUDACXX_INLINE_VISIBILITY void clear(iostate __state = goodbit) {ios_base::clear(__state);}621    _LIBCUDACXX_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);}622    _LIBCUDACXX_INLINE_VISIBILITY bool good() const {return ios_base::good();}623    _LIBCUDACXX_INLINE_VISIBILITY bool eof() const  {return ios_base::eof();}624    _LIBCUDACXX_INLINE_VISIBILITY bool fail() const {return ios_base::fail();}625    _LIBCUDACXX_INLINE_VISIBILITY bool bad() const  {return ios_base::bad();}626 627    _LIBCUDACXX_INLINE_VISIBILITY iostate exceptions() const {return ios_base::exceptions();}628    _LIBCUDACXX_INLINE_VISIBILITY void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}629 630    // 27.5.4.1 Constructor/destructor:631    _LIBCUDACXX_INLINE_VISIBILITY632    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);633    virtual ~basic_ios();634 635    // 27.5.4.2 Members:636    _LIBCUDACXX_INLINE_VISIBILITY637    basic_ostream<char_type, traits_type>* tie() const;638    _LIBCUDACXX_INLINE_VISIBILITY639    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);640 641    _LIBCUDACXX_INLINE_VISIBILITY642    basic_streambuf<char_type, traits_type>* rdbuf() const;643    _LIBCUDACXX_INLINE_VISIBILITY644    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);645 646    basic_ios& copyfmt(const basic_ios& __rhs);647 648    _LIBCUDACXX_INLINE_VISIBILITY649    char_type fill() const;650    _LIBCUDACXX_INLINE_VISIBILITY651    char_type fill(char_type __ch);652 653    _LIBCUDACXX_INLINE_VISIBILITY654    locale imbue(const locale& __loc);655 656    _LIBCUDACXX_INLINE_VISIBILITY657    char narrow(char_type __c, char __dfault) const;658    _LIBCUDACXX_INLINE_VISIBILITY659    char_type widen(char __c) const;660 661protected:662    _LIBCUDACXX_INLINE_VISIBILITY663    basic_ios() {// purposefully does no initialization664                }665    _LIBCUDACXX_INLINE_VISIBILITY666    void init(basic_streambuf<char_type, traits_type>* __sb);667 668    _LIBCUDACXX_INLINE_VISIBILITY669    void move(basic_ios& __rhs);670    _LIBCUDACXX_INLINE_VISIBILITY671    void move(basic_ios&& __rhs) {move(__rhs);}672    _LIBCUDACXX_INLINE_VISIBILITY673    void swap(basic_ios& __rhs) noexcept;674    _LIBCUDACXX_INLINE_VISIBILITY675    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);676private:677    basic_ostream<char_type, traits_type>* __tie_;678    mutable int_type __fill_;679};680 681template <class _CharT, class _Traits>682inline _LIBCUDACXX_INLINE_VISIBILITY683basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)684{685    init(__sb);686}687 688template <class _CharT, class _Traits>689basic_ios<_CharT, _Traits>::~basic_ios()690{691}692 693template <class _CharT, class _Traits>694inline _LIBCUDACXX_INLINE_VISIBILITY695void696basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)697{698    ios_base::init(__sb);699    __tie_ = 0;700    __fill_ = traits_type::eof();701}702 703template <class _CharT, class _Traits>704inline _LIBCUDACXX_INLINE_VISIBILITY705basic_ostream<_CharT, _Traits>*706basic_ios<_CharT, _Traits>::tie() const707{708    return __tie_;709}710 711template <class _CharT, class _Traits>712inline _LIBCUDACXX_INLINE_VISIBILITY713basic_ostream<_CharT, _Traits>*714basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)715{716    basic_ostream<char_type, traits_type>* __r = __tie_;717    __tie_ = __tiestr;718    return __r;719}720 721template <class _CharT, class _Traits>722inline _LIBCUDACXX_INLINE_VISIBILITY723basic_streambuf<_CharT, _Traits>*724basic_ios<_CharT, _Traits>::rdbuf() const725{726    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());727}728 729template <class _CharT, class _Traits>730inline _LIBCUDACXX_INLINE_VISIBILITY731basic_streambuf<_CharT, _Traits>*732basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)733{734    basic_streambuf<char_type, traits_type>* __r = rdbuf();735    ios_base::rdbuf(__sb);736    return __r;737}738 739template <class _CharT, class _Traits>740inline _LIBCUDACXX_INLINE_VISIBILITY741locale742basic_ios<_CharT, _Traits>::imbue(const locale& __loc)743{744    locale __r = getloc();745    ios_base::imbue(__loc);746    if (rdbuf())747        rdbuf()->pubimbue(__loc);748    return __r;749}750 751template <class _CharT, class _Traits>752inline _LIBCUDACXX_INLINE_VISIBILITY753char754basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const755{756    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);757}758 759template <class _CharT, class _Traits>760inline _LIBCUDACXX_INLINE_VISIBILITY761_CharT762basic_ios<_CharT, _Traits>::widen(char __c) const763{764    return use_facet<ctype<char_type> >(getloc()).widen(__c);765}766 767template <class _CharT, class _Traits>768inline _LIBCUDACXX_INLINE_VISIBILITY769_CharT770basic_ios<_CharT, _Traits>::fill() const771{772    if (traits_type::eq_int_type(traits_type::eof(), __fill_))773        __fill_ = widen(' ');774    return __fill_;775}776 777template <class _CharT, class _Traits>778inline _LIBCUDACXX_INLINE_VISIBILITY779_CharT780basic_ios<_CharT, _Traits>::fill(char_type __ch)781{782    char_type __r = __fill_;783    __fill_ = __ch;784    return __r;785}786 787template <class _CharT, class _Traits>788basic_ios<_CharT, _Traits>&789basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)790{791    if (this != &__rhs)792    {793        __call_callbacks(erase_event);794        ios_base::copyfmt(__rhs);795        __tie_ = __rhs.__tie_;796        __fill_ = __rhs.__fill_;797        __call_callbacks(copyfmt_event);798        exceptions(__rhs.exceptions());799    }800    return *this;801}802 803template <class _CharT, class _Traits>804inline _LIBCUDACXX_INLINE_VISIBILITY805void806basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)807{808    ios_base::move(__rhs);809    __tie_ = __rhs.__tie_;810    __rhs.__tie_ = 0;811    __fill_ = __rhs.__fill_;812}813 814template <class _CharT, class _Traits>815inline _LIBCUDACXX_INLINE_VISIBILITY816void817basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) noexcept818{819    ios_base::swap(__rhs);820    _CUDA_VSTD::swap(__tie_, __rhs.__tie_);821    _CUDA_VSTD::swap(__fill_, __rhs.__fill_);822}823 824template <class _CharT, class _Traits>825inline _LIBCUDACXX_INLINE_VISIBILITY826void827basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)828{829    ios_base::set_rdbuf(__sb);830}831 832inline _LIBCUDACXX_INLINE_VISIBILITY833ios_base&834boolalpha(ios_base& __str)835{836    __str.setf(ios_base::boolalpha);837    return __str;838}839 840inline _LIBCUDACXX_INLINE_VISIBILITY841ios_base&842noboolalpha(ios_base& __str)843{844    __str.unsetf(ios_base::boolalpha);845    return __str;846}847 848inline _LIBCUDACXX_INLINE_VISIBILITY849ios_base&850showbase(ios_base& __str)851{852    __str.setf(ios_base::showbase);853    return __str;854}855 856inline _LIBCUDACXX_INLINE_VISIBILITY857ios_base&858noshowbase(ios_base& __str)859{860    __str.unsetf(ios_base::showbase);861    return __str;862}863 864inline _LIBCUDACXX_INLINE_VISIBILITY865ios_base&866showpoint(ios_base& __str)867{868    __str.setf(ios_base::showpoint);869    return __str;870}871 872inline _LIBCUDACXX_INLINE_VISIBILITY873ios_base&874noshowpoint(ios_base& __str)875{876    __str.unsetf(ios_base::showpoint);877    return __str;878}879 880inline _LIBCUDACXX_INLINE_VISIBILITY881ios_base&882showpos(ios_base& __str)883{884    __str.setf(ios_base::showpos);885    return __str;886}887 888inline _LIBCUDACXX_INLINE_VISIBILITY889ios_base&890noshowpos(ios_base& __str)891{892    __str.unsetf(ios_base::showpos);893    return __str;894}895 896inline _LIBCUDACXX_INLINE_VISIBILITY897ios_base&898skipws(ios_base& __str)899{900    __str.setf(ios_base::skipws);901    return __str;902}903 904inline _LIBCUDACXX_INLINE_VISIBILITY905ios_base&906noskipws(ios_base& __str)907{908    __str.unsetf(ios_base::skipws);909    return __str;910}911 912inline _LIBCUDACXX_INLINE_VISIBILITY913ios_base&914uppercase(ios_base& __str)915{916    __str.setf(ios_base::uppercase);917    return __str;918}919 920inline _LIBCUDACXX_INLINE_VISIBILITY921ios_base&922nouppercase(ios_base& __str)923{924    __str.unsetf(ios_base::uppercase);925    return __str;926}927 928inline _LIBCUDACXX_INLINE_VISIBILITY929ios_base&930unitbuf(ios_base& __str)931{932    __str.setf(ios_base::unitbuf);933    return __str;934}935 936inline _LIBCUDACXX_INLINE_VISIBILITY937ios_base&938nounitbuf(ios_base& __str)939{940    __str.unsetf(ios_base::unitbuf);941    return __str;942}943 944inline _LIBCUDACXX_INLINE_VISIBILITY945ios_base&946internal(ios_base& __str)947{948    __str.setf(ios_base::internal, ios_base::adjustfield);949    return __str;950}951 952inline _LIBCUDACXX_INLINE_VISIBILITY953ios_base&954left(ios_base& __str)955{956    __str.setf(ios_base::left, ios_base::adjustfield);957    return __str;958}959 960inline _LIBCUDACXX_INLINE_VISIBILITY961ios_base&962right(ios_base& __str)963{964    __str.setf(ios_base::right, ios_base::adjustfield);965    return __str;966}967 968inline _LIBCUDACXX_INLINE_VISIBILITY969ios_base&970dec(ios_base& __str)971{972    __str.setf(ios_base::dec, ios_base::basefield);973    return __str;974}975 976inline _LIBCUDACXX_INLINE_VISIBILITY977ios_base&978hex(ios_base& __str)979{980    __str.setf(ios_base::hex, ios_base::basefield);981    return __str;982}983 984inline _LIBCUDACXX_INLINE_VISIBILITY985ios_base&986oct(ios_base& __str)987{988    __str.setf(ios_base::oct, ios_base::basefield);989    return __str;990}991 992inline _LIBCUDACXX_INLINE_VISIBILITY993ios_base&994fixed(ios_base& __str)995{996    __str.setf(ios_base::fixed, ios_base::floatfield);997    return __str;998}999 1000inline _LIBCUDACXX_INLINE_VISIBILITY1001ios_base&1002scientific(ios_base& __str)1003{1004    __str.setf(ios_base::scientific, ios_base::floatfield);1005    return __str;1006}1007 1008inline _LIBCUDACXX_INLINE_VISIBILITY1009ios_base&1010hexfloat(ios_base& __str)1011{1012    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);1013    return __str;1014}1015 1016inline _LIBCUDACXX_INLINE_VISIBILITY1017ios_base&1018defaultfloat(ios_base& __str)1019{1020    __str.unsetf(ios_base::floatfield);1021    return __str;1022}1023 1024template <class _CharT, class _Traits>1025class __save_flags1026{1027    typedef basic_ios<_CharT, _Traits> __stream_type;1028    typedef typename __stream_type::fmtflags fmtflags;1029 1030    __stream_type& __stream_;1031    fmtflags       __fmtflags_;1032    _CharT         __fill_;1033 1034    __save_flags(const __save_flags&);1035    __save_flags& operator=(const __save_flags&);1036public:1037    _LIBCUDACXX_INLINE_VISIBILITY1038    explicit __save_flags(__stream_type& __stream)1039        : __stream_(__stream),1040          __fmtflags_(__stream.flags()),1041          __fill_(__stream.fill())1042        {}1043    _LIBCUDACXX_INLINE_VISIBILITY1044    ~__save_flags()1045    {1046        __stream_.flags(__fmtflags_);1047        __stream_.fill(__fill_);1048    }1049};1050 1051_LIBCUDACXX_END_NAMESPACE_STD1052 1053#endif  // _LIBCUDACXX_IOS1054 
codekingpro/portable-devtools · Team Ai