Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 1 | // -*- C++ -*- |
Louis Dionne | eb8650a | 2021-11-17 21:25:01 | [diff] [blame] | 2 | //===----------------------------------------------------------------------===// |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 3 | // |
Chandler Carruth | 57b08b0 | 2019-01-19 10:56:40 | [diff] [blame] | 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-exception |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_IOS |
| 11 | #define _LIBCPP_IOS |
| 12 | |
| 13 | /* |
| 14 | ios synopsis |
| 15 | |
| 16 | #include <iosfwd> |
| 17 | |
| 18 | namespace std |
| 19 | { |
| 20 | |
| 21 | typedef OFF_T streamoff; |
| 22 | typedef SZ_T streamsize; |
| 23 | template <class stateT> class fpos; |
| 24 | |
| 25 | class ios_base |
| 26 | { |
| 27 | public: |
| 28 | class failure; |
| 29 | |
| 30 | typedef T1 fmtflags; |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 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; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 49 | |
| 50 | typedef T2 iostate; |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 51 | static constexpr iostate badbit; |
| 52 | static constexpr iostate eofbit; |
| 53 | static constexpr iostate failbit; |
| 54 | static constexpr iostate goodbit; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 55 | |
| 56 | typedef T3 openmode; |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 57 | static constexpr openmode app; |
| 58 | static constexpr openmode ate; |
| 59 | static constexpr openmode binary; |
| 60 | static constexpr openmode in; |
PragmaTwice | a3f17ba | 2023-09-18 20:32:02 | [diff] [blame] | 61 | static constexpr openmode noreplace; // since C++23 |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 62 | static constexpr openmode out; |
| 63 | static constexpr openmode trunc; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 64 | |
| 65 | typedef T4 seekdir; |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 66 | static constexpr seekdir beg; |
| 67 | static constexpr seekdir cur; |
| 68 | static constexpr seekdir end; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 69 | |
| 70 | class Init; |
| 71 | |
| 72 | // 27.5.2.2 fmtflags state: |
| 73 | fmtflags flags() const; |
| 74 | fmtflags flags(fmtflags fmtfl); |
| 75 | fmtflags setf(fmtflags fmtfl); |
| 76 | fmtflags setf(fmtflags fmtfl, fmtflags mask); |
| 77 | void unsetf(fmtflags mask); |
| 78 | |
| 79 | streamsize precision() const; |
| 80 | streamsize precision(streamsize prec); |
| 81 | streamsize width() const; |
| 82 | streamsize width(streamsize wide); |
| 83 | |
| 84 | // 27.5.2.3 locales: |
| 85 | locale imbue(const locale& loc); |
| 86 | locale getloc() const; |
| 87 | |
| 88 | // 27.5.2.5 storage: |
| 89 | static int xalloc(); |
| 90 | long& iword(int index); |
| 91 | void*& pword(int index); |
| 92 | |
| 93 | // destructor |
| 94 | virtual ~ios_base(); |
| 95 | |
| 96 | // 27.5.2.6 callbacks; |
| 97 | enum event { erase_event, imbue_event, copyfmt_event }; |
| 98 | typedef void (*event_callback)(event, ios_base&, int index); |
| 99 | void register_callback(event_callback fn, int index); |
| 100 | |
| 101 | ios_base(const ios_base&) = delete; |
| 102 | ios_base& operator=(const ios_base&) = delete; |
| 103 | |
| 104 | static bool sync_with_stdio(bool sync = true); |
| 105 | |
| 106 | protected: |
| 107 | ios_base(); |
| 108 | }; |
| 109 | |
| 110 | template <class charT, class traits = char_traits<charT> > |
| 111 | class basic_ios |
| 112 | : public ios_base |
| 113 | { |
| 114 | public: |
| 115 | // types: |
| 116 | typedef charT char_type; |
Marshall Clow | 131733b | 2015-10-29 05:43:30 | [diff] [blame] | 117 | typedef typename traits::int_type int_type; // removed in C++17 |
| 118 | typedef typename traits::pos_type pos_type; // removed in C++17 |
| 119 | typedef typename traits::off_type off_type; // removed in C++17 |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 120 | typedef traits traits_type; |
| 121 | |
| 122 | operator unspecified-bool-type() const; |
| 123 | bool operator!() const; |
| 124 | iostate rdstate() const; |
| 125 | void clear(iostate state = goodbit); |
| 126 | void setstate(iostate state); |
| 127 | bool good() const; |
| 128 | bool eof() const; |
| 129 | bool fail() const; |
| 130 | bool bad() const; |
| 131 | |
| 132 | iostate exceptions() const; |
| 133 | void exceptions(iostate except); |
| 134 | |
| 135 | // 27.5.4.1 Constructor/destructor: |
| 136 | explicit basic_ios(basic_streambuf<charT,traits>* sb); |
| 137 | virtual ~basic_ios(); |
| 138 | |
| 139 | // 27.5.4.2 Members: |
| 140 | basic_ostream<charT,traits>* tie() const; |
| 141 | basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr); |
| 142 | |
| 143 | basic_streambuf<charT,traits>* rdbuf() const; |
| 144 | basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb); |
| 145 | |
| 146 | basic_ios& copyfmt(const basic_ios& rhs); |
| 147 | |
| 148 | char_type fill() const; |
| 149 | char_type fill(char_type ch); |
| 150 | |
| 151 | locale imbue(const locale& loc); |
| 152 | |
| 153 | char narrow(char_type c, char dfault) const; |
| 154 | char_type widen(char c) const; |
| 155 | |
| 156 | basic_ios(const basic_ios& ) = delete; |
| 157 | basic_ios& operator=(const basic_ios&) = delete; |
| 158 | |
| 159 | protected: |
| 160 | basic_ios(); |
| 161 | void init(basic_streambuf<charT,traits>* sb); |
| 162 | void move(basic_ios& rhs); |
Howard Hinnant | 5d926bf | 2012-07-21 01:03:40 | [diff] [blame] | 163 | void swap(basic_ios& rhs) noexcept; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 164 | void set_rdbuf(basic_streambuf<charT, traits>* sb); |
| 165 | }; |
| 166 | |
| 167 | // 27.5.5, manipulators: |
| 168 | ios_base& boolalpha (ios_base& str); |
| 169 | ios_base& noboolalpha(ios_base& str); |
| 170 | ios_base& showbase (ios_base& str); |
| 171 | ios_base& noshowbase (ios_base& str); |
| 172 | ios_base& showpoint (ios_base& str); |
| 173 | ios_base& noshowpoint(ios_base& str); |
| 174 | ios_base& showpos (ios_base& str); |
| 175 | ios_base& noshowpos (ios_base& str); |
| 176 | ios_base& skipws (ios_base& str); |
| 177 | ios_base& noskipws (ios_base& str); |
| 178 | ios_base& uppercase (ios_base& str); |
| 179 | ios_base& nouppercase(ios_base& str); |
| 180 | ios_base& unitbuf (ios_base& str); |
| 181 | ios_base& nounitbuf (ios_base& str); |
| 182 | |
| 183 | // 27.5.5.2 adjustfield: |
| 184 | ios_base& internal (ios_base& str); |
| 185 | ios_base& left (ios_base& str); |
| 186 | ios_base& right (ios_base& str); |
| 187 | |
| 188 | // 27.5.5.3 basefield: |
| 189 | ios_base& dec (ios_base& str); |
| 190 | ios_base& hex (ios_base& str); |
| 191 | ios_base& oct (ios_base& str); |
| 192 | |
| 193 | // 27.5.5.4 floatfield: |
| 194 | ios_base& fixed (ios_base& str); |
| 195 | ios_base& scientific (ios_base& str); |
| 196 | ios_base& hexfloat (ios_base& str); |
| 197 | ios_base& defaultfloat(ios_base& str); |
| 198 | |
| 199 | // 27.5.5.5 error reporting: |
| 200 | enum class io_errc |
| 201 | { |
| 202 | stream = 1 |
| 203 | }; |
| 204 | |
| 205 | concept_map ErrorCodeEnum<io_errc> { }; |
Louis Dionne | a2a1ec2 | 2019-05-29 16:01:36 | [diff] [blame] | 206 | error_code make_error_code(io_errc e) noexcept; |
| 207 | error_condition make_error_condition(io_errc e) noexcept; |
Marshall Clow | c3776b1 | 2013-10-12 22:49:56 | [diff] [blame] | 208 | storage-class-specifier const error_category& iostream_category() noexcept; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 209 | |
| 210 | } // std |
| 211 | |
| 212 | */ |
| 213 | |
| 214 | #include <__config> |
Louis Dionne | 1c4b31c | 2022-05-18 17:17:14 | [diff] [blame] | 215 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 216 | #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) |
Louis Dionne | 1c4b31c | 2022-05-18 17:17:14 | [diff] [blame] | 217 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 218 | # include <__fwd/ios.h> |
| 219 | # include <__ios/fpos.h> |
| 220 | # include <__locale> |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 221 | # include <__memory/addressof.h> |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 222 | # include <__system_error/error_category.h> |
| 223 | # include <__system_error/error_code.h> |
| 224 | # include <__system_error/error_condition.h> |
| 225 | # include <__system_error/system_error.h> |
| 226 | # include <__utility/swap.h> |
| 227 | # include <__verbose_abort> |
| 228 | # include <version> |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 229 | |
Nikolas Klauser | db1978b | 2022-06-16 20:43:46 | [diff] [blame] | 230 | // standard-mandated includes |
Nikolas Klauser | 473a160 | 2022-09-22 16:05:08 | [diff] [blame] | 231 | |
| 232 | // [ios.syn] |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 233 | # include <iosfwd> |
Nikolas Klauser | db1978b | 2022-06-16 20:43:46 | [diff] [blame] | 234 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 235 | # if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) |
| 236 | # include <__atomic/atomic.h> // for __xindex_ |
| 237 | # endif |
Marshall Clow | f28fd28 | 2013-10-12 19:13:52 | [diff] [blame] | 238 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 239 | # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
| 240 | # pragma GCC system_header |
| 241 | # endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 242 | |
Louis Dionne | 7b46225 | 2024-01-25 20:48:46 | [diff] [blame] | 243 | _LIBCPP_PUSH_MACROS |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 244 | # include <__undef_macros> |
Louis Dionne | 7b46225 | 2024-01-25 20:48:46 | [diff] [blame] | 245 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 246 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 247 | |
| 248 | typedef ptrdiff_t streamsize; |
| 249 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 250 | class _LIBCPP_EXPORTED_FROM_ABI ios_base { |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 251 | public: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 252 | class _LIBCPP_EXPORTED_FROM_ABI failure; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 253 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 254 | typedef unsigned int fmtflags; |
| 255 | static const fmtflags boolalpha = 0x0001; |
| 256 | static const fmtflags dec = 0x0002; |
| 257 | static const fmtflags fixed = 0x0004; |
| 258 | static const fmtflags hex = 0x0008; |
| 259 | static const fmtflags internal = 0x0010; |
| 260 | static const fmtflags left = 0x0020; |
| 261 | static const fmtflags oct = 0x0040; |
| 262 | static const fmtflags right = 0x0080; |
| 263 | static const fmtflags scientific = 0x0100; |
| 264 | static const fmtflags showbase = 0x0200; |
| 265 | static const fmtflags showpoint = 0x0400; |
| 266 | static const fmtflags showpos = 0x0800; |
| 267 | static const fmtflags skipws = 0x1000; |
| 268 | static const fmtflags unitbuf = 0x2000; |
| 269 | static const fmtflags uppercase = 0x4000; |
| 270 | static const fmtflags adjustfield = left | right | internal; |
| 271 | static const fmtflags basefield = dec | oct | hex; |
| 272 | static const fmtflags floatfield = scientific | fixed; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 273 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 274 | typedef unsigned int iostate; |
| 275 | static const iostate badbit = 0x1; |
| 276 | static const iostate eofbit = 0x2; |
| 277 | static const iostate failbit = 0x4; |
| 278 | static const iostate goodbit = 0x0; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 279 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 280 | typedef unsigned int openmode; |
| 281 | static const openmode app = 0x01; |
| 282 | static const openmode ate = 0x02; |
| 283 | static const openmode binary = 0x04; |
| 284 | static const openmode in = 0x08; |
| 285 | static const openmode out = 0x10; |
| 286 | static const openmode trunc = 0x20; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 287 | # if _LIBCPP_STD_VER >= 23 |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 288 | static const openmode noreplace = 0x40; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 289 | # endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 290 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 291 | enum seekdir { beg, cur, end }; |
Marshall Clow | 131733b | 2015-10-29 05:43:30 | [diff] [blame] | 292 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 293 | # if _LIBCPP_STD_VER <= 14 |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 294 | typedef iostate io_state; |
| 295 | typedef openmode open_mode; |
| 296 | typedef seekdir seek_dir; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 297 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 298 | typedef std::streamoff streamoff; |
| 299 | typedef std::streampos streampos; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 300 | # endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 301 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 302 | class _LIBCPP_EXPORTED_FROM_ABI Init; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 303 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 304 | // 27.5.2.2 fmtflags state: |
| 305 | _LIBCPP_HIDE_FROM_ABI fmtflags flags() const; |
| 306 | _LIBCPP_HIDE_FROM_ABI fmtflags flags(fmtflags __fmtfl); |
| 307 | _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl); |
| 308 | _LIBCPP_HIDE_FROM_ABI fmtflags setf(fmtflags __fmtfl, fmtflags __mask); |
| 309 | _LIBCPP_HIDE_FROM_ABI void unsetf(fmtflags __mask); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 310 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 311 | _LIBCPP_HIDE_FROM_ABI streamsize precision() const; |
| 312 | _LIBCPP_HIDE_FROM_ABI streamsize precision(streamsize __prec); |
| 313 | _LIBCPP_HIDE_FROM_ABI streamsize width() const; |
| 314 | _LIBCPP_HIDE_FROM_ABI streamsize width(streamsize __wide); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 315 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 316 | // 27.5.2.3 locales: |
| 317 | locale imbue(const locale& __loc); |
| 318 | locale getloc() const; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 319 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 320 | // 27.5.2.5 storage: |
| 321 | static int xalloc(); |
| 322 | long& iword(int __index); |
| 323 | void*& pword(int __index); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 324 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 325 | // destructor |
| 326 | virtual ~ios_base(); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 327 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 328 | // 27.5.2.6 callbacks; |
| 329 | enum event { erase_event, imbue_event, copyfmt_event }; |
| 330 | typedef void (*event_callback)(event, ios_base&, int __index); |
| 331 | void register_callback(event_callback __fn, int __index); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 332 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 333 | ios_base(const ios_base&) = delete; |
| 334 | ios_base& operator=(const ios_base&) = delete; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 335 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 336 | static bool sync_with_stdio(bool __sync = true); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 337 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 338 | _LIBCPP_HIDE_FROM_ABI iostate rdstate() const; |
| 339 | void clear(iostate __state = goodbit); |
| 340 | _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 341 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 342 | _LIBCPP_HIDE_FROM_ABI bool good() const; |
| 343 | _LIBCPP_HIDE_FROM_ABI bool eof() const; |
| 344 | _LIBCPP_HIDE_FROM_ABI bool fail() const; |
| 345 | _LIBCPP_HIDE_FROM_ABI bool bad() const; |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 346 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 347 | _LIBCPP_HIDE_FROM_ABI iostate exceptions() const; |
| 348 | _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 349 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 350 | void __set_badbit_and_consider_rethrow(); |
| 351 | void __set_failbit_and_consider_rethrow(); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 352 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 353 | _LIBCPP_HIDE_FROM_ABI void __setstate_nothrow(iostate __state) { |
| 354 | if (__rdbuf_) |
| 355 | __rdstate_ |= __state; |
| 356 | else |
| 357 | __rdstate_ |= __state | ios_base::badbit; |
| 358 | } |
Louis Dionne | 396145d | 2019-04-05 16:33:37 | [diff] [blame] | 359 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 360 | protected: |
Mark de Wever | e0976194 | 2024-03-12 17:04:14 | [diff] [blame] | 361 | _LIBCPP_HIDE_FROM_ABI ios_base() : __loc_(nullptr) { |
| 362 | // Purposefully does no initialization |
| 363 | // |
| 364 | // Except for the locale, this is a sentinel to avoid destroying |
| 365 | // an uninitialized object. See |
| 366 | // test/libcxx/input.output/iostreams.base/ios.base/ios.base.cons/dtor.uninitialized.pass.cpp |
| 367 | // for the details. |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 368 | } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 369 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 370 | void init(void* __sb); |
| 371 | _LIBCPP_HIDE_FROM_ABI void* rdbuf() const { return __rdbuf_; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 372 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 373 | _LIBCPP_HIDE_FROM_ABI void rdbuf(void* __sb) { |
| 374 | __rdbuf_ = __sb; |
| 375 | clear(); |
| 376 | } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 377 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 378 | void __call_callbacks(event); |
| 379 | void copyfmt(const ios_base&); |
| 380 | void move(ios_base&); |
| 381 | void swap(ios_base&) _NOEXCEPT; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 382 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 383 | _LIBCPP_HIDE_FROM_ABI void set_rdbuf(void* __sb) { __rdbuf_ = __sb; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 384 | |
| 385 | private: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 386 | // All data members must be scalars |
| 387 | fmtflags __fmtflags_; |
| 388 | streamsize __precision_; |
| 389 | streamsize __width_; |
| 390 | iostate __rdstate_; |
| 391 | iostate __exceptions_; |
| 392 | void* __rdbuf_; |
| 393 | void* __loc_; |
| 394 | event_callback* __fn_; |
| 395 | int* __index_; |
| 396 | size_t __event_size_; |
| 397 | size_t __event_cap_; |
Eric Fiselier | 749adeb | 2015-08-19 17:21:46 | [diff] [blame] | 398 | // TODO(EricWF): Enable this for both Clang and GCC. Currently it is only |
| 399 | // enabled with clang. |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 400 | # if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS) |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 401 | static atomic<int> __xindex_; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 402 | # else |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 403 | static int __xindex_; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 404 | # endif |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 405 | long* __iarray_; |
| 406 | size_t __iarray_size_; |
| 407 | size_t __iarray_cap_; |
| 408 | void** __parray_; |
| 409 | size_t __parray_size_; |
| 410 | size_t __parray_cap_; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 411 | }; |
| 412 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 413 | // enum class io_errc |
| 414 | _LIBCPP_DECLARE_STRONG_ENUM(io_errc){stream = 1}; |
Howard Hinnant | 75689c1 | 2011-12-02 19:36:40 | [diff] [blame] | 415 | _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc) |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 416 | |
Howard Hinnant | 3030b2f | 2010-09-22 15:29:08 | [diff] [blame] | 417 | template <> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 418 | struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type {}; |
Howard Hinnant | 75689c1 | 2011-12-02 19:36:40 | [diff] [blame] | 419 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 420 | # ifdef _LIBCPP_CXX03_LANG |
Howard Hinnant | 3030b2f | 2010-09-22 15:29:08 | [diff] [blame] | 421 | template <> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 422 | struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type {}; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 423 | # endif |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 424 | |
Nikolas Klauser | f1ea0b1 | 2023-06-14 17:17:50 | [diff] [blame] | 425 | _LIBCPP_EXPORTED_FROM_ABI const error_category& iostream_category() _NOEXCEPT; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 426 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 427 | inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(io_errc __e) _NOEXCEPT { |
| 428 | return error_code(static_cast<int>(__e), iostream_category()); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 429 | } |
| 430 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 431 | inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(io_errc __e) _NOEXCEPT { |
| 432 | return error_condition(static_cast<int>(__e), iostream_category()); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 433 | } |
| 434 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 435 | class _LIBCPP_EXPORTED_FROM_ABI ios_base::failure : public system_error { |
Howard Hinnant | b3371f6 | 2010-08-22 00:02:43 | [diff] [blame] | 436 | public: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 437 | explicit failure(const string& __msg, const error_code& __ec = io_errc::stream); |
| 438 | explicit failure(const char* __msg, const error_code& __ec = io_errc::stream); |
| 439 | _LIBCPP_HIDE_FROM_ABI failure(const failure&) _NOEXCEPT = default; |
| 440 | ~failure() _NOEXCEPT override; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 441 | }; |
| 442 | |
Nikolas Klauser | 748023dc | 2024-09-11 06:59:46 | [diff] [blame^] | 443 | [[__noreturn__]] inline _LIBCPP_HIDE_FROM_ABI void __throw_failure(char const* __msg) { |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 444 | # ifndef _LIBCPP_HAS_NO_EXCEPTIONS |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 445 | throw ios_base::failure(__msg); |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 446 | # else |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 447 | _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg); |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 448 | # endif |
Louis Dionne | 7232a84 | 2019-02-12 16:06:02 | [diff] [blame] | 449 | } |
| 450 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 451 | class _LIBCPP_EXPORTED_FROM_ABI ios_base::Init { |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 452 | public: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 453 | Init(); |
| 454 | ~Init(); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 455 | }; |
| 456 | |
| 457 | // fmtflags |
| 458 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 459 | inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags() const { return __fmtflags_; } |
| 460 | |
| 461 | inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::flags(fmtflags __fmtfl) { |
| 462 | fmtflags __r = __fmtflags_; |
| 463 | __fmtflags_ = __fmtfl; |
| 464 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 465 | } |
| 466 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 467 | inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl) { |
| 468 | fmtflags __r = __fmtflags_; |
| 469 | __fmtflags_ |= __fmtfl; |
| 470 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 471 | } |
| 472 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 473 | inline _LIBCPP_HIDE_FROM_ABI void ios_base::unsetf(fmtflags __mask) { __fmtflags_ &= ~__mask; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 474 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 475 | inline _LIBCPP_HIDE_FROM_ABI ios_base::fmtflags ios_base::setf(fmtflags __fmtfl, fmtflags __mask) { |
| 476 | fmtflags __r = __fmtflags_; |
| 477 | unsetf(__mask); |
| 478 | __fmtflags_ |= __fmtfl & __mask; |
| 479 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | // precision |
| 483 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 484 | inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision() const { return __precision_; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 485 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 486 | inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::precision(streamsize __prec) { |
| 487 | streamsize __r = __precision_; |
| 488 | __precision_ = __prec; |
| 489 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | // width |
| 493 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 494 | inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width() const { return __width_; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 495 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 496 | inline _LIBCPP_HIDE_FROM_ABI streamsize ios_base::width(streamsize __wide) { |
| 497 | streamsize __r = __width_; |
| 498 | __width_ = __wide; |
| 499 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 500 | } |
| 501 | |
| 502 | // iostate |
| 503 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 504 | inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::rdstate() const { return __rdstate_; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 505 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 506 | inline _LIBCPP_HIDE_FROM_ABI void ios_base::setstate(iostate __state) { clear(__rdstate_ | __state); } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 507 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 508 | inline _LIBCPP_HIDE_FROM_ABI bool ios_base::good() const { return __rdstate_ == 0; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 509 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 510 | inline _LIBCPP_HIDE_FROM_ABI bool ios_base::eof() const { return (__rdstate_ & eofbit) != 0; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 511 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 512 | inline _LIBCPP_HIDE_FROM_ABI bool ios_base::fail() const { return (__rdstate_ & (failbit | badbit)) != 0; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 513 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 514 | inline _LIBCPP_HIDE_FROM_ABI bool ios_base::bad() const { return (__rdstate_ & badbit) != 0; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 515 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 516 | inline _LIBCPP_HIDE_FROM_ABI ios_base::iostate ios_base::exceptions() const { return __exceptions_; } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 517 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 518 | inline _LIBCPP_HIDE_FROM_ABI void ios_base::exceptions(iostate __iostate) { |
| 519 | __exceptions_ = __iostate; |
| 520 | clear(__rdstate_); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 521 | } |
| 522 | |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 523 | template <class _Traits> |
| 524 | // Attribute 'packed' is used to keep the layout compatible with the previous |
| 525 | // definition of the '__fill_' and '_set_' pair in basic_ios on AIX & z/OS. |
| 526 | struct _LIBCPP_PACKED _FillHelper { |
| 527 | _LIBCPP_HIDE_FROM_ABI void __init() { __set_ = false; } |
| 528 | _LIBCPP_HIDE_FROM_ABI _FillHelper& operator=(typename _Traits::int_type __x) { |
| 529 | __set_ = true; |
| 530 | __fill_val_ = __x; |
| 531 | return *this; |
| 532 | } |
| 533 | _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __set_; } |
| 534 | _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; } |
| 535 | |
| 536 | private: |
| 537 | typename _Traits::int_type __fill_val_; |
| 538 | bool __set_; |
| 539 | }; |
| 540 | |
| 541 | template <class _Traits> |
| 542 | struct _LIBCPP_PACKED _SentinelValueFill { |
| 543 | _LIBCPP_HIDE_FROM_ABI void __init() { __fill_val_ = _Traits::eof(); } |
| 544 | _LIBCPP_HIDE_FROM_ABI _SentinelValueFill& operator=(typename _Traits::int_type __x) { |
| 545 | __fill_val_ = __x; |
| 546 | return *this; |
| 547 | } |
| 548 | _LIBCPP_HIDE_FROM_ABI bool __is_set() const { return __fill_val_ != _Traits::eof(); } |
| 549 | _LIBCPP_HIDE_FROM_ABI typename _Traits::int_type __get() const { return __fill_val_; } |
| 550 | |
| 551 | private: |
| 552 | typename _Traits::int_type __fill_val_; |
| 553 | }; |
| 554 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 555 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 556 | class _LIBCPP_TEMPLATE_VIS basic_ios : public ios_base { |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 557 | public: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 558 | // types: |
| 559 | typedef _CharT char_type; |
| 560 | typedef _Traits traits_type; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 561 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 562 | typedef typename traits_type::int_type int_type; |
| 563 | typedef typename traits_type::pos_type pos_type; |
| 564 | typedef typename traits_type::off_type off_type; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 565 | |
Nikolas Klauser | 6b4b29f | 2024-06-18 08:45:30 | [diff] [blame] | 566 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 567 | "traits_type::char_type must be the same type as CharT"); |
Marshall Clow | 1a6493b | 2018-02-01 03:55:27 | [diff] [blame] | 568 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 569 | # ifdef _LIBCPP_CXX03_LANG |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 570 | // Preserve the ability to compare with literal 0, |
| 571 | // and implicitly convert to bool, but not implicitly convert to int. |
| 572 | _LIBCPP_HIDE_FROM_ABI operator void*() const { return fail() ? nullptr : (void*)this; } |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 573 | # else |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 574 | _LIBCPP_HIDE_FROM_ABI explicit operator bool() const { return !fail(); } |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 575 | # endif |
Eric Fiselier | 1b06dfe | 2016-12-30 14:05:52 | [diff] [blame] | 576 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 577 | _LIBCPP_HIDE_FROM_ABI bool operator!() const { return fail(); } |
| 578 | _LIBCPP_HIDE_FROM_ABI iostate rdstate() const { return ios_base::rdstate(); } |
| 579 | _LIBCPP_HIDE_FROM_ABI void clear(iostate __state = goodbit) { ios_base::clear(__state); } |
| 580 | _LIBCPP_HIDE_FROM_ABI void setstate(iostate __state) { ios_base::setstate(__state); } |
| 581 | _LIBCPP_HIDE_FROM_ABI bool good() const { return ios_base::good(); } |
| 582 | _LIBCPP_HIDE_FROM_ABI bool eof() const { return ios_base::eof(); } |
| 583 | _LIBCPP_HIDE_FROM_ABI bool fail() const { return ios_base::fail(); } |
| 584 | _LIBCPP_HIDE_FROM_ABI bool bad() const { return ios_base::bad(); } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 585 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 586 | _LIBCPP_HIDE_FROM_ABI iostate exceptions() const { return ios_base::exceptions(); } |
| 587 | _LIBCPP_HIDE_FROM_ABI void exceptions(iostate __iostate) { ios_base::exceptions(__iostate); } |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 588 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 589 | // 27.5.4.1 Constructor/destructor: |
| 590 | _LIBCPP_HIDE_FROM_ABI explicit basic_ios(basic_streambuf<char_type, traits_type>* __sb); |
| 591 | ~basic_ios() override; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 592 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 593 | // 27.5.4.2 Members: |
| 594 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie() const; |
| 595 | _LIBCPP_HIDE_FROM_ABI basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 596 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 597 | _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf() const; |
| 598 | _LIBCPP_HIDE_FROM_ABI basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 599 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 600 | basic_ios& copyfmt(const basic_ios& __rhs); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 601 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 602 | _LIBCPP_HIDE_FROM_ABI char_type fill() const; |
| 603 | _LIBCPP_HIDE_FROM_ABI char_type fill(char_type __ch); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 604 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 605 | _LIBCPP_HIDE_FROM_ABI locale imbue(const locale& __loc); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 606 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 607 | _LIBCPP_HIDE_FROM_ABI char narrow(char_type __c, char __dfault) const; |
| 608 | _LIBCPP_HIDE_FROM_ABI char_type widen(char __c) const; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 609 | |
| 610 | protected: |
Mark de Wever | e0976194 | 2024-03-12 17:04:14 | [diff] [blame] | 611 | _LIBCPP_HIDE_FROM_ABI basic_ios() { |
| 612 | // purposefully does no initialization |
| 613 | // since the destructor does nothing this does not have ios_base issues. |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 614 | } |
| 615 | _LIBCPP_HIDE_FROM_ABI void init(basic_streambuf<char_type, traits_type>* __sb); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 616 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 617 | _LIBCPP_HIDE_FROM_ABI void move(basic_ios& __rhs); |
| 618 | _LIBCPP_HIDE_FROM_ABI void move(basic_ios&& __rhs) { move(__rhs); } |
| 619 | _LIBCPP_HIDE_FROM_ABI void swap(basic_ios& __rhs) _NOEXCEPT; |
| 620 | _LIBCPP_HIDE_FROM_ABI void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb); |
| 621 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 622 | private: |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 623 | basic_ostream<char_type, traits_type>* __tie_; |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 624 | |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 625 | # if defined(_LIBCPP_ABI_IOS_ALLOW_ARBITRARY_FILL_VALUE) |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 626 | using _FillType = _FillHelper<traits_type>; |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 627 | # else |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 628 | using _FillType = _SentinelValueFill<traits_type>; |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 629 | # endif |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 630 | mutable _FillType __fill_; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 631 | }; |
| 632 | |
| 633 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 634 | inline _LIBCPP_HIDE_FROM_ABI basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type, traits_type>* __sb) { |
| 635 | init(__sb); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 639 | basic_ios<_CharT, _Traits>::~basic_ios() {} |
| 640 | |
| 641 | template <class _CharT, class _Traits> |
| 642 | inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb) { |
| 643 | ios_base::init(__sb); |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 644 | __tie_ = nullptr; |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 645 | __fill_.__init(); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 649 | inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* basic_ios<_CharT, _Traits>::tie() const { |
| 650 | return __tie_; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 651 | } |
| 652 | |
| 653 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 654 | inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>* |
| 655 | basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr) { |
| 656 | basic_ostream<char_type, traits_type>* __r = __tie_; |
| 657 | __tie_ = __tiestr; |
| 658 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 659 | } |
| 660 | |
| 661 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 662 | inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* basic_ios<_CharT, _Traits>::rdbuf() const { |
| 663 | return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf()); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 664 | } |
| 665 | |
| 666 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 667 | inline _LIBCPP_HIDE_FROM_ABI basic_streambuf<_CharT, _Traits>* |
| 668 | basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb) { |
| 669 | basic_streambuf<char_type, traits_type>* __r = rdbuf(); |
| 670 | ios_base::rdbuf(__sb); |
| 671 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 675 | inline _LIBCPP_HIDE_FROM_ABI locale basic_ios<_CharT, _Traits>::imbue(const locale& __loc) { |
| 676 | locale __r = getloc(); |
| 677 | ios_base::imbue(__loc); |
| 678 | if (rdbuf()) |
| 679 | rdbuf()->pubimbue(__loc); |
| 680 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 681 | } |
| 682 | |
| 683 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 684 | inline _LIBCPP_HIDE_FROM_ABI char basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const { |
| 685 | return std::use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 686 | } |
| 687 | |
| 688 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 689 | inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::widen(char __c) const { |
| 690 | return std::use_facet<ctype<char_type> >(getloc()).widen(__c); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 694 | inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill() const { |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 695 | if (!__fill_.__is_set()) |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 696 | __fill_ = widen(' '); |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 697 | return __fill_.__get(); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 701 | inline _LIBCPP_HIDE_FROM_ABI _CharT basic_ios<_CharT, _Traits>::fill(char_type __ch) { |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 702 | if (!__fill_.__is_set()) |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 703 | __fill_ = widen(' '); |
Xing Xue | 194f98c | 2024-07-17 18:47:13 | [diff] [blame] | 704 | char_type __r = __fill_.__get(); |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 705 | __fill_ = __ch; |
| 706 | return __r; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 707 | } |
| 708 | |
| 709 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 710 | basic_ios<_CharT, _Traits>& basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs) { |
Mark de Wever | 4dee641 | 2024-08-06 17:47:56 | [diff] [blame] | 711 | if (this != std::addressof(__rhs)) { |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 712 | __call_callbacks(erase_event); |
| 713 | ios_base::copyfmt(__rhs); |
| 714 | __tie_ = __rhs.__tie_; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 715 | __fill_ = __rhs.__fill_; |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 716 | __call_callbacks(copyfmt_event); |
| 717 | exceptions(__rhs.exceptions()); |
| 718 | } |
| 719 | return *this; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 720 | } |
| 721 | |
| 722 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 723 | inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::move(basic_ios& __rhs) { |
| 724 | ios_base::move(__rhs); |
| 725 | __tie_ = __rhs.__tie_; |
| 726 | __rhs.__tie_ = nullptr; |
| 727 | __fill_ = __rhs.__fill_; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 728 | } |
| 729 | |
| 730 | template <class _CharT, class _Traits> |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 731 | inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT { |
| 732 | ios_base::swap(__rhs); |
| 733 | std::swap(__tie_, __rhs.__tie_); |
| 734 | std::swap(__fill_, __rhs.__fill_); |
| 735 | } |
| 736 | |
| 737 | template <class _CharT, class _Traits> |
| 738 | inline _LIBCPP_HIDE_FROM_ABI void basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb) { |
| 739 | ios_base::set_rdbuf(__sb); |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 740 | } |
| 741 | |
Nikolas Klauser | 9334a85 | 2023-05-23 15:58:14 | [diff] [blame] | 742 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>; |
| 743 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 744 | # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS |
Nikolas Klauser | 9334a85 | 2023-05-23 15:58:14 | [diff] [blame] | 745 | extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>; |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 746 | # endif |
Nikolas Klauser | 9334a85 | 2023-05-23 15:58:14 | [diff] [blame] | 747 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 748 | _LIBCPP_HIDE_FROM_ABI inline ios_base& boolalpha(ios_base& __str) { |
| 749 | __str.setf(ios_base::boolalpha); |
| 750 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 751 | } |
| 752 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 753 | _LIBCPP_HIDE_FROM_ABI inline ios_base& noboolalpha(ios_base& __str) { |
| 754 | __str.unsetf(ios_base::boolalpha); |
| 755 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 756 | } |
| 757 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 758 | _LIBCPP_HIDE_FROM_ABI inline ios_base& showbase(ios_base& __str) { |
| 759 | __str.setf(ios_base::showbase); |
| 760 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 761 | } |
| 762 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 763 | _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowbase(ios_base& __str) { |
| 764 | __str.unsetf(ios_base::showbase); |
| 765 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 766 | } |
| 767 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 768 | _LIBCPP_HIDE_FROM_ABI inline ios_base& showpoint(ios_base& __str) { |
| 769 | __str.setf(ios_base::showpoint); |
| 770 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 771 | } |
| 772 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 773 | _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpoint(ios_base& __str) { |
| 774 | __str.unsetf(ios_base::showpoint); |
| 775 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 776 | } |
| 777 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 778 | _LIBCPP_HIDE_FROM_ABI inline ios_base& showpos(ios_base& __str) { |
| 779 | __str.setf(ios_base::showpos); |
| 780 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 781 | } |
| 782 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 783 | _LIBCPP_HIDE_FROM_ABI inline ios_base& noshowpos(ios_base& __str) { |
| 784 | __str.unsetf(ios_base::showpos); |
| 785 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 786 | } |
| 787 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 788 | _LIBCPP_HIDE_FROM_ABI inline ios_base& skipws(ios_base& __str) { |
| 789 | __str.setf(ios_base::skipws); |
| 790 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 791 | } |
| 792 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 793 | _LIBCPP_HIDE_FROM_ABI inline ios_base& noskipws(ios_base& __str) { |
| 794 | __str.unsetf(ios_base::skipws); |
| 795 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 796 | } |
| 797 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 798 | _LIBCPP_HIDE_FROM_ABI inline ios_base& uppercase(ios_base& __str) { |
| 799 | __str.setf(ios_base::uppercase); |
| 800 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 801 | } |
| 802 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 803 | _LIBCPP_HIDE_FROM_ABI inline ios_base& nouppercase(ios_base& __str) { |
| 804 | __str.unsetf(ios_base::uppercase); |
| 805 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 806 | } |
| 807 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 808 | _LIBCPP_HIDE_FROM_ABI inline ios_base& unitbuf(ios_base& __str) { |
| 809 | __str.setf(ios_base::unitbuf); |
| 810 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 811 | } |
| 812 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 813 | _LIBCPP_HIDE_FROM_ABI inline ios_base& nounitbuf(ios_base& __str) { |
| 814 | __str.unsetf(ios_base::unitbuf); |
| 815 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 816 | } |
| 817 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 818 | _LIBCPP_HIDE_FROM_ABI inline ios_base& internal(ios_base& __str) { |
| 819 | __str.setf(ios_base::internal, ios_base::adjustfield); |
| 820 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 821 | } |
| 822 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 823 | _LIBCPP_HIDE_FROM_ABI inline ios_base& left(ios_base& __str) { |
| 824 | __str.setf(ios_base::left, ios_base::adjustfield); |
| 825 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 826 | } |
| 827 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 828 | _LIBCPP_HIDE_FROM_ABI inline ios_base& right(ios_base& __str) { |
| 829 | __str.setf(ios_base::right, ios_base::adjustfield); |
| 830 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 831 | } |
| 832 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 833 | _LIBCPP_HIDE_FROM_ABI inline ios_base& dec(ios_base& __str) { |
| 834 | __str.setf(ios_base::dec, ios_base::basefield); |
| 835 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 836 | } |
| 837 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 838 | _LIBCPP_HIDE_FROM_ABI inline ios_base& hex(ios_base& __str) { |
| 839 | __str.setf(ios_base::hex, ios_base::basefield); |
| 840 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 841 | } |
| 842 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 843 | _LIBCPP_HIDE_FROM_ABI inline ios_base& oct(ios_base& __str) { |
| 844 | __str.setf(ios_base::oct, ios_base::basefield); |
| 845 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 846 | } |
| 847 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 848 | _LIBCPP_HIDE_FROM_ABI inline ios_base& fixed(ios_base& __str) { |
| 849 | __str.setf(ios_base::fixed, ios_base::floatfield); |
| 850 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 851 | } |
| 852 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 853 | _LIBCPP_HIDE_FROM_ABI inline ios_base& scientific(ios_base& __str) { |
| 854 | __str.setf(ios_base::scientific, ios_base::floatfield); |
| 855 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 856 | } |
| 857 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 858 | _LIBCPP_HIDE_FROM_ABI inline ios_base& hexfloat(ios_base& __str) { |
| 859 | __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); |
| 860 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 861 | } |
| 862 | |
Louis Dionne | 9783f28 | 2023-12-18 19:01:33 | [diff] [blame] | 863 | _LIBCPP_HIDE_FROM_ABI inline ios_base& defaultfloat(ios_base& __str) { |
| 864 | __str.unsetf(ios_base::floatfield); |
| 865 | return __str; |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 866 | } |
| 867 | |
Howard Hinnant | 3e51952 | 2010-05-11 19:42:16 | [diff] [blame] | 868 | _LIBCPP_END_NAMESPACE_STD |
| 869 | |
Louis Dionne | 7b46225 | 2024-01-25 20:48:46 | [diff] [blame] | 870 | _LIBCPP_POP_MACROS |
| 871 | |
Louis Dionne | ef51e61 | 2024-07-15 14:11:23 | [diff] [blame] | 872 | #endif // !defined(_LIBCPP_HAS_NO_LOCALIZATION) |
| 873 | |
Nikolas Klauser | 89b356f | 2022-11-02 19:27:42 | [diff] [blame] | 874 | #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 |
Nikolas Klauser | 70617a1a2 | 2023-01-31 18:23:30 | [diff] [blame] | 875 | # include <atomic> |
Nikolas Klauser | 89b356f | 2022-11-02 19:27:42 | [diff] [blame] | 876 | # include <concepts> |
Nikolas Klauser | 59ef4b3 | 2022-09-22 19:53:13 | [diff] [blame] | 877 | # include <cstddef> |
| 878 | # include <cstdlib> |
| 879 | # include <cstring> |
| 880 | # include <initializer_list> |
| 881 | # include <limits> |
Louis Dionne | c01794e | 2023-07-17 16:42:00 | [diff] [blame] | 882 | # include <mutex> |
Nikolas Klauser | 59ef4b3 | 2022-09-22 19:53:13 | [diff] [blame] | 883 | # include <new> |
| 884 | # include <stdexcept> |
Mark de Wever | e8cfbfd | 2023-04-08 15:29:31 | [diff] [blame] | 885 | # include <system_error> |
Nikolas Klauser | 59ef4b3 | 2022-09-22 19:53:13 | [diff] [blame] | 886 | # include <type_traits> |
| 887 | # include <typeinfo> |
Nikolas Klauser | 89b356f | 2022-11-02 19:27:42 | [diff] [blame] | 888 | #endif |
| 889 | |
Louis Dionne | 4cd6ca1 | 2021-04-20 16:03:32 | [diff] [blame] | 890 | #endif // _LIBCPP_IOS |