30 #ifndef _OSTREAM_INSERT_H
31 #define _OSTREAM_INSERT_H 1
33 #pragma GCC system_header
39 namespace std _GLIBCXX_VISIBILITY(default)
41 _GLIBCXX_BEGIN_NAMESPACE_VERSION
43 template<
typename _CharT,
typename _Traits>
45 __ostream_write(basic_ostream<_CharT, _Traits>& __out,
48 typedef basic_ostream<_CharT, _Traits> __ostream_type;
49 typedef typename __ostream_type::ios_base __ios_base;
51 const streamsize __put = __out.rdbuf()->sputn(__s, __n);
53 __out.setstate(__ios_base::badbit);
56 template<
typename _CharT,
typename _Traits>
58 __ostream_fill(basic_ostream<_CharT, _Traits>& __out,
streamsize __n)
60 typedef basic_ostream<_CharT, _Traits> __ostream_type;
61 typedef typename __ostream_type::ios_base __ios_base;
63 const _CharT __c = __out.fill();
64 for (; __n > 0; --__n)
66 const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c);
67 if (_Traits::eq_int_type(__put, _Traits::eof()))
69 __out.setstate(__ios_base::badbit);
75 template<
typename _CharT,
typename _Traits>
76 basic_ostream<_CharT, _Traits>&
77 __ostream_insert(basic_ostream<_CharT, _Traits>& __out,
80 typedef basic_ostream<_CharT, _Traits> __ostream_type;
81 typedef typename __ostream_type::ios_base __ios_base;
83 typename __ostream_type::sentry __cerb(__out);
91 const bool __left = ((__out.flags()
92 & __ios_base::adjustfield)
95 __ostream_fill(__out, __w - __n);
97 __ostream_write(__out, __s, __n);
98 if (__left && __out.good())
99 __ostream_fill(__out, __w - __n);
102 __ostream_write(__out, __s, __n);
107 __out._M_setstate(__ios_base::badbit);
108 __throw_exception_again;
111 { __out._M_setstate(__ios_base::badbit); }
118 #if _GLIBCXX_EXTERN_TEMPLATE
121 #ifdef _GLIBCXX_USE_WCHAR_T
127 _GLIBCXX_END_NAMESPACE_VERSION
basic_ostream< char > ostream
Base class for char output streams.
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
Thrown as part of forced unwinding.