⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 istream.tcc

📁 俄罗斯高人Mamaich的Pocket gcc编译器(运行在PocketPC上)的全部源代码。
💻 TCC
📖 第 1 页 / 共 3 页
字号:
	  try 	    {	      _M_check_facet(this->_M_fnumget);	      const __numget_type& __ng = *this->_M_fnumget;	      __ng.get(*this, 0, *this, __err, __n);	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}      return *this;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&     basic_istream<_CharT, _Traits>::    operator>>(void*& __n)    {      sentry __cerb(*this, false);      if (__cerb) 	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      _M_check_facet(this->_M_fnumget);	      const __numget_type& __ng = *this->_M_fnumget;	      __ng.get(*this, 0, *this, __err, __n);	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}      return *this;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&     basic_istream<_CharT, _Traits>::    operator>>(__streambuf_type* __sbout)    {      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, false);      if (__cerb && __sbout)	{	  try	    {	      if (!__copy_streambufs(*this, this->rdbuf(), __sbout))		__err |= ios_base::failbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::failbit); }	}      else if (!__sbout)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return *this;    }  template<typename _CharT, typename _Traits>    typename basic_istream<_CharT, _Traits>::int_type    basic_istream<_CharT, _Traits>::    get(void)    {      const int_type __eof = traits_type::eof();      int_type __c = __eof;      _M_gcount = 0;      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, true);      if (__cerb) 	{	  try 	    {	      __c = this->rdbuf()->sbumpc();	      // 27.6.1.1 paragraph 3	      if (!traits_type::eq_int_type(__c, __eof))		_M_gcount = 1;	      else		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	}      if (!_M_gcount)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return __c;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    get(char_type& __c)    {      _M_gcount = 0;      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, true);      if (__cerb) 	{ 	  try 	    {	      int_type __cb = this->rdbuf()->sbumpc();	      // 27.6.1.1 paragraph 3	      if (!traits_type::eq_int_type(__cb, traits_type::eof()))		{		  _M_gcount = 1;		  __c = traits_type::to_char_type(__cb);		}	      else		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	}      if (!_M_gcount)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return *this;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    get(char_type* __s, streamsize __n, char_type __delim)    {      _M_gcount = 0;      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, true);      if (__cerb) 	{	  try 	    {	      const int_type __idelim = traits_type::to_int_type(__delim);	      const int_type __eof = traits_type::eof();	      __streambuf_type* __sb = this->rdbuf();	      int_type __c = __sb->sgetc();		      	      while (_M_gcount + 1 < __n 		     && !traits_type::eq_int_type(__c, __eof)		     && !traits_type::eq_int_type(__c, __idelim))		{		  *__s++ = traits_type::to_char_type(__c);		  __c = __sb->snextc();		  ++_M_gcount;		}	      if (traits_type::eq_int_type(__c, __eof))		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	}      *__s = char_type();      if (!_M_gcount)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return *this;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    get(__streambuf_type& __sb, char_type __delim)    {      _M_gcount = 0;      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, true);      if (__cerb) 	{	  try 	    {	      const int_type __idelim = traits_type::to_int_type(__delim);	      const int_type __eof = traits_type::eof();	      	      __streambuf_type* __this_sb = this->rdbuf();	      int_type __c = __this_sb->sgetc();	      char_type __c2 = traits_type::to_char_type(__c);	      	      while (!traits_type::eq_int_type(__c, __eof) 		     && !traits_type::eq_int_type(__c, __idelim) 		     && !traits_type::eq_int_type(__sb.sputc(__c2), __eof))		{		  ++_M_gcount;		  __c = __this_sb->snextc();		  __c2 = traits_type::to_char_type(__c);		}	      if (traits_type::eq_int_type(__c, __eof))		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	}      if (!_M_gcount)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return *this;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    getline(char_type* __s, streamsize __n, char_type __delim)    {      _M_gcount = 0;      ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);      sentry __cerb(*this, true);      if (__cerb) 	{          try 	    {	      const int_type __idelim = traits_type::to_int_type(__delim);	      const int_type __eof = traits_type::eof();	      __streambuf_type* __sb = this->rdbuf();	      int_type __c = __sb->sgetc();	    	      while (_M_gcount + 1 < __n 		     && !traits_type::eq_int_type(__c, __eof)		     && !traits_type::eq_int_type(__c, __idelim))		{		  *__s++ = traits_type::to_char_type(__c);		  __c = __sb->snextc();		  ++_M_gcount;		}	      if (traits_type::eq_int_type(__c, __eof))		__err |= ios_base::eofbit;	      else		{		  if (traits_type::eq_int_type(__c, __idelim))		    {		      __sb->sbumpc();		      ++_M_gcount;		    }		  else		    __err |= ios_base::failbit;		}	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	}      *__s = char_type();      if (!_M_gcount)	__err |= ios_base::failbit;      if (__err)	this->setstate(__err);      return *this;    }    template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    ignore(streamsize __n, int_type __delim)    {      _M_gcount = 0;      sentry __cerb(*this, true);      if (__cerb && __n > 0) 	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      const int_type __eof = traits_type::eof();	      __streambuf_type* __sb = this->rdbuf();	      int_type __c;	      	      __n = min(__n, numeric_limits<streamsize>::max());	      while (_M_gcount < __n  		     && !traits_type::eq_int_type(__c = __sb->sbumpc(), __eof))		{		  ++_M_gcount;		  if (traits_type::eq_int_type(__c, __delim))		    break;		}	      if (traits_type::eq_int_type(__c, __eof))		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}      return *this;    }    template<typename _CharT, typename _Traits>    typename basic_istream<_CharT, _Traits>::int_type    basic_istream<_CharT, _Traits>::    peek(void)    {      int_type __c = traits_type::eof();      _M_gcount = 0;      sentry __cerb(*this, true);      if (__cerb)	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      __c = this->rdbuf()->sgetc();	      if (traits_type::eq_int_type(__c, traits_type::eof()))		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}        return __c;    }  template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    read(char_type* __s, streamsize __n)    {      _M_gcount = 0;      sentry __cerb(*this, true);      if (__cerb) 	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      _M_gcount = this->rdbuf()->sgetn(__s, __n);	      if (_M_gcount != __n)		__err |= (ios_base::eofbit | ios_base::failbit);	    }	    	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}      return *this;    }    template<typename _CharT, typename _Traits>    streamsize     basic_istream<_CharT, _Traits>::    readsome(char_type* __s, streamsize __n)    {      _M_gcount = 0;      sentry __cerb(*this, true);      if (__cerb) 	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      // Cannot compare int_type with streamsize generically.	      streamsize __num = this->rdbuf()->in_avail();	      if (__num >= 0)		{		  __num = min(__num, __n);		  if (__num)		    _M_gcount = this->rdbuf()->sgetn(__s, __num);		}	      else		__err |= ios_base::eofbit;	    }	  catch(...)	    { this->_M_setstate(ios_base::badbit); }	  if (__err)	    this->setstate(__err);	}      return _M_gcount;    }        template<typename _CharT, typename _Traits>    basic_istream<_CharT, _Traits>&    basic_istream<_CharT, _Traits>::    putback(char_type __c)    {#ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS// 60. What is a formatted input function?      _M_gcount = 0;#endif      sentry __cerb(*this, true);      if (__cerb) 	{	  ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);	  try 	    {	      const int_type __eof = traits_type::eof();	      __streambuf_type* __sb = this->rdbuf();	      if (!__sb 		  || traits_type::eq_int_type(__sb->sputbackc(__c), __eof))		__err |= ios_base::badbit;	    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -