37 #pragma GCC system_header
43 #if __cplusplus < 201103L
46 # include <system_error>
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
80 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
81 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
82 {
return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
84 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
85 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
86 {
return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
88 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
89 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
90 {
return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
92 inline _GLIBCXX_CONSTEXPR _Ios_Fmtflags
93 operator~(_Ios_Fmtflags __a)
94 {
return _Ios_Fmtflags(~static_cast<int>(__a)); }
96 inline const _Ios_Fmtflags&
97 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
98 {
return __a = __a | __b; }
100 inline const _Ios_Fmtflags&
101 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
102 {
return __a = __a & __b; }
104 inline const _Ios_Fmtflags&
105 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
106 {
return __a = __a ^ __b; }
117 _S_ios_openmode_end = 1L << 16
120 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
121 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
122 {
return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
124 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
125 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
126 {
return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
128 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
129 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
130 {
return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
132 inline _GLIBCXX_CONSTEXPR _Ios_Openmode
133 operator~(_Ios_Openmode __a)
134 {
return _Ios_Openmode(~static_cast<int>(__a)); }
136 inline const _Ios_Openmode&
137 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
138 {
return __a = __a | __b; }
140 inline const _Ios_Openmode&
141 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
142 {
return __a = __a & __b; }
144 inline const _Ios_Openmode&
145 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
146 {
return __a = __a ^ __b; }
154 _S_failbit = 1L << 2,
155 _S_ios_iostate_end = 1L << 16
158 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
159 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
160 {
return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
162 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
163 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
164 {
return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
166 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
167 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
168 {
return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
170 inline _GLIBCXX_CONSTEXPR _Ios_Iostate
171 operator~(_Ios_Iostate __a)
172 {
return _Ios_Iostate(~static_cast<int>(__a)); }
174 inline const _Ios_Iostate&
175 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
176 {
return __a = __a | __b; }
178 inline const _Ios_Iostate&
179 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
180 {
return __a = __a & __b; }
182 inline const _Ios_Iostate&
183 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
184 {
return __a = __a ^ __b; }
190 _S_cur = _GLIBCXX_STDIO_SEEK_CUR,
191 _S_end = _GLIBCXX_STDIO_SEEK_END,
192 _S_ios_seekdir_end = 1L << 16
195 #if __cplusplus >= 201103L
199 template <>
struct is_error_code_enum<
io_errc> :
public true_type { };
201 const error_category& iostream_category() noexcept;
204 make_error_code(
io_errc e) noexcept
205 {
return error_code(static_cast<int>(e), iostream_category()); }
207 inline error_condition
208 make_error_condition(
io_errc e) noexcept
209 {
return error_condition(static_cast<int>(e), iostream_category()); }
224 #if _GLIBCXX_USE_CXX11_ABI
225 #if __cplusplus < 201103L
227 struct system_error : std::runtime_error
248 #if _GLIBCXX_USE_CXX11_ABI
249 class _GLIBCXX_ABI_TAG_CXX11 failure :
public system_error
253 failure(
const string& __str);
255 #if __cplusplus >= 201103L
257 failure(
const string&,
const error_code&);
260 failure(
const char*,
const error_code& = io_errc::stream);
267 what()
const throw();
270 class failure :
public exception
276 failure(
const string& __str)
throw();
284 what()
const throw();
323 static const fmtflags
dec = _S_dec;
326 static const fmtflags
fixed = _S_fixed;
329 static const fmtflags
hex = _S_hex;
334 static const fmtflags
internal = _S_internal;
338 static const fmtflags
left = _S_left;
341 static const fmtflags
oct = _S_oct;
345 static const fmtflags
right = _S_right;
362 static const fmtflags
skipws = _S_skipws;
426 static const openmode
app = _S_app;
429 static const openmode
ate = _S_ate;
437 static const openmode
in = _S_in;
440 static const openmode
out = _S_out;
443 static const openmode
trunc = _S_trunc;
458 static const seekdir
beg = _S_beg;
461 static const seekdir
cur = _S_cur;
464 static const seekdir
end = _S_end;
467 typedef int io_state;
468 typedef int open_mode;
469 typedef int seek_dir;
517 iostate _M_exception;
518 iostate _M_streambuf_state;
522 struct _Callback_list
525 _Callback_list* _M_next;
528 _Atomic_word _M_refcount;
531 _Callback_list* __cb)
532 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
535 _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
539 _M_remove_reference()
542 _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE(&_M_refcount);
543 int __res = __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1);
546 _GLIBCXX_SYNCHRONIZATION_HAPPENS_AFTER(&_M_refcount);
552 _Callback_list* _M_callbacks;
555 _M_call_callbacks(
event __ev)
throw();
558 _M_dispose_callbacks(
void) throw();
565 _Words() : _M_pword(0), _M_iword(0) { }
573 enum { _S_local_word_size = 8 };
574 _Words _M_local_word[_S_local_word_size];
581 _M_grow_words(
int __index,
bool __iword);
584 locale _M_ios_locale;
597 friend class ios_base;
603 static _Atomic_word _S_refcount;
604 static bool _S_synced_with_stdio;
626 fmtflags __old = _M_flags;
642 fmtflags __old = _M_flags;
657 setf(fmtflags __fmtfl, fmtflags __mask)
659 fmtflags __old = _M_flags;
661 _M_flags |= (__fmtfl & __mask);
673 { _M_flags &= ~__mask; }
684 {
return _M_precision; }
695 _M_precision = __prec;
758 {
return _M_ios_locale; }
769 {
return _M_ios_locale; }
805 _Words& __word = (__ix < _M_word_size)
806 ? _M_word[__ix] : _M_grow_words(__ix,
true);
807 return __word._M_iword;
826 _Words& __word = (__ix < _M_word_size)
827 ? _M_word[__ix] : _M_grow_words(__ix,
false);
828 return __word._M_pword;
845 #if __cplusplus < 201103L
858 operator=(
const ios_base&) =
delete;
1049 #if __cplusplus >= 201103L
1070 _GLIBCXX_END_NAMESPACE_VERSION
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
static const fmtflags unitbuf
Flushes output after each output operation.
streamsize width() const
Flags access.
Container class for localization functionality.The locale class is first a class wrapper for C librar...
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.)
streamsize precision(streamsize __prec)
Changing flags.
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
ios_base & noshowpos(ios_base &__base)
Calls base.unsetf(ios_base::showpos).
static const fmtflags adjustfield
A mask of left|right|internal. Useful for the 2-arg form of setf.
locale getloc() const
Locale access.
void(* event_callback)(event __e, ios_base &__b, int __i)
The type of an event callback function.
static const fmtflags boolalpha
Insert/extract bool in alphabetic rather than numeric format.
static const fmtflags floatfield
A mask of scientific|fixed. Useful for the 2-arg form of setf.
static const fmtflags showpoint
Generates a decimal-point character unconditionally in generated floating-point output.
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
fmtflags flags() const
Access to format flags.
static const fmtflags basefield
A mask of dec|oct|hex. Useful for the 2-arg form of setf.
static const fmtflags hex
Converts integer input or generates integer output in hexadecimal base.
ios_base & noshowpoint(ios_base &__base)
Calls base.unsetf(ios_base::showpoint).
_Ios_Iostate iostate
This is a bitmask type.
static const fmtflags scientific
Generates floating-point output in scientific notation.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
event
The set of events that may be passed to an event callback.
void unsetf(fmtflags __mask)
Clearing format flags.
ios_base & hexfloat(ios_base &__base)
Calls base.setf(ios_base::fixed|ios_basescientific, ios_base::floatfield)
static const fmtflags right
Adds fill characters on the left (initial positions) of certain generated output. (I...
streamsize precision() const
Flags access.
ios_base & nouppercase(ios_base &__base)
Calls base.unsetf(ios_base::uppercase).
ios_base & uppercase(ios_base &__base)
Calls base.setf(ios_base::uppercase).
_Ios_Openmode openmode
This is a bitmask type.
static const fmtflags internal
Adds fill characters at a designated internal point in certain generated output, or identical to righ...
static int xalloc()
Access to unique indices.
static const fmtflags skipws
Skips leading white space before certain input operations.
ios_base & showbase(ios_base &__base)
Calls base.setf(ios_base::showbase).
streamsize width(streamsize __wide)
Changing flags.
static const fmtflags dec
Converts integer input or generates integer output in decimal base.
static const fmtflags oct
Converts integer input or generates integer output in octal base.
static const openmode trunc
Open for input. Default for ofstream.
ios_base & defaultfloat(ios_base &__base)
Calls base.unsetf(ios_base::floatfield)
_Ios_Fmtflags fmtflags
This is a bitmask type.
static const openmode binary
Perform input and output in binary mode (as opposed to text mode). This is probably not what you thin...
ios_base & nounitbuf(ios_base &__base)
Calls base.unsetf(ios_base::unitbuf).
static const fmtflags showbase
Generates a prefix indicating the numeric base of generated integer output.
locale imbue(const locale &__loc)
Setting a new locale.
ios_base & noboolalpha(ios_base &__base)
Calls base.unsetf(ios_base::boolalpha).
static bool sync_with_stdio(bool __sync=true)
Interaction with the standard C I/O objects.
ios_base & oct(ios_base &__base)
Calls base.setf(ios_base::oct, ios_base::basefield).
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
void register_callback(event_callback __fn, int __index)
Add the callback __fn with parameter __index.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
ios_base & showpos(ios_base &__base)
Calls base.setf(ios_base::showpos).
static const seekdir cur
Request a seek relative to the current position within the sequence.
Class representing stream positions.
ios_base & noshowbase(ios_base &__base)
Calls base.unsetf(ios_base::showbase).
static const fmtflags showpos
Generates a + sign in non-negative generated numeric output.
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
static const fmtflags uppercase
Replaces certain lowercase letters with their uppercase equivalents in generated output.
long & iword(int __ix)
Access to integer array.
fmtflags setf(fmtflags __fmtfl, fmtflags __mask)
Setting new format flags.
ios_base & hex(ios_base &__base)
Calls base.setf(ios_base::hex, ios_base::basefield).
static const openmode ate
Open and seek to end immediately after opening.
ios_base & boolalpha(ios_base &__base)
Calls base.setf(ios_base::boolalpha).
static const seekdir beg
Request a seek relative to the beginning of the stream.
static const openmode in
Open for input. Default for ifstream and fstream.
fmtflags flags(fmtflags __fmtfl)
Setting new format flags all at once.
void *& pword(int __ix)
Access to void pointer array.
ios_base & unitbuf(ios_base &__base)
Calls base.setf(ios_base::unitbuf).
static const openmode out
Open for output. Default for ofstream and fstream.
_Ios_Seekdir seekdir
This is an enumerated type.
long long streamoff
Type used by fpos, char_traits, and char_traits.
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
ios_base & showpoint(ios_base &__base)
Calls base.setf(ios_base::showpoint).
static const iostate goodbit
Indicates all is well.
static const fmtflags fixed
Generate floating-point output in fixed-point notation.
static const openmode app
Seek to end before each write.
_Siter_base< _Iterator >::iterator_type __base(_Iterator __it)
ISO C++ entities toplevel namespace is std.
const locale & _M_getloc() const
Locale access.
ios_base & noskipws(ios_base &__base)
Calls base.unsetf(ios_base::skipws).
static const seekdir end
Request a seek relative to the current end of the sequence.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...