33template<
class _CharT,
class _Traits>
34basic_ostream<_CharT, _Traits>&
35basic_ostream<_CharT, _Traits>::flush ()
41 const sentry __opfx (*
this);
48 __res = this->rdbuf ()->pubsync ();
51 this->setstate (ios_base::badbit | _RW::__rw_rethrow);
55 this->setstate (ios_base::badbit);
63template<
class _CharT,
class _Traits>
64basic_ostream<_CharT, _Traits>&
65basic_ostream<_CharT, _Traits>::seekp (pos_type __pos)
75 __res = this->rdbuf ()->pubseekpos (__pos, ios_base::out);
78 this->setstate (ios_base::badbit | _RW::__rw_rethrow);
81 this->setstate (ios_base::failbit);
88template<
class _CharT,
class _Traits>
89basic_ostream<_CharT, _Traits>&
90basic_ostream<_CharT, _Traits>::seekp (off_type __off, ios_base::seekdir __dir)
100 __res = this->rdbuf()->pubseekoff (__off, __dir, ios_base::out);
103 this->setstate (ios_base::badbit | _RW::__rw_rethrow);
107 this->setstate (ios_base::failbit);
114template<
class _CharT,
class _Traits>
115typename basic_ostream<_CharT, _Traits>::pos_type
116basic_ostream<_CharT, _Traits>::tellp ()
120 if (!this->
fail ()) {
124 return this->rdbuf()->pubseekoff (0, ios_base::cur, ios_base::out);
127 this->setstate (ios_base::badbit | _RW::__rw_rethrow);
131 return pos_type (off_type (-1));
135template<
class _CharT,
class _Traits>
136basic_ostream<_CharT, _Traits>&
137basic_ostream<_CharT, _Traits>::
138operator<< (basic_streambuf<char_type, traits_type> *__sb)
141 this->setstate (ios_base::badbit);
145 ios_base::iostate __err = ios_base::goodbit;
147 streamsize __nget = 0;
149 if (__sb->_C_mode () & ios_base::in) {
151 const sentry __opfx (*
this);
157 basic_streambuf<char_type, traits_type>*
const __rdbuf =
160 for (
const int_type __eof = traits_type::eof (); ; ++__nget) {
166 const streamsize __navail =
167 streamsize (__rdbuf->epptr () - __rdbuf->pptr ());
171 const streamsize __n =
172 __sb->sgetn (__rdbuf->pptr (), __navail);
175 __err = ios_base::failbit;
182 __rdbuf->pbump (__n);
189 int_type __c = __sb->sgetc ();
192 if (traits_type::eq_int_type (__eof, __c))
195 __c = __rdbuf->sputc (traits_type::to_char_type(__c));
197 if (traits_type::eq_int_type (__eof, __c)) {
198 __err = ios_base::failbit;
210 this->setstate (ios_base::badbit | _RW::__rw_rethrow);
215 __err |= ios_base::failbit;
218 this->setstate (__err);
224#ifdef _RWSTD_NO_UNDEFINED_TEMPLATES
226template <
class _CharT,
class _Traits>
227basic_ostream<_CharT, _Traits>::sentry::
228sentry (
const sentry &__rhs)
229 : _RW::__rw_guard (0),
230 _C_strm (__rhs._C_strm)
235template <
class _CharT,
class _Traits>
237basic_ostream<_CharT, _Traits>::sentry::
238operator= (
const sentry&)
#define _RWSTD_NAMESPACE(name)
#define _RWSTD_MT_GUARD(ignore)
#define _RWSTD_ASSERT(ignore)