30 #ifndef _OSTREAM_INSERT_H 31 #define _OSTREAM_INSERT_H 1 33 #pragma GCC system_header 38 namespace std _GLIBCXX_VISIBILITY(default)
40 _GLIBCXX_BEGIN_NAMESPACE_VERSION
42 template<
typename _CharT,
typename _Traits>
44 __ostream_write(basic_ostream<_CharT, _Traits>& __out,
47 typedef basic_ostream<_CharT, _Traits> __ostream_type;
48 typedef typename __ostream_type::ios_base __ios_base;
50 const streamsize __put = __out.rdbuf()->sputn(__s, __n);
52 __out.setstate(__ios_base::badbit);
55 template<
typename _CharT,
typename _Traits>
57 __ostream_fill(basic_ostream<_CharT, _Traits>& __out,
streamsize __n)
59 typedef basic_ostream<_CharT, _Traits> __ostream_type;
60 typedef typename __ostream_type::ios_base __ios_base;
62 const _CharT __c = __out.fill();
63 for (; __n > 0; --__n)
65 const typename _Traits::int_type __put = __out.rdbuf()->sputc(__c);
66 if (_Traits::eq_int_type(__put, _Traits::eof()))
68 __out.setstate(__ios_base::badbit);
74 template<
typename _CharT,
typename _Traits>
75 basic_ostream<_CharT, _Traits>&
76 __ostream_insert(basic_ostream<_CharT, _Traits>& __out,
79 typedef basic_ostream<_CharT, _Traits> __ostream_type;
80 typedef typename __ostream_type::ios_base __ios_base;
82 typename __ostream_type::sentry __cerb(__out);
90 const bool __left = ((__out.flags()
91 & __ios_base::adjustfield)
94 __ostream_fill(__out, __w - __n);
96 __ostream_write(__out, __s, __n);
97 if (__left && __out.good())
98 __ostream_fill(__out, __w - __n);
101 __ostream_write(__out, __s, __n);
106 __out._M_setstate(__ios_base::badbit);
107 __throw_exception_again;
110 { __out._M_setstate(__ios_base::badbit); }
117 #if _GLIBCXX_EXTERN_TEMPLATE 120 #ifdef _GLIBCXX_USE_WCHAR_T 126 _GLIBCXX_END_NAMESPACE_VERSION
basic_ostream< char > ostream
Base class for char output streams.
ios_base & left(ios_base &__base)
Calls base.setf(ios_base::left, ios_base::adjustfield).
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
Thrown as part of forced unwinding.A magic placeholder class that can be caught by reference to recog...
basic_ostream< wchar_t > wostream
Base class for wchar_t output streams.