37 #pragma GCC system_header 43 #if __cplusplus < 201103L 49 namespace std _GLIBCXX_VISIBILITY(default)
51 _GLIBCXX_BEGIN_NAMESPACE_VERSION
59 _S_boolalpha = 1L << 0,
63 _S_internal = 1L << 4,
67 _S_scientific = 1L << 8,
68 _S_showbase = 1L << 9,
69 _S_showpoint = 1L << 10,
70 _S_showpos = 1L << 11,
72 _S_unitbuf = 1L << 13,
73 _S_uppercase = 1L << 14,
74 _S_adjustfield = _S_left | _S_right | _S_internal,
75 _S_basefield = _S_dec | _S_oct | _S_hex,
76 _S_floatfield = _S_scientific | _S_fixed,
77 _S_ios_fmtflags_end = 1L << 16,
78 _S_ios_fmtflags_max = __INT_MAX__,
79 _S_ios_fmtflags_min = ~__INT_MAX__
82 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
83 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
84 {
return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
86 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
87 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
88 {
return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
90 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
91 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
92 {
return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
94 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
95 operator~(_Ios_Fmtflags __a)
96 {
return _Ios_Fmtflags(~static_cast<int>(__a)); }
98 inline const _Ios_Fmtflags&
99 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
100 {
return __a = __a | __b; }
102 inline const _Ios_Fmtflags&
103 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
104 {
return __a = __a & __b; }
106 inline const _Ios_Fmtflags&
107 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
108 {
return __a = __a ^ __b; }
119 _S_noreplace = 1L << 6,
120 _S_ios_openmode_end = 1L << 16,
121 _S_ios_openmode_max = __INT_MAX__,
122 _S_ios_openmode_min = ~__INT_MAX__
125 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
126 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
127 {
return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
129 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
130 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
131 {
return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
133 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
134 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
135 {
return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
137 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
138 operator~(_Ios_Openmode __a)
139 {
return _Ios_Openmode(~static_cast<int>(__a)); }
141 inline const _Ios_Openmode&
142 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
143 {
return __a = __a | __b; }
145 inline const _Ios_Openmode&
146 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
147 {
return __a = __a & __b; }
149 inline const _Ios_Openmode&
150 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
151 {
return __a = __a ^ __b; }
159 _S_failbit = 1L << 2,
160 _S_ios_iostate_end = 1L << 16,
161 _S_ios_iostate_max = __INT_MAX__,
162 _S_ios_iostate_min = ~__INT_MAX__
165 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
166 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
167 {
return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
169 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
170 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
171 {
return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
173 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
174 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
175 {
return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
177 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
178 operator~(_Ios_Iostate __a)
179 {
return _Ios_Iostate(~static_cast<int>(__a)); }
181 inline const _Ios_Iostate&
182 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
183 {
return __a = __a | __b; }
185 inline const _Ios_Iostate&
186 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
187 {
return __a = __a & __b; }
189 inline const _Ios_Iostate&
190 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
191 {
return __a = __a ^ __b; }
197 _S_cur = _GLIBCXX_STDIO_SEEK_CUR,
198 _S_end = _GLIBCXX_STDIO_SEEK_END,
199 _S_ios_seekdir_end = 1L << 16
202 #if __cplusplus >= 201103L 208 [[__nodiscard__, __gnu__::__const__]]
209 const error_category&
210 iostream_category() noexcept;
215 {
return error_code(static_cast<int>(__e), iostream_category()); }
218 inline error_condition
220 {
return error_condition(static_cast<int>(__e), iostream_category()); }
235 #if _GLIBCXX_USE_CXX11_ABI 236 #if __cplusplus < 201103L 259 #if _GLIBCXX_USE_CXX11_ABI 266 #if __cplusplus >= 201103L 278 what()
const throw();
287 failure(
const string& __str)
throw();
295 what()
const throw();
297 #if __cplusplus >= 201103L 352 static const fmtflags
dec = _S_dec;
355 static const fmtflags
fixed = _S_fixed;
358 static const fmtflags
hex = _S_hex;
363 static const fmtflags
internal = _S_internal;
367 static const fmtflags
left = _S_left;
370 static const fmtflags
oct = _S_oct;
374 static const fmtflags
right = _S_right;
391 static const fmtflags
skipws = _S_skipws;
455 static const openmode
app = _S_app;
458 static const openmode
ate = _S_ate;
466 static const openmode
in = _S_in;
469 static const openmode
out = _S_out;
472 static const openmode
trunc = _S_trunc;
474 static const openmode __noreplace = _S_noreplace;
476 #if __cplusplus >= 202100L 477 #define __cpp_lib_ios_noreplace 202207L 479 static const openmode noreplace = _S_noreplace;
495 static const seekdir
beg = _S_beg;
498 static const seekdir
cur = _S_cur;
501 static const seekdir
end = _S_end;
503 #if __cplusplus <= 201402L 506 _GLIBCXX_DEPRECATED_SUGGEST(
"std::iostate");
507 typedef int open_mode
508 _GLIBCXX_DEPRECATED_SUGGEST(
"std::openmode");
510 _GLIBCXX_DEPRECATED_SUGGEST(
"std::seekdir");
513 _GLIBCXX_DEPRECATED_SUGGEST(
"std::streampos");
515 _GLIBCXX_DEPRECATED_SUGGEST(
"std::streamoff");
561 iostate _M_exception;
562 iostate _M_streambuf_state;
566 struct _Callback_list
569 _Callback_list* _M_next;
572 _Atomic_word _M_refcount;
575 _Callback_list* __cb)
576 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
579 _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
583 _M_remove_reference()
586 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
587 int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1);
590 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
596 _Callback_list* _M_callbacks;
599 _M_call_callbacks(
event __ev)
throw();
602 _M_dispose_callbacks(
void)
throw();
609 _Words() : _M_pword(0), _M_iword(0) { }
617 enum { _S_local_word_size = 8 };
618 _Words _M_local_word[_S_local_word_size];
625 _M_grow_words(
int __index,
bool __iword);
628 locale _M_ios_locale;
641 friend class ios_base;
646 #if __cplusplus >= 201103L 647 Init(
const Init&) =
default;
648 Init& operator=(
const Init&) =
default;
652 static _Atomic_word _S_refcount;
653 static bool _S_synced_with_stdio;
675 fmtflags __old = _M_flags;
691 fmtflags __old = _M_flags;
706 setf(fmtflags __fmtfl, fmtflags __mask)
708 fmtflags __old = _M_flags;
710 _M_flags |= (__fmtfl & __mask);
722 { _M_flags &= ~__mask; }
733 {
return _M_precision; }
744 _M_precision = __prec;
807 {
return _M_ios_locale; }
818 {
return _M_ios_locale; }
854 _Words& __word = ((unsigned)__ix < (
unsigned)_M_word_size)
855 ? _M_word[__ix] : _M_grow_words(__ix,
true);
856 return __word._M_iword;
875 _Words& __word = ((unsigned)__ix < (
unsigned)_M_word_size)
876 ? _M_word[__ix] : _M_grow_words(__ix,
false);
877 return __word._M_pword;
894 #if __cplusplus < 201103L 907 operator=(
const ios_base&) =
delete;
1098 #if __cplusplus >= 201103L 1119 _GLIBCXX_END_NAMESPACE_VERSION
ios_base & nouppercase(ios_base &__base)
Calls base.unsetf(ios_base::uppercase).
constexpr _Iterator __base(_Iterator __it)
static const seekdir beg
Request a seek relative to the beginning of the stream.
locale getloc() const
Locale access.
static const seekdir cur
Request a seek relative to the current position within the sequence.
ios_base & hexfloat(ios_base &__base)
Calls base.setf(ios_base::fixed|ios_basescientific, ios_base::floatfield)
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
_Ios_Fmtflags fmtflags
This is a bitmask type.
streamsize precision() const
Flags access.
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
void(* event_callback)(event __e, ios_base &__b, int __i)
The type of an event callback function.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
static const fmtflags fixed
Generate floating-point output in fixed-point notation.
static const fmtflags dec
Converts integer input or generates integer output in decimal base.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
static bool sync_with_stdio(bool __sync=true)
Interaction with the standard C I/O objects.
ios_base & noshowpos(ios_base &__base)
Calls base.unsetf(ios_base::showpos).
streamsize width() const
Flags access.
event
The set of events that may be passed to an event callback.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
void *& pword(int __ix)
Access to void pointer array.
static const fmtflags uppercase
Replaces certain lowercase letters with their uppercase equivalents in generated output.
ios_base & unitbuf(ios_base &__base)
Calls base.setf(ios_base::unitbuf).
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
static const openmode app
Seek to end before each write.
ios_base & hex(ios_base &__base)
Calls base.setf(ios_base::hex, ios_base::basefield).
ios_base & defaultfloat(ios_base &__base)
Calls base.unsetf(ios_base::floatfield)
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
const locale & _M_getloc() const
Locale access.
static const fmtflags right
Adds fill characters on the left (initial positions) of certain generated output. (I...
locale imbue(const locale &__loc)
Setting a new locale.
Base class for all library exceptions.
streamsize width(streamsize __wide)
Changing flags.
integral_constant< bool, true > true_type
The type used as a compile-time boolean with true value.
_Ios_Iostate iostate
This is a bitmask type.
ios_base & boolalpha(ios_base &__base)
Calls base.setf(ios_base::boolalpha).
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...
static const fmtflags unitbuf
Flushes output after each output operation.
static const iostate goodbit
Indicates all is well.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
void register_callback(event_callback __fn, int __index)
Add the callback __fn with parameter __index.
static const fmtflags floatfield
A mask of scientific|fixed. Useful for the 2-arg form of setf.
Class representing stream positions.
static const fmtflags left
Adds fill characters on the right (final positions) of certain generated output. (I.e., the thing you print is flush left.)
static const seekdir end
Request a seek relative to the current end of the sequence.
ISO C++ entities toplevel namespace is std.
ios_base & noboolalpha(ios_base &__base)
Calls base.unsetf(ios_base::boolalpha).
constexpr bitset< _Nb > operator &(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
static const fmtflags showpos
Generates a + sign in non-negative generated numeric output.
ios_base & noskipws(ios_base &__base)
Calls base.unsetf(ios_base::skipws).
ios_base & showbase(ios_base &__base)
Calls base.setf(ios_base::showbase).
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
An exception type that includes an error_code value.
ios_base & uppercase(ios_base &__base)
Calls base.setf(ios_base::uppercase).
streamsize precision(streamsize __prec)
Changing flags.
fmtflags flags() const
Access to format flags.
ios_base & showpoint(ios_base &__base)
Calls base.setf(ios_base::showpoint).
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
These are thrown to indicate problems with io.27.4.2.1.1 Class ios_base::failure. ...
virtual const char * what() const
static const openmode binary
Perform input and output in binary mode (as opposed to text mode). This is probably not what you thin...
static const fmtflags scientific
Generates floating-point output in scientific notation.
static const fmtflags skipws
Skips leading white space before certain input operations.
ios_base & noshowpoint(ios_base &__base)
Calls base.unsetf(ios_base::showpoint).
_Ios_Seekdir seekdir
This is an enumerated type.
_Ios_Openmode openmode
This is a bitmask type.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
One of two subclasses of exception.
error_condition make_error_condition(future_errc __errc) noexcept
Overload of make_error_condition for future_errc.
fmtflags setf(fmtflags __fmtfl, fmtflags __mask)
Setting new format flags.
ios_base & nounitbuf(ios_base &__base)
Calls base.unsetf(ios_base::unitbuf).
static const fmtflags showpoint
Generates a decimal-point character unconditionally in generated floating-point output.
static const fmtflags boolalpha
Insert/extract bool in alphabetic rather than numeric format.
ios_base & oct(ios_base &__base)
Calls base.setf(ios_base::oct, ios_base::basefield).
constexpr bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
static const openmode in
Open for input. Default for ifstream and fstream.
static const openmode ate
Open and seek to end immediately after opening.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
ios_base & noshowbase(ios_base &__base)
Calls base.unsetf(ios_base::showbase).
constexpr bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
void unsetf(fmtflags __mask)
Clearing format flags.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
ios_base & showpos(ios_base &__base)
Calls base.setf(ios_base::showpos).
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
static const openmode trunc
Truncate an existing stream when opening. Default for ofstream.
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
static const openmode out
Open for output. Default for ofstream and fstream.
fmtflags flags(fmtflags __fmtfl)
Setting new format flags all at once.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
long & iword(int __ix)
Access to integer array.
long long streamoff
Type used by fpos, char_traits<char>, and char_traits<wchar_t>.
static int xalloc()
Access to unique indices.