38#pragma GCC system_header
45#if __cplusplus < 201103L
51namespace std _GLIBCXX_VISIBILITY(default)
53_GLIBCXX_BEGIN_NAMESPACE_VERSION
61 _S_boolalpha = 1L << 0,
65 _S_internal = 1L << 4,
69 _S_scientific = 1L << 8,
70 _S_showbase = 1L << 9,
71 _S_showpoint = 1L << 10,
72 _S_showpos = 1L << 11,
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__
84 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
86 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
87 {
return _Ios_Fmtflags(
static_cast<int>(__a) &
static_cast<int>(__b)); }
89 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
91 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
92 {
return _Ios_Fmtflags(
static_cast<int>(__a) |
static_cast<int>(__b)); }
94 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
96 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
97 {
return _Ios_Fmtflags(
static_cast<int>(__a) ^
static_cast<int>(__b)); }
99 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
101 operator~(_Ios_Fmtflags __a) _GLIBCXX_NOTHROW
102 {
return _Ios_Fmtflags(~
static_cast<int>(__a)); }
105 inline const _Ios_Fmtflags&
106 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
107 {
return __a = __a | __b; }
110 inline const _Ios_Fmtflags&
111 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
112 {
return __a = __a & __b; }
115 inline const _Ios_Fmtflags&
116 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW
117 {
return __a = __a ^ __b; }
121#ifdef __glibcxx_ios_noreplace
122#define _NOREPLACE_UNUSED
124#define _NOREPLACE_UNUSED __attribute__((__unused__))
127 enum __attribute__((__flag_enum__)) _Ios_Openmode
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__
141#undef _NOREPLACE_UNUSED
143 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
145 operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
146 {
return _Ios_Openmode(
static_cast<int>(__a) &
static_cast<int>(__b)); }
148 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
150 operator|(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
151 {
return _Ios_Openmode(
static_cast<int>(__a) |
static_cast<int>(__b)); }
153 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
155 operator^(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
156 {
return _Ios_Openmode(
static_cast<int>(__a) ^
static_cast<int>(__b)); }
158 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
160 operator~(_Ios_Openmode __a) _GLIBCXX_NOTHROW
161 {
return _Ios_Openmode(~
static_cast<int>(__a)); }
164 inline const _Ios_Openmode&
165 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
166 {
return __a = __a | __b; }
169 inline const _Ios_Openmode&
170 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
171 {
return __a = __a & __b; }
174 inline const _Ios_Openmode&
175 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW
176 {
return __a = __a ^ __b; }
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__
190 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
192 operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
193 {
return _Ios_Iostate(
static_cast<int>(__a) &
static_cast<int>(__b)); }
195 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
197 operator|(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
198 {
return _Ios_Iostate(
static_cast<int>(__a) |
static_cast<int>(__b)); }
200 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
202 operator^(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
203 {
return _Ios_Iostate(
static_cast<int>(__a) ^
static_cast<int>(__b)); }
205 _GLIBCXX_NODISCARD _GLIBCXX_CONSTEXPR
207 operator~(_Ios_Iostate __a) _GLIBCXX_NOTHROW
208 {
return _Ios_Iostate(~
static_cast<int>(__a)); }
211 inline const _Ios_Iostate&
212 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
213 {
return __a = __a | __b; }
216 inline const _Ios_Iostate&
217 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
218 {
return __a = __a & __b; }
221 inline const _Ios_Iostate&
222 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW
223 {
return __a = __a ^ __b; }
229 _S_cur = _GLIBCXX_STDIO_SEEK_CUR,
230 _S_end = _GLIBCXX_STDIO_SEEK_END,
231 _S_ios_seekdir_end = 1L << 16
234#if __cplusplus >= 201103L
238 template <>
struct is_error_code_enum<
io_errc> :
public true_type { };
240 [[__nodiscard__, __gnu__::__const__]]
242 iostream_category() noexcept;
247 {
return error_code(
static_cast<int>(__e), iostream_category()); }
252 {
return error_condition(
static_cast<int>(__e), iostream_category()); }
267#if _GLIBCXX_USE_CXX11_ABI
268#if __cplusplus < 201103L
291#if _GLIBCXX_USE_CXX11_ABI
292 class _GLIBCXX_ABI_TAG_CXX11 failure :
public system_error
296 failure(
const string& __str);
298#if __cplusplus >= 201103L
303 failure(
const char*,
const error_code& = io_errc::stream);
310 what()
const throw();
319 failure(
const string& __str)
throw();
327 what()
const throw();
329#if __cplusplus >= 201103L
334 failure(
const string& __s,
const error_code&) noexcept
340 : failure(
string(__s))
506 static const openmode __noreplace = _S_noreplace;
508#ifdef __glibcxx_ios_noreplace
510 static const openmode noreplace = _S_noreplace;
534#if __cplusplus <= 201402L
537 _GLIBCXX_DEPRECATED_SUGGEST(
"std::iostate");
538 typedef int open_mode
539 _GLIBCXX_DEPRECATED_SUGGEST(
"std::openmode");
541 _GLIBCXX_DEPRECATED_SUGGEST(
"std::seekdir");
544 _GLIBCXX_DEPRECATED_SUGGEST(
"std::streampos");
546 _GLIBCXX_DEPRECATED_SUGGEST(
"std::streamoff");
597 struct _Callback_list
600 _Callback_list* _M_next;
603 _Atomic_word _M_refcount;
606 _Callback_list* __cb)
607 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
610 _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
614 _M_remove_reference()
617 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
618 int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1);
621 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
627 _Callback_list* _M_callbacks;
630 _M_call_callbacks(
event __ev)
throw();
633 _M_dispose_callbacks(
void)
throw();
640 _Words() : _M_pword(0), _M_iword(0) { }
648 enum { _S_local_word_size = 8 };
649 _Words _M_local_word[_S_local_word_size];
656 _M_grow_words(
int __index,
bool __iword);
659 locale _M_ios_locale;
672 friend class ios_base;
677#if __cplusplus >= 201103L
678 Init(
const Init&) =
default;
679 Init& operator=(
const Init&) =
default;
683 static _Atomic_word _S_refcount;
684 static bool _S_synced_with_stdio;
742 _M_flags |= (__fmtfl & __mask);
754 { _M_flags &= ~__mask; }
766 {
return _M_precision; }
777 _M_precision = __prec;
842 {
return _M_ios_locale; }
853 {
return _M_ios_locale; }
889 _Words& __word = ((unsigned)__ix < (unsigned)_M_word_size)
890 ? _M_word[__ix] : _M_grow_words(__ix,
true);
891 return __word._M_iword;
910 _Words& __word = ((unsigned)__ix < (unsigned)_M_word_size)
911 ? _M_word[__ix] : _M_grow_words(__ix,
false);
912 return __word._M_pword;
929#if __cplusplus < 201103L
933 ios_base(
const ios_base&);
936 operator=(
const ios_base&);
939 ios_base(
const ios_base&) =
delete;
942 operator=(
const ios_base&) =
delete;
946 _M_move(ios_base&)
noexcept;
949 _M_swap(ios_base& __rhs)
noexcept;
1133#if __cplusplus >= 201103L
1154_GLIBCXX_END_NAMESPACE_VERSION
error_condition make_error_condition(future_errc __errc) noexcept
Overload of make_error_condition for future_errc.
error_code make_error_code(future_errc __errc) noexcept
Overload of make_error_code for future_errc.
class __attribute((__abi_tag__("cxx11"))) failure typedef _Ios_Fmtflags fmtflags
These are thrown to indicate problems with io.
ISO C++ entities toplevel namespace is std.
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
ios_base & internal(ios_base &__base)
Calls base.setf(ios_base::internal, ios_base::adjustfield).
ios_base & noskipws(ios_base &__base)
Calls base.unsetf(ios_base::skipws).
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
ios_base & hex(ios_base &__base)
Calls base.setf(ios_base::hex, ios_base::basefield).
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
ios_base & noshowpoint(ios_base &__base)
Calls base.unsetf(ios_base::showpoint).
ios_base & unitbuf(ios_base &__base)
Calls base.setf(ios_base::unitbuf).
ios_base & nounitbuf(ios_base &__base)
Calls base.unsetf(ios_base::unitbuf).
ios_base & showbase(ios_base &__base)
Calls base.setf(ios_base::showbase).
long long streamoff
Type used by fpos, char_traits<char>, and char_traits<wchar_t>.
fpos< mbstate_t > streampos
File position for char streams.
ios_base & noshowpos(ios_base &__base)
Calls base.unsetf(ios_base::showpos).
ios_base & nouppercase(ios_base &__base)
Calls base.unsetf(ios_base::uppercase).
ios_base & noshowbase(ios_base &__base)
Calls base.unsetf(ios_base::showbase).
ios_base & oct(ios_base &__base)
Calls base.setf(ios_base::oct, ios_base::basefield).
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
constexpr bitset< _Nb > operator^(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
ios_base & showpoint(ios_base &__base)
Calls base.setf(ios_base::showpoint).
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
ios_base & showpos(ios_base &__base)
Calls base.setf(ios_base::showpos).
ios_base & hexfloat(ios_base &__base)
Calls base.setf(ios_base::fixed|ios_basescientific, ios_base::floatfield)
ios_base & defaultfloat(ios_base &__base)
Calls base.unsetf(ios_base::floatfield)
constexpr bitset< _Nb > operator|(const bitset< _Nb > &__x, const bitset< _Nb > &__y) noexcept
Global bitwise operations on bitsets.
ios_base & uppercase(ios_base &__base)
Calls base.setf(ios_base::uppercase).
ios_base & boolalpha(ios_base &__base)
Calls base.setf(ios_base::boolalpha).
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.
One of two subclasses of exception.
An exception type that includes an error_code value.
Base class for all library exceptions.
The base of the I/O class hierarchy.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
static const fmtflags skipws
Skips leading white space before certain input operations.
_Ios_Iostate iostate
This is a bitmask type.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
static const fmtflags right
Adds fill characters on the left (initial positions) of certain generated output. (I....
static const seekdir cur
Request a seek relative to the current position within the sequence.
static const fmtflags uppercase
Replaces certain lowercase letters with their uppercase equivalents in generated output.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
void *& pword(int __ix)
Access to void pointer array.
static const seekdir beg
Request a seek relative to the beginning of the stream.
streamsize precision() const
Flags access.
locale imbue(const locale &__loc)
Setting a new locale.
static const fmtflags dec
Converts integer input or generates integer output in decimal base.
static int xalloc()
Access to unique indices.
event
The set of events that may be passed to an event callback.
fmtflags flags(fmtflags __fmtfl)
Setting new format flags all at once.
void unsetf(fmtflags __mask)
Clearing format flags.
static const fmtflags showpoint
Generates a decimal-point character unconditionally in generated floating-point output.
static const seekdir end
Request a seek relative to the current end of the sequence.
void register_callback(event_callback __fn, int __index)
Add the callback __fn with parameter __index.
static const openmode in
Open for input. Default for ifstream and fstream.
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
void(* event_callback)(event __e, ios_base &__b, int __i)
The type of an event callback function.
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...
long & iword(int __ix)
Access to integer array.
static const openmode out
Open for output. Default for ofstream and fstream.
static const fmtflags boolalpha
Insert/extract bool in alphabetic rather than numeric format.
fmtflags flags() const
Access to format flags.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
static const fmtflags floatfield
A mask of scientific|fixed. Useful for the 2-arg form of setf.
fmtflags setf(fmtflags __fmtfl, fmtflags __mask)
Setting new format flags.
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 iostate goodbit
Indicates all is well.
const locale & _M_getloc() const
Locale access.
static const fmtflags unitbuf
Flushes output after each output operation.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
_Ios_Openmode openmode
This is a bitmask type.
streamsize width() const
Flags access.
static bool sync_with_stdio(bool __sync=true)
Interaction with the standard C I/O objects.
static const fmtflags fixed
Generate floating-point output in fixed-point notation.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
static const openmode app
Seek to end before each write.
_Ios_Seekdir seekdir
This is an enumerated type.
streamsize width(streamsize __wide)
Changing flags.
static const fmtflags left
Adds fill characters on the right (final positions) of certain generated output. (I....
static const fmtflags showpos
Generates a + sign in non-negative generated numeric output.
static const openmode ate
Open and seek to end immediately after opening.
locale getloc() const
Locale access.
static const openmode trunc
Truncate an existing stream when opening. Default for ofstream.
streamsize precision(streamsize __prec)
Changing flags.
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
static const fmtflags scientific
Generates floating-point output in scientific notation.
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
Container class for localization functionality.