basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::get(_CharT& __c) { sentry __sentry(*this, _No_Skip_WS()); this->_M_gcount = 0; if (__sentry) { typename _Traits::int_type __tmp = _Traits::eof(); _STLP_TRY { __tmp = this->rdbuf()->sbumpc(); } _STLP_CATCH_ALL { this->_M_handle_exception(ios_base::badbit); } if (!this->_S_eof(__tmp)) { this->_M_gcount = 1; __c = _Traits::to_char_type(__tmp); } } if (this->_M_gcount == 0) this->setstate(ios_base::eofbit | ios_base::failbit); return *this; }
basic_istream<_CharT, _Traits>& _STLP_CALL ws(basic_istream<_CharT, _Traits>& __is) { typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; _Sentry __sentry(__is, _No_Skip_WS()); // Don't skip whitespace. if (__sentry) __is._M_skip_whitespace(false); return __is; }
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<_CharT, _Traits>* __from) { sentry __sentry(*this); if (__sentry) { if (__from) { bool __any_inserted = __from->gptr() != __from->egptr() ? this->_M_copy_buffered(__from, this->rdbuf()) : this->_M_copy_unbuffered(__from, this->rdbuf()); if (!__any_inserted) this->setstate(ios_base::failbit); } else this->setstate(ios_base::badbit); } return *this; }
ios_base::iostate _STLP_CALL _M_get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) { typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; ios_base::iostate __err = 0; _Sentry __sentry( __that ); // Skip whitespace. if (__sentry) { typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get; _STLP_TRY { ((const _Num_get&)use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()), 0, __that, __err, __val); } _STLP_CATCH_ALL { __that._M_handle_exception(ios_base::badbit); } if (__err) __that.setstate(__err); } return __err; }
__BIS_int_type__ basic_istream<_CharT, _Traits>::peek() { typename _Traits::int_type __tmp = _Traits::eof(); this->_M_gcount = 0; sentry __sentry(*this, _No_Skip_WS()); if (__sentry) { _STLP_TRY { __tmp = this->rdbuf()->sgetc(); } _STLP_CATCH_ALL { this->_M_handle_exception(ios_base::badbit); } if (this->_S_eof(__tmp)) this->setstate(ios_base::eofbit); } return __tmp; }
ios_base::iostate _STLP_CALL __get_num(basic_istream<_CharT, _Traits>& __that, _Number& __val) { typedef typename basic_istream<_CharT, _Traits>::sentry _Sentry; ios_base::iostate __err = 0; _Sentry __sentry( __that ); // Skip whitespace. if (__sentry) { typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > _Num_get; _STLP_TRY { // Do not remove additional parenthesis around use_facet instanciation, some compilers (VC6) // require it when building the library. (use_facet<_Num_get>(__that.getloc())).get(istreambuf_iterator<_CharT, _Traits>(__that.rdbuf()), 0, __that, __err, __val); } _STLP_CATCH_ALL { __that._M_handle_exception(ios_base::badbit); } if (__err) __that.setstate(__err); } return __err; }
basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::putback(_CharT __c) { this->_M_gcount = 0; sentry __sentry(*this, _No_Skip_WS()); if (__sentry) { typename _Traits::int_type __tmp = _Traits::eof(); basic_streambuf<_CharT, _Traits>* __buf = this->rdbuf(); // if (!__buf || this->_S_eof(__buf->sputbackc(__c))) if (__buf) { _STLP_TRY { __tmp = __buf->sputbackc(__c); } _STLP_CATCH_ALL { this->_M_handle_exception(ios_base::badbit); } } if (this->_S_eof(__tmp)) this->setstate(ios_base::badbit); } else this->setstate(ios_base::failbit);
basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>::ignore() { sentry __sentry(*this, _No_Skip_WS()); this->_M_gcount = 0; if (__sentry) { int_type __c; _STLP_TRY { __c = this->rdbuf()->sbumpc(); } _STLP_CATCH_ALL { this->_M_handle_exception(ios_base::badbit); return *this; } if (!this->_S_eof(__c)) this->_M_gcount = 1; else this->setstate(ios_base::eofbit); } return *this; }