| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
#ifndef _IOS_BASE_H |
| 35 |
#define _IOS_BASE_H 1 |
| 36 |
|
| 37 |
#ifdef _GLIBCXX_SYSHDR |
| 38 |
#pragma GCC system_header |
| 39 |
#endif |
| 40 |
|
| 41 |
#include <ext/atomicity.h> |
| 42 |
#include <bits/localefwd.h> |
| 43 |
#include <bits/locale_classes.h> |
| 44 |
|
| 45 |
#if __cplusplus < 201103L |
| 46 |
# include <stdexcept> |
| 47 |
#else |
| 48 |
# include <system_error> |
| 49 |
#endif |
| 50 |
|
| 51 |
namespace std _GLIBCXX_VISIBILITY(default) |
| 52 |
{ |
| 53 |
_GLIBCXX_BEGIN_NAMESPACE_VERSION |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
enum _Ios_Fmtflags |
| 60 |
{ |
| 61 |
_S_boolalpha = 1L << 0, |
| 62 |
_S_dec = 1L << 1, |
| 63 |
_S_fixed = 1L << 2, |
| 64 |
_S_hex = 1L << 3, |
| 65 |
_S_internal = 1L << 4, |
| 66 |
_S_left = 1L << 5, |
| 67 |
_S_oct = 1L << 6, |
| 68 |
_S_right = 1L << 7, |
| 69 |
_S_scientific = 1L << 8, |
| 70 |
_S_showbase = 1L << 9, |
| 71 |
_S_showpoint = 1L << 10, |
| 72 |
_S_showpos = 1L << 11, |
| 73 |
_S_skipws = 1L << 12, |
| 74 |
_S_unitbuf = 1L << 13, |
| 75 |
_S_uppercase = 1L << 14, |
| 76 |
_S_adjustfield = _S_left | _S_right | _S_internal, |
| 77 |
_S_basefield = _S_dec | _S_oct | _S_hex, |
| 78 |
_S_floatfield = _S_scientific | _S_fixed, |
| 79 |
_S_ios_fmtflags_end = 1L << 16, |
| 80 |
_S_ios_fmtflags_max = __INT_MAX__, |
| 81 |
_S_ios_fmtflags_min = ~__INT_MAX__ |
| 82 |
}; |
| 83 |
|
| 84 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 85 |
inline _Ios_Fmtflags |
| 86 |
operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 87 |
{ return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); } |
| 88 |
|
| 89 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 90 |
inline _Ios_Fmtflags |
| 91 |
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 92 |
{ return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); } |
| 93 |
|
| 94 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 95 |
inline _Ios_Fmtflags |
| 96 |
operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 97 |
{ return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
| 98 |
|
| 99 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 100 |
inline _Ios_Fmtflags |
| 101 |
operator~(_Ios_Fmtflags __a) _GLIBCXX_NOTHROW |
| 102 |
{ return _Ios_Fmtflags(~static_cast<int>(__a)); } |
| 103 |
|
| 104 |
_GLIBCXX14_CONSTEXPR |
| 105 |
inline const _Ios_Fmtflags& |
| 106 |
operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 107 |
{ return __a = __a | __b; } |
| 108 |
|
| 109 |
_GLIBCXX14_CONSTEXPR |
| 110 |
inline const _Ios_Fmtflags& |
| 111 |
operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 112 |
{ return __a = __a & __b; } |
| 113 |
|
| 114 |
_GLIBCXX14_CONSTEXPR |
| 115 |
inline const _Ios_Fmtflags& |
| 116 |
operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW |
| 117 |
{ return __a = __a ^ __b; } |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
#ifdef __glibcxx_ios_noreplace |
| 122 |
#define _NOREPLACE_UNUSED |
| 123 |
#else |
| 124 |
#define _NOREPLACE_UNUSED __attribute__((__unused__)) |
| 125 |
#endif |
| 126 |
|
| 127 |
enum __attribute__((__flag_enum__)) _Ios_Openmode |
| 128 |
{ |
| 129 |
_S_app = 1L << 0, |
| 130 |
_S_ate = 1L << 1, |
| 131 |
_S_bin = 1L << 2, |
| 132 |
_S_in = 1L << 3, |
| 133 |
_S_out = 1L << 4, |
| 134 |
_S_trunc = 1L << 5, |
| 135 |
_S_noreplace _NOREPLACE_UNUSED = 1L << 6, |
| 136 |
_S_ios_openmode_end __attribute__((__unused__)) = 1L << 16, |
| 137 |
_S_ios_openmode_max __attribute__((__unused__)) = __INT_MAX__, |
| 138 |
_S_ios_openmode_min __attribute__((__unused__)) = ~__INT_MAX__ |
| 139 |
}; |
| 140 |
|
| 141 |
#undef _NOREPLACE_UNUSED |
| 142 |
|
| 143 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 144 |
inline _Ios_Openmode |
| 145 |
operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 146 |
{ return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); } |
| 147 |
|
| 148 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 149 |
inline _Ios_Openmode |
| 150 |
operator|(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 151 |
{ return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); } |
| 152 |
|
| 153 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 154 |
inline _Ios_Openmode |
| 155 |
operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 156 |
{ return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
| 157 |
|
| 158 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 159 |
inline _Ios_Openmode |
| 160 |
operator~(_Ios_Openmode __a) _GLIBCXX_NOTHROW |
| 161 |
{ return _Ios_Openmode(~static_cast<int>(__a)); } |
| 162 |
|
| 163 |
_GLIBCXX14_CONSTEXPR |
| 164 |
inline const _Ios_Openmode& |
| 165 |
operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 166 |
{ return __a = __a | __b; } |
| 167 |
|
| 168 |
_GLIBCXX14_CONSTEXPR |
| 169 |
inline const _Ios_Openmode& |
| 170 |
operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 171 |
{ return __a = __a & __b; } |
| 172 |
|
| 173 |
_GLIBCXX14_CONSTEXPR |
| 174 |
inline const _Ios_Openmode& |
| 175 |
operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW |
| 176 |
{ return __a = __a ^ __b; } |
| 177 |
|
| 178 |
|
| 179 |
enum _Ios_Iostate |
| 180 |
{ |
| 181 |
_S_goodbit = 0, |
| 182 |
_S_badbit = 1L << 0, |
| 183 |
_S_eofbit = 1L << 1, |
| 184 |
_S_failbit = 1L << 2, |
| 185 |
_S_ios_iostate_end = 1L << 16, |
| 186 |
_S_ios_iostate_max = __INT_MAX__, |
| 187 |
_S_ios_iostate_min = ~__INT_MAX__ |
| 188 |
}; |
| 189 |
|
| 190 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 191 |
inline _Ios_Iostate |
| 192 |
operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 193 |
{ return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); } |
| 194 |
|
| 195 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 196 |
inline _Ios_Iostate |
| 197 |
operator|(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 198 |
{ return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); } |
| 199 |
|
| 200 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 201 |
inline _Ios_Iostate |
| 202 |
operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 203 |
{ return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); } |
| 204 |
|
| 205 |
_GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR |
| 206 |
inline _Ios_Iostate |
| 207 |
operator~(_Ios_Iostate __a) _GLIBCXX_NOTHROW |
| 208 |
{ return _Ios_Iostate(~static_cast<int>(__a)); } |
| 209 |
|
| 210 |
_GLIBCXX14_CONSTEXPR |
| 211 |
inline const _Ios_Iostate& |
| 212 |
operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 213 |
{ return __a = __a | __b; } |
| 214 |
|
| 215 |
_GLIBCXX14_CONSTEXPR |
| 216 |
inline const _Ios_Iostate& |
| 217 |
operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 218 |
{ return __a = __a & __b; } |
| 219 |
|
| 220 |
_GLIBCXX14_CONSTEXPR |
| 221 |
inline const _Ios_Iostate& |
| 222 |
operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW |
| 223 |
{ return __a = __a ^ __b; } |
| 224 |
|
| 225 |
|
| 226 |
enum _Ios_Seekdir |
| 227 |
{ |
| 228 |
_S_beg = 0, |
| 229 |
_S_cur = _GLIBCXX_STDIO_SEEK_CUR, |
| 230 |
_S_end = _GLIBCXX_STDIO_SEEK_END, |
| 231 |
_S_ios_seekdir_end = 1L << 16 |
| 232 |
}; |
| 233 |
|
| 234 |
#if __cplusplus >= 201103L |
| 235 |
|
| 236 |
enum class io_errc { stream = 1 }; |
| 237 |
|
| 238 |
template <> struct is_error_code_enum<io_errc> : public true_type { }; |
| 239 |
|
| 240 |
[[__nodiscard__, __gnu__::__const__]] |
| 241 |
const error_category& |
| 242 |
iostream_category() noexcept; |
| 243 |
|
| 244 |
[[__nodiscard__]] |
| 245 |
inline error_code |
| 246 |
make_error_code(io_errc __e) noexcept |
| 247 |
{ return error_code(static_cast<int>(__e), iostream_category()); } |
| 248 |
|
| 249 |
[[__nodiscard__]] |
| 250 |
inline error_condition |
| 251 |
make_error_condition(io_errc __e) noexcept |
| 252 |
{ return error_condition(static_cast<int>(__e), iostream_category()); } |
| 253 |
#endif |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
|
| 264 |
|
| 265 |
class ios_base |
| 266 |
{ |
| 267 |
#if _GLIBCXX_USE_CXX11_ABI |
| 268 |
#if __cplusplus < 201103L |
| 269 |
|
| 270 |
struct system_error : std::runtime_error |
| 271 |
{ |
| 272 |
|
| 273 |
struct error_code |
| 274 |
{ |
| 275 |
error_code() { } |
| 276 |
private: |
| 277 |
int _M_value; |
| 278 |
const void* _M_cat; |
| 279 |
} _M_code; |
| 280 |
}; |
| 281 |
#endif |
| 282 |
#endif |
| 283 |
public: |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
#if _GLIBCXX_USE_CXX11_ABI |
| 292 |
class _GLIBCXX_ABI_TAG_CXX11 failure : public system_error |
| 293 |
{ |
| 294 |
public: |
| 295 |
explicit |
| 296 |
failure(const string& __str); |
| 297 |
|
| 298 |
#if __cplusplus >= 201103L |
| 299 |
explicit |
| 300 |
failure(const string&, const error_code&); |
| 301 |
|
| 302 |
explicit |
| 303 |
failure(const char*, const error_code& = io_errc::stream); |
| 304 |
#endif |
| 305 |
|
| 306 |
virtual |
| 307 |
~failure() throw(); |
| 308 |
|
| 309 |
virtual const char* |
| 310 |
what() const throw(); |
| 311 |
}; |
| 312 |
#else |
| 313 |
class failure : public exception |
| 314 |
{ |
| 315 |
public: |
| 316 |
|
| 317 |
|
| 318 |
explicit |
| 319 |
failure(const string& __str) throw(); |
| 320 |
|
| 321 |
|
| 322 |
|
| 323 |
virtual |
| 324 |
~failure() throw(); |
| 325 |
|
| 326 |
virtual const char* |
| 327 |
what() const throw(); |
| 328 |
|
| 329 |
#if __cplusplus >= 201103L |
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
explicit |
| 334 |
failure(const string& __s, const error_code&) noexcept |
| 335 |
: failure(__s) |
| 336 |
{ } |
| 337 |
|
| 338 |
explicit |
| 339 |
failure(const char* __s, const error_code& = error_code{}) |
| 340 |
: failure(string(__s)) |
| 341 |
{ } |
| 342 |
|
| 343 |
|
| 344 |
error_code code() const noexcept { return error_code{}; } |
| 345 |
#endif |
| 346 |
|
| 347 |
private: |
| 348 |
string _M_msg; |
| 349 |
}; |
| 350 |
#endif |
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
typedef _Ios_Fmtflags fmtflags; |
| 379 |
|
| 380 |
|
| 381 |
static const fmtflags boolalpha = _S_boolalpha; |
| 382 |
|
| 383 |
|
| 384 |
static const fmtflags dec = _S_dec; |
| 385 |
|
| 386 |
|
| 387 |
static const fmtflags fixed = _S_fixed; |
| 388 |
|
| 389 |
|
| 390 |
static const fmtflags hex = _S_hex; |
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
static const fmtflags internal = _S_internal; |
| 396 |
|
| 397 |
|
| 398 |
|
| 399 |
static const fmtflags left = _S_left; |
| 400 |
|
| 401 |
|
| 402 |
static const fmtflags oct = _S_oct; |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
static const fmtflags right = _S_right; |
| 407 |
|
| 408 |
|
| 409 |
static const fmtflags scientific = _S_scientific; |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
static const fmtflags showbase = _S_showbase; |
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
static const fmtflags showpoint = _S_showpoint; |
| 418 |
|
| 419 |
|
| 420 |
static const fmtflags showpos = _S_showpos; |
| 421 |
|
| 422 |
|
| 423 |
static const fmtflags skipws = _S_skipws; |
| 424 |
|
| 425 |
|
| 426 |
static const fmtflags unitbuf = _S_unitbuf; |
| 427 |
|
| 428 |
|
| 429 |
|
| 430 |
static const fmtflags uppercase = _S_uppercase; |
| 431 |
|
| 432 |
|
| 433 |
static const fmtflags adjustfield = _S_adjustfield; |
| 434 |
|
| 435 |
|
| 436 |
static const fmtflags basefield = _S_basefield; |
| 437 |
|
| 438 |
|
| 439 |
static const fmtflags floatfield = _S_floatfield; |
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
typedef _Ios_Iostate iostate; |
| 454 |
|
| 455 |
|
| 456 |
|
| 457 |
static const iostate badbit = _S_badbit; |
| 458 |
|
| 459 |
|
| 460 |
static const iostate eofbit = _S_eofbit; |
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
static const iostate failbit = _S_failbit; |
| 466 |
|
| 467 |
|
| 468 |
static const iostate goodbit = _S_goodbit; |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
typedef _Ios_Openmode openmode; |
| 485 |
|
| 486 |
|
| 487 |
static const openmode app = _S_app; |
| 488 |
|
| 489 |
|
| 490 |
static const openmode ate = _S_ate; |
| 491 |
|
| 492 |
|
| 493 |
|
| 494 |
|
| 495 |
static const openmode binary = _S_bin; |
| 496 |
|
| 497 |
|
| 498 |
static const openmode in = _S_in; |
| 499 |
|
| 500 |
|
| 501 |
static const openmode out = _S_out; |
| 502 |
|
| 503 |
|
| 504 |
static const openmode trunc = _S_trunc; |
| 505 |
|
| 506 |
static const openmode __noreplace = _S_noreplace; |
| 507 |
|
| 508 |
#ifdef __glibcxx_ios_noreplace |
| 509 |
|
| 510 |
static const openmode noreplace = _S_noreplace; |
| 511 |
#endif |
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 522 |
|
| 523 |
typedef _Ios_Seekdir seekdir; |
| 524 |
|
| 525 |
|
| 526 |
static const seekdir beg = _S_beg; |
| 527 |
|
| 528 |
|
| 529 |
static const seekdir cur = _S_cur; |
| 530 |
|
| 531 |
|
| 532 |
static const seekdir end = _S_end; |
| 533 |
|
| 534 |
#if __cplusplus <= 201402L |
| 535 |
|
| 536 |
typedef int io_state |
| 537 |
_GLIBCXX_DEPRECATED_SUGGEST("std::iostate"); |
| 538 |
typedef int open_mode |
| 539 |
_GLIBCXX_DEPRECATED_SUGGEST("std::openmode"); |
| 540 |
typedef int seek_dir |
| 541 |
_GLIBCXX_DEPRECATED_SUGGEST("std::seekdir"); |
| 542 |
|
| 543 |
typedef std::streampos streampos |
| 544 |
_GLIBCXX_DEPRECATED_SUGGEST("std::streampos"); |
| 545 |
typedef std::streamoff streamoff |
| 546 |
_GLIBCXX_DEPRECATED_SUGGEST("std::streamoff"); |
| 547 |
#endif |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
enum event |
| 557 |
{ |
| 558 |
erase_event, |
| 559 |
imbue_event, |
| 560 |
copyfmt_event |
| 561 |
}; |
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
typedef void (*event_callback) (event __e, ios_base& __b, int __i); |
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
void |
| 586 |
register_callback(event_callback __fn, int __index); |
| 587 |
|
| 588 |
protected: |
| 589 |
streamsize _M_precision; |
| 590 |
streamsize _M_width; |
| 591 |
fmtflags _M_flags; |
| 592 |
iostate _M_exception; |
| 593 |
iostate _M_streambuf_state; |
| 594 |
|
| 595 |
|
| 596 |
|
| 597 |
struct _Callback_list |
| 598 |
{ |
| 599 |
|
| 600 |
_Callback_list* _M_next; |
| 601 |
ios_base::event_callback _M_fn; |
| 602 |
int _M_index; |
| 603 |
_Atomic_word _M_refcount; |
| 604 |
|
| 605 |
_Callback_list(ios_base::event_callback __fn, int __index, |
| 606 |
_Callback_list* __cb) |
| 607 |
: _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { } |
| 608 |
|
| 609 |
void |
| 610 |
_M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); } |
| 611 |
|
| 612 |
|
| 613 |
int |
| 614 |
_M_remove_reference() |
| 615 |
{ |
| 616 |
|
| 617 |
_GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount); |
| 618 |
int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); |
| 619 |
if (__res == 0) |
| 620 |
{ |
| 621 |
_GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount); |
| 622 |
} |
| 623 |
return __res; |
| 624 |
} |
| 625 |
}; |
| 626 |
|
| 627 |
_Callback_list* _M_callbacks; |
| 628 |
|
| 629 |
void |
| 630 |
_M_call_callbacks(event __ev) throw(); |
| 631 |
|
| 632 |
void |
| 633 |
_M_dispose_callbacks(void) throw(); |
| 634 |
|
| 635 |
|
| 636 |
struct _Words |
| 637 |
{ |
| 638 |
void* _M_pword; |
| 639 |
long _M_iword; |
| 640 |
_Words() : _M_pword(0), _M_iword(0) { } |
| 641 |
}; |
| 642 |
|
| 643 |
|
| 644 |
_Words _M_word_zero; |
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
enum { _S_local_word_size = 8 }; |
| 649 |
_Words _M_local_word[_S_local_word_size]; |
| 650 |
|
| 651 |
|
| 652 |
int _M_word_size; |
| 653 |
_Words* _M_word; |
| 654 |
|
| 655 |
_Words& |
| 656 |
_M_grow_words(int __index, bool __iword); |
| 657 |
|
| 658 |
|
| 659 |
locale _M_ios_locale; |
| 660 |
|
| 661 |
void |
| 662 |
_M_init() throw(); |
| 663 |
|
| 664 |
public: |
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
class Init |
| 671 |
{ |
| 672 |
friend class ios_base; |
| 673 |
public: |
| 674 |
Init(); |
| 675 |
~Init(); |
| 676 |
|
| 677 |
#if __cplusplus >= 201103L |
| 678 |
Init(const Init&) = default; |
| 679 |
Init& operator=(const Init&) = default; |
| 680 |
#endif |
| 681 |
|
| 682 |
private: |
| 683 |
static _Atomic_word _S_refcount; |
| 684 |
static bool _S_synced_with_stdio; |
| 685 |
}; |
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
|
| 692 |
_GLIBCXX_NODISCARD |
| 693 |
fmtflags |
| 694 |
flags() const |
| 695 |
{ return _M_flags; } |
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
|
| 700 |
|
| 701 |
|
| 702 |
|
| 703 |
|
| 704 |
fmtflags |
| 705 |
flags(fmtflags __fmtfl) |
| 706 |
{ |
| 707 |
fmtflags __old = _M_flags; |
| 708 |
_M_flags = __fmtfl; |
| 709 |
return __old; |
| 710 |
} |
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
|
| 716 |
|
| 717 |
|
| 718 |
|
| 719 |
|
| 720 |
fmtflags |
| 721 |
setf(fmtflags __fmtfl) |
| 722 |
{ |
| 723 |
fmtflags __old = _M_flags; |
| 724 |
_M_flags |= __fmtfl; |
| 725 |
return __old; |
| 726 |
} |
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
fmtflags |
| 738 |
setf(fmtflags __fmtfl, fmtflags __mask) |
| 739 |
{ |
| 740 |
fmtflags __old = _M_flags; |
| 741 |
_M_flags &= ~__mask; |
| 742 |
_M_flags |= (__fmtfl & __mask); |
| 743 |
return __old; |
| 744 |
} |
| 745 |
|
| 746 |
|
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
void |
| 753 |
unsetf(fmtflags __mask) |
| 754 |
{ _M_flags &= ~__mask; } |
| 755 |
|
| 756 |
|
| 757 |
|
| 758 |
|
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
_GLIBCXX_NODISCARD |
| 764 |
streamsize |
| 765 |
precision() const |
| 766 |
{ return _M_precision; } |
| 767 |
|
| 768 |
|
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
streamsize |
| 774 |
precision(streamsize __prec) |
| 775 |
{ |
| 776 |
streamsize __old = _M_precision; |
| 777 |
_M_precision = __prec; |
| 778 |
return __old; |
| 779 |
} |
| 780 |
|
| 781 |
|
| 782 |
|
| 783 |
|
| 784 |
|
| 785 |
|
| 786 |
|
| 787 |
_GLIBCXX_NODISCARD |
| 788 |
streamsize |
| 789 |
width() const |
| 790 |
{ return _M_width; } |
| 791 |
|
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
streamsize |
| 798 |
width(streamsize __wide) |
| 799 |
{ |
| 800 |
streamsize __old = _M_width; |
| 801 |
_M_width = __wide; |
| 802 |
return __old; |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
|
| 811 |
|
| 812 |
|
| 813 |
|
| 814 |
|
| 815 |
|
| 816 |
static bool |
| 817 |
sync_with_stdio(bool __sync = true); |
| 818 |
|
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
|
| 827 |
|
| 828 |
locale |
| 829 |
imbue(const locale& __loc) throw(); |
| 830 |
|
| 831 |
|
| 832 |
|
| 833 |
|
| 834 |
|
| 835 |
|
| 836 |
|
| 837 |
|
| 838 |
|
| 839 |
_GLIBCXX_NODISCARD |
| 840 |
locale |
| 841 |
getloc() const |
| 842 |
{ return _M_ios_locale; } |
| 843 |
|
| 844 |
|
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
const locale& |
| 852 |
_M_getloc() const |
| 853 |
{ return _M_ios_locale; } |
| 854 |
|
| 855 |
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
|
| 860 |
|
| 861 |
|
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
|
| 869 |
|
| 870 |
static int |
| 871 |
xalloc() throw(); |
| 872 |
|
| 873 |
|
| 874 |
|
| 875 |
|
| 876 |
|
| 877 |
|
| 878 |
|
| 879 |
|
| 880 |
|
| 881 |
|
| 882 |
|
| 883 |
|
| 884 |
|
| 885 |
|
| 886 |
long& |
| 887 |
iword(int __ix) |
| 888 |
{ |
| 889 |
_Words& __word = ((unsigned)__ix < (unsigned)_M_word_size) |
| 890 |
? _M_word[__ix] : _M_grow_words(__ix, true); |
| 891 |
return __word._M_iword; |
| 892 |
} |
| 893 |
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
|
| 905 |
|
| 906 |
|
| 907 |
void*& |
| 908 |
pword(int __ix) |
| 909 |
{ |
| 910 |
_Words& __word = ((unsigned)__ix < (unsigned)_M_word_size) |
| 911 |
? _M_word[__ix] : _M_grow_words(__ix, false); |
| 912 |
return __word._M_pword; |
| 913 |
} |
| 914 |
|
| 915 |
|
| 916 |
|
| 917 |
|
| 918 |
|
| 919 |
|
| 920 |
|
| 921 |
|
| 922 |
|
| 923 |
|
| 924 |
virtual ~ios_base(); |
| 925 |
|
| 926 |
protected: |
| 927 |
ios_base() throw (); |
| 928 |
|
| 929 |
#if __cplusplus < 201103L |
| 930 |
|
| 931 |
|
| 932 |
private: |
| 933 |
ios_base(const ios_base&); |
| 934 |
|
| 935 |
ios_base& |
| 936 |
operator=(const ios_base&); |
| 937 |
#else |
| 938 |
public: |
| 939 |
ios_base(const ios_base&) = delete; |
| 940 |
|
| 941 |
ios_base& |
| 942 |
operator=(const ios_base&) = delete; |
| 943 |
|
| 944 |
protected: |
| 945 |
void |
| 946 |
_M_move(ios_base&) noexcept; |
| 947 |
|
| 948 |
void |
| 949 |
_M_swap(ios_base& __rhs) noexcept; |
| 950 |
#endif |
| 951 |
}; |
| 952 |
|
| 953 |
|
| 954 |
|
| 955 |
inline ios_base& |
| 956 |
boolalpha(ios_base& __base) |
| 957 |
{ |
| 958 |
__base.setf(ios_base::boolalpha); |
| 959 |
return __base; |
| 960 |
} |
| 961 |
|
| 962 |
|
| 963 |
inline ios_base& |
| 964 |
noboolalpha(ios_base& __base) |
| 965 |
{ |
| 966 |
__base.unsetf(ios_base::boolalpha); |
| 967 |
return __base; |
| 968 |
} |
| 969 |
|
| 970 |
|
| 971 |
inline ios_base& |
| 972 |
showbase(ios_base& __base) |
| 973 |
{ |
| 974 |
__base.setf(ios_base::showbase); |
| 975 |
return __base; |
| 976 |
} |
| 977 |
|
| 978 |
|
| 979 |
inline ios_base& |
| 980 |
noshowbase(ios_base& __base) |
| 981 |
{ |
| 982 |
__base.unsetf(ios_base::showbase); |
| 983 |
return __base; |
| 984 |
} |
| 985 |
|
| 986 |
|
| 987 |
inline ios_base& |
| 988 |
showpoint(ios_base& __base) |
| 989 |
{ |
| 990 |
__base.setf(ios_base::showpoint); |
| 991 |
return __base; |
| 992 |
} |
| 993 |
|
| 994 |
|
| 995 |
inline ios_base& |
| 996 |
noshowpoint(ios_base& __base) |
| 997 |
{ |
| 998 |
__base.unsetf(ios_base::showpoint); |
| 999 |
return __base; |
| 1000 |
} |
| 1001 |
|
| 1002 |
|
| 1003 |
inline ios_base& |
| 1004 |
showpos(ios_base& __base) |
| 1005 |
{ |
| 1006 |
__base.setf(ios_base::showpos); |
| 1007 |
return __base; |
| 1008 |
} |
| 1009 |
|
| 1010 |
|
| 1011 |
inline ios_base& |
| 1012 |
noshowpos(ios_base& __base) |
| 1013 |
{ |
| 1014 |
__base.unsetf(ios_base::showpos); |
| 1015 |
return __base; |
| 1016 |
} |
| 1017 |
|
| 1018 |
|
| 1019 |
inline ios_base& |
| 1020 |
skipws(ios_base& __base) |
| 1021 |
{ |
| 1022 |
__base.setf(ios_base::skipws); |
| 1023 |
return __base; |
| 1024 |
} |
| 1025 |
|
| 1026 |
|
| 1027 |
inline ios_base& |
| 1028 |
noskipws(ios_base& __base) |
| 1029 |
{ |
| 1030 |
__base.unsetf(ios_base::skipws); |
| 1031 |
return __base; |
| 1032 |
} |
| 1033 |
|
| 1034 |
|
| 1035 |
inline ios_base& |
| 1036 |
uppercase(ios_base& __base) |
| 1037 |
{ |
| 1038 |
__base.setf(ios_base::uppercase); |
| 1039 |
return __base; |
| 1040 |
} |
| 1041 |
|
| 1042 |
|
| 1043 |
inline ios_base& |
| 1044 |
nouppercase(ios_base& __base) |
| 1045 |
{ |
| 1046 |
__base.unsetf(ios_base::uppercase); |
| 1047 |
return __base; |
| 1048 |
} |
| 1049 |
|
| 1050 |
|
| 1051 |
inline ios_base& |
| 1052 |
unitbuf(ios_base& __base) |
| 1053 |
{ |
| 1054 |
__base.setf(ios_base::unitbuf); |
| 1055 |
return __base; |
| 1056 |
} |
| 1057 |
|
| 1058 |
|
| 1059 |
inline ios_base& |
| 1060 |
nounitbuf(ios_base& __base) |
| 1061 |
{ |
| 1062 |
__base.unsetf(ios_base::unitbuf); |
| 1063 |
return __base; |
| 1064 |
} |
| 1065 |
|
| 1066 |
|
| 1067 |
|
| 1068 |
inline ios_base& |
| 1069 |
internal(ios_base& __base) |
| 1070 |
{ |
| 1071 |
__base.setf(ios_base::internal, ios_base::adjustfield); |
| 1072 |
return __base; |
| 1073 |
} |
| 1074 |
|
| 1075 |
|
| 1076 |
inline ios_base& |
| 1077 |
left(ios_base& __base) |
| 1078 |
{ |
| 1079 |
__base.setf(ios_base::left, ios_base::adjustfield); |
| 1080 |
return __base; |
| 1081 |
} |
| 1082 |
|
| 1083 |
|
| 1084 |
inline ios_base& |
| 1085 |
right(ios_base& __base) |
| 1086 |
{ |
| 1087 |
__base.setf(ios_base::right, ios_base::adjustfield); |
| 1088 |
return __base; |
| 1089 |
} |
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
inline ios_base& |
| 1094 |
dec(ios_base& __base) |
| 1095 |
{ |
| 1096 |
__base.setf(ios_base::dec, ios_base::basefield); |
| 1097 |
return __base; |
| 1098 |
} |
| 1099 |
|
| 1100 |
|
| 1101 |
inline ios_base& |
| 1102 |
hex(ios_base& __base) |
| 1103 |
{ |
| 1104 |
__base.setf(ios_base::hex, ios_base::basefield); |
| 1105 |
return __base; |
| 1106 |
} |
| 1107 |
|
| 1108 |
|
| 1109 |
inline ios_base& |
| 1110 |
oct(ios_base& __base) |
| 1111 |
{ |
| 1112 |
__base.setf(ios_base::oct, ios_base::basefield); |
| 1113 |
return __base; |
| 1114 |
} |
| 1115 |
|
| 1116 |
|
| 1117 |
|
| 1118 |
inline ios_base& |
| 1119 |
fixed(ios_base& __base) |
| 1120 |
{ |
| 1121 |
__base.setf(ios_base::fixed, ios_base::floatfield); |
| 1122 |
return __base; |
| 1123 |
} |
| 1124 |
|
| 1125 |
|
| 1126 |
inline ios_base& |
| 1127 |
scientific(ios_base& __base) |
| 1128 |
{ |
| 1129 |
__base.setf(ios_base::scientific, ios_base::floatfield); |
| 1130 |
return __base; |
| 1131 |
} |
| 1132 |
|
| 1133 |
#if __cplusplus >= 201103L |
| 1134 |
|
| 1135 |
|
| 1136 |
|
| 1137 |
|
| 1138 |
inline ios_base& |
| 1139 |
hexfloat(ios_base& __base) |
| 1140 |
{ |
| 1141 |
__base.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield); |
| 1142 |
return __base; |
| 1143 |
} |
| 1144 |
|
| 1145 |
|
| 1146 |
inline ios_base& |
| 1147 |
defaultfloat(ios_base& __base) |
| 1148 |
{ |
| 1149 |
__base.unsetf(ios_base::floatfield); |
| 1150 |
return __base; |
| 1151 |
} |
| 1152 |
#endif |
| 1153 |
|
| 1154 |
_GLIBCXX_END_NAMESPACE_VERSION |
| 1155 |
} |
| 1156 |
|
| 1157 |
#endif |