39 #pragma GCC system_header
45 #ifndef _GLIBCXX_STDIO_MACROS
47 # define _IOS_BASE_SEEK_CUR SEEK_CUR
48 # define _IOS_BASE_SEEK_END SEEK_END
50 # define _IOS_BASE_SEEK_CUR 1
51 # define _IOS_BASE_SEEK_END 2
54 _GLIBCXX_BEGIN_NAMESPACE(
std)
62 _S_boolalpha = 1L << 0,
66 _S_internal = 1L << 4,
70 _S_scientific = 1L << 8,
71 _S_showbase = 1L << 9,
72 _S_showpoint = 1L << 10,
73 _S_showpos = 1L << 11,
75 _S_unitbuf = 1L << 13,
76 _S_uppercase = 1L << 14,
77 _S_adjustfield = _S_left | _S_right | _S_internal,
78 _S_basefield = _S_dec | _S_oct | _S_hex,
79 _S_floatfield = _S_scientific | _S_fixed,
80 _S_ios_fmtflags_end = 1L << 16
84 operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
85 {
return _Ios_Fmtflags(static_cast<int>(__a) & static_cast<int>(__b)); }
88 operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
89 {
return _Ios_Fmtflags(static_cast<int>(__a) | static_cast<int>(__b)); }
92 operator^(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
93 {
return _Ios_Fmtflags(static_cast<int>(__a) ^ static_cast<int>(__b)); }
96 operator|=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
97 {
return __a = __a | __b; }
100 operator&=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
101 {
return __a = __a & __b; }
103 inline _Ios_Fmtflags&
104 operator^=(_Ios_Fmtflags& __a, _Ios_Fmtflags __b)
105 {
return __a = __a ^ __b; }
108 operator~(_Ios_Fmtflags __a)
109 {
return _Ios_Fmtflags(~static_cast<int>(__a)); }
120 _S_ios_openmode_end = 1L << 16
124 operator&(_Ios_Openmode __a, _Ios_Openmode __b)
125 {
return _Ios_Openmode(static_cast<int>(__a) & static_cast<int>(__b)); }
128 operator|(_Ios_Openmode __a, _Ios_Openmode __b)
129 {
return _Ios_Openmode(static_cast<int>(__a) | static_cast<int>(__b)); }
132 operator^(_Ios_Openmode __a, _Ios_Openmode __b)
133 {
return _Ios_Openmode(static_cast<int>(__a) ^ static_cast<int>(__b)); }
135 inline _Ios_Openmode&
136 operator|=(_Ios_Openmode& __a, _Ios_Openmode __b)
137 {
return __a = __a | __b; }
139 inline _Ios_Openmode&
140 operator&=(_Ios_Openmode& __a, _Ios_Openmode __b)
141 {
return __a = __a & __b; }
143 inline _Ios_Openmode&
144 operator^=(_Ios_Openmode& __a, _Ios_Openmode __b)
145 {
return __a = __a ^ __b; }
148 operator~(_Ios_Openmode __a)
149 {
return _Ios_Openmode(~static_cast<int>(__a)); }
157 _S_failbit = 1L << 2,
158 _S_ios_iostate_end = 1L << 16
162 operator&(_Ios_Iostate __a, _Ios_Iostate __b)
163 {
return _Ios_Iostate(static_cast<int>(__a) & static_cast<int>(__b)); }
166 operator|(_Ios_Iostate __a, _Ios_Iostate __b)
167 {
return _Ios_Iostate(static_cast<int>(__a) | static_cast<int>(__b)); }
170 operator^(_Ios_Iostate __a, _Ios_Iostate __b)
171 {
return _Ios_Iostate(static_cast<int>(__a) ^ static_cast<int>(__b)); }
174 operator|=(_Ios_Iostate& __a, _Ios_Iostate __b)
175 {
return __a = __a | __b; }
178 operator&=(_Ios_Iostate& __a, _Ios_Iostate __b)
179 {
return __a = __a & __b; }
182 operator^=(_Ios_Iostate& __a, _Ios_Iostate __b)
183 {
return __a = __a ^ __b; }
186 operator~(_Ios_Iostate __a)
187 {
return _Ios_Iostate(~static_cast<int>(__a)); }
192 _S_cur = _IOS_BASE_SEEK_CUR,
193 _S_end = _IOS_BASE_SEEK_END,
194 _S_ios_seekdir_end = 1L << 16
223 failure(
const string& __str)
throw();
231 what()
const throw();
269 static const fmtflags
dec = _S_dec;
272 static const fmtflags
fixed = _S_fixed;
275 static const fmtflags
hex = _S_hex;
280 static const fmtflags
internal = _S_internal;
284 static const fmtflags
left = _S_left;
287 static const fmtflags
oct = _S_oct;
291 static const fmtflags
right = _S_right;
308 static const fmtflags
skipws = _S_skipws;
318 static const fmtflags adjustfield = _S_adjustfield;
321 static const fmtflags basefield = _S_basefield;
324 static const fmtflags floatfield = _S_floatfield;
342 static const iostate badbit = _S_badbit;
345 static const iostate eofbit = _S_eofbit;
350 static const iostate failbit = _S_failbit;
353 static const iostate goodbit = _S_goodbit;
372 static const openmode app = _S_app;
375 static const openmode ate = _S_ate;
380 static const openmode binary = _S_bin;
383 static const openmode in = _S_in;
386 static const openmode out = _S_out;
389 static const openmode trunc = _S_trunc;
404 static const seekdir beg = _S_beg;
407 static const seekdir cur = _S_cur;
410 static const seekdir end = _S_end;
413 typedef int io_state;
414 typedef int open_mode;
415 typedef int seek_dir;
457 register_callback(event_callback __fn,
int __index);
473 struct _Callback_list
476 _Callback_list* _M_next;
477 ios_base::event_callback _M_fn;
479 _Atomic_word _M_refcount;
481 _Callback_list(ios_base::event_callback __fn,
int __index,
482 _Callback_list* __cb)
483 : _M_next(__cb), _M_fn(__fn), _M_index(__index), _M_refcount(0) { }
486 _M_add_reference() { __gnu_cxx::__atomic_add_dispatch(&_M_refcount, 1); }
490 _M_remove_reference()
491 {
return __gnu_cxx::__exchange_and_add_dispatch(&_M_refcount, -1); }
494 _Callback_list* _M_callbacks;
497 _M_call_callbacks(event __ev)
throw();
500 _M_dispose_callbacks(
void);
507 _Words() : _M_pword(0), _M_iword(0) { }
515 enum { _S_local_word_size = 8 };
516 _Words _M_local_word[_S_local_word_size];
523 _M_grow_words(
int __index,
bool __iword);
526 locale _M_ios_locale;
539 friend class ios_base;
545 static _Atomic_word _S_refcount;
546 static bool _S_synced_with_stdio;
568 fmtflags __old = _M_flags;
584 fmtflags __old = _M_flags;
599 setf(fmtflags __fmtfl, fmtflags __mask)
601 fmtflags __old = _M_flags;
603 _M_flags |= (__fmtfl & __mask);
615 { _M_flags &= ~__mask; }
626 {
return _M_precision; }
637 _M_precision = __prec;
676 sync_with_stdio(
bool __sync =
true);
688 imbue(
const locale& __loc);
700 {
return _M_ios_locale; }
711 {
return _M_ios_locale; }
747 _Words& __word = (__ix < _M_word_size)
748 ? _M_word[__ix] : _M_grow_words(__ix,
true);
749 return __word._M_iword;
768 _Words& __word = (__ix < _M_word_size)
769 ? _M_word[__ix] : _M_grow_words(__ix,
false);
770 return __word._M_pword;
790 ios_base(
const ios_base&);
793 operator=(
const ios_base&);
912 internal(ios_base& __base)
976 _GLIBCXX_END_NAMESPACE
978 #undef _IOS_BASE_SEEK_CUR
979 #undef _IOS_BASE_SEEK_END
ios_base & right(ios_base &__base)
Calls base.setf(ios_base::right, ios_base::adjustfield).
ios_base & internal(ios_base &__base)
Calls base.setf(ios_base::internal, ios_base::adjustfield).
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).
fmtflags flags() const
Access to format flags.
fmtflags setf(fmtflags __fmtfl)
Setting new format flags.
ios_base & noboolalpha(ios_base &__base)
Calls base.unsetf(ios_base::boolalpha).
fmtflags setf(fmtflags __fmtfl, fmtflags __mask)
Setting new format flags.
ISO C++ entities toplevel namespace is std.
long long streamoff
Type used by fpos, char_traits, and char_traits.
streamsize precision() const
Flags access.
ios_base & dec(ios_base &__base)
Calls base.setf(ios_base::dec, ios_base::basefield).
ios_base & showpos(ios_base &__base)
Calls base.setf(ios_base::showpos).
ios_base & uppercase(ios_base &__base)
Calls base.setf(ios_base::uppercase).
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.
void *& pword(int __ix)
Access to void pointer array.
ios_base & boolalpha(ios_base &__base)
Calls base.setf(ios_base::boolalpha).
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
Container class for localization functionality.
_Ios_Fmtflags fmtflags
This is a bitmask type.
streamsize width(streamsize __wide)
Changing flags.
ios_base & nounitbuf(ios_base &__base)
Calls base.unsetf(ios_base::unitbuf).
ios_base & fixed(ios_base &__base)
Calls base.setf(ios_base::fixed, ios_base::floatfield).
ios_base & showbase(ios_base &__base)
Calls base.setf(ios_base::showbase).
locale getloc() const
Locale access.
ios_base & noshowpoint(ios_base &__base)
Calls base.unsetf(ios_base::showpoint).
fpos< mbstate_t > streampos
File position for char streams.
const locale & _M_getloc() const
Locale access.
_Ios_Seekdir seekdir
This is an enumerated type.
These are thrown to indicate problems with io.27.4.2.1.1 Class ios_base::failure. ...
ios_base & showpoint(ios_base &__base)
Calls base.setf(ios_base::showpoint).
ios_base & unitbuf(ios_base &__base)
Calls base.setf(ios_base::unitbuf).
Class representing stream positions.
ios_base & scientific(ios_base &__base)
Calls base.setf(ios_base::scientific, ios_base::floatfield).
event
The set of events that may be passed to an event callback.
void unsetf(fmtflags __mask)
Clearing format flags.
fmtflags flags(fmtflags __fmtfl)
Setting new format flags all at once.
_Ios_Iostate iostate
This is a bitmask type.
streamsize width() const
Flags access.
iostate _M_streambuf_state
The base of the I/O class hierarchy.This class defines everything that can be defined about I/O that ...
ios_base & hex(ios_base &__base)
Calls base.setf(ios_base::hex, ios_base::basefield).
ios_base & skipws(ios_base &__base)
Calls base.setf(ios_base::skipws).
ios_base & oct(ios_base &__base)
Calls base.setf(ios_base::oct, ios_base::basefield).
streamsize precision(streamsize __prec)
Changing flags.
_Ios_Openmode openmode
This is a bitmask type.