37 #define _ISTREAM_TCC 1
39 #pragma GCC system_header
41 #include <cxxabi-forced.h>
43 _GLIBCXX_BEGIN_NAMESPACE(std)
45 template<typename _CharT, typename _Traits>
46 basic_istream<_CharT, _Traits>::sentry::
49 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
56 const __int_type __eof = traits_type::eof();
58 __int_type __c = __sb->
sgetc();
61 while (!traits_type::eq_int_type(__c, __eof)
62 && __ct.
is(ctype_base::space,
63 traits_type::to_char_type(__c)))
69 if (traits_type::eq_int_type(__c, __eof))
70 __err |= ios_base::eofbit;
74 if (__in.good() && __err == ios_base::goodbit)
78 __err |= ios_base::failbit;
83 template<
typename _CharT,
typename _Traits>
84 template<
typename _ValueT>
89 sentry __cerb(*
this,
false);
92 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
96 __ng.
get(*
this, 0, *
this, __err, __v);
100 this->_M_setstate(ios_base::badbit);
101 __throw_exception_again;
104 { this->_M_setstate(ios_base::badbit); }
106 this->setstate(__err);
111 template<
typename _CharT,
typename _Traits>
112 basic_istream<_CharT, _Traits>&
122 if (__gnu_cxx::__numeric_traits<short>::__min <= __l
123 && __l <= __gnu_cxx::__numeric_traits<short>::__max)
126 this->setstate(ios_base::failbit);
131 template<
typename _CharT,
typename _Traits>
142 if (__gnu_cxx::__numeric_traits<int>::__min <= __l
143 && __l <= __gnu_cxx::__numeric_traits<int>::__max)
146 this->setstate(ios_base::failbit);
151 template<
typename _CharT,
typename _Traits>
156 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
157 sentry __cerb(*
this,
false);
158 if (__cerb && __sbout)
163 if (!__copy_streambufs_eof(this->rdbuf(), __sbout, __ineof))
164 __err |= ios_base::failbit;
166 __err |= ios_base::eofbit;
170 this->_M_setstate(ios_base::failbit);
171 __throw_exception_again;
174 { this->_M_setstate(ios_base::failbit); }
177 __err |= ios_base::failbit;
179 this->setstate(__err);
183 template<
typename _CharT,
typename _Traits>
188 const int_type __eof = traits_type::eof();
191 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
192 sentry __cerb(*
this,
true);
197 __c = this->rdbuf()->sbumpc();
199 if (!traits_type::eq_int_type(__c, __eof))
202 __err |= ios_base::eofbit;
206 this->_M_setstate(ios_base::badbit);
207 __throw_exception_again;
210 { this->_M_setstate(ios_base::badbit); }
213 __err |= ios_base::failbit;
215 this->setstate(__err);
219 template<
typename _CharT,
typename _Traits>
225 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
226 sentry __cerb(*
this,
true);
231 const int_type __cb = this->rdbuf()->sbumpc();
233 if (!traits_type::eq_int_type(__cb, traits_type::eof()))
236 __c = traits_type::to_char_type(__cb);
239 __err |= ios_base::eofbit;
243 this->_M_setstate(ios_base::badbit);
244 __throw_exception_again;
247 { this->_M_setstate(ios_base::badbit); }
250 __err |= ios_base::failbit;
252 this->setstate(__err);
256 template<
typename _CharT,
typename _Traits>
262 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
263 sentry __cerb(*
this,
true);
268 const int_type __idelim = traits_type::to_int_type(__delim);
269 const int_type __eof = traits_type::eof();
273 while (_M_gcount + 1 < __n
274 && !traits_type::eq_int_type(__c, __eof)
275 && !traits_type::eq_int_type(__c, __idelim))
277 *__s++ = traits_type::to_char_type(__c);
281 if (traits_type::eq_int_type(__c, __eof))
282 __err |= ios_base::eofbit;
286 this->_M_setstate(ios_base::badbit);
287 __throw_exception_again;
290 { this->_M_setstate(ios_base::badbit); }
297 __err |= ios_base::failbit;
299 this->setstate(__err);
303 template<
typename _CharT,
typename _Traits>
309 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
310 sentry __cerb(*
this,
true);
315 const int_type __idelim = traits_type::to_int_type(__delim);
316 const int_type __eof = traits_type::eof();
319 char_type __c2 = traits_type::to_char_type(__c);
321 while (!traits_type::eq_int_type(__c, __eof)
322 && !traits_type::eq_int_type(__c, __idelim)
323 && !traits_type::eq_int_type(__sb.
sputc(__c2), __eof))
326 __c = __this_sb->
snextc();
327 __c2 = traits_type::to_char_type(__c);
329 if (traits_type::eq_int_type(__c, __eof))
330 __err |= ios_base::eofbit;
334 this->_M_setstate(ios_base::badbit);
335 __throw_exception_again;
338 { this->_M_setstate(ios_base::badbit); }
341 __err |= ios_base::failbit;
343 this->setstate(__err);
347 template<
typename _CharT,
typename _Traits>
353 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
354 sentry __cerb(*
this,
true);
359 const int_type __idelim = traits_type::to_int_type(__delim);
360 const int_type __eof = traits_type::eof();
364 while (_M_gcount + 1 < __n
365 && !traits_type::eq_int_type(__c, __eof)
366 && !traits_type::eq_int_type(__c, __idelim))
368 *__s++ = traits_type::to_char_type(__c);
372 if (traits_type::eq_int_type(__c, __eof))
373 __err |= ios_base::eofbit;
376 if (traits_type::eq_int_type(__c, __idelim))
382 __err |= ios_base::failbit;
387 this->_M_setstate(ios_base::badbit);
388 __throw_exception_again;
391 { this->_M_setstate(ios_base::badbit); }
398 __err |= ios_base::failbit;
400 this->setstate(__err);
407 template<
typename _CharT,
typename _Traits>
413 sentry __cerb(*
this,
true);
416 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
419 const int_type __eof = traits_type::eof();
422 if (traits_type::eq_int_type(__sb->
sbumpc(), __eof))
423 __err |= ios_base::eofbit;
429 this->_M_setstate(ios_base::badbit);
430 __throw_exception_again;
433 { this->_M_setstate(ios_base::badbit); }
435 this->setstate(__err);
440 template<
typename _CharT,
typename _Traits>
446 sentry __cerb(*
this,
true);
447 if (__cerb && __n > 0)
449 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
452 const int_type __eof = traits_type::eof();
463 bool __large_ignore =
false;
466 while (_M_gcount < __n
467 && !traits_type::eq_int_type(__c, __eof))
472 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
473 && !traits_type::eq_int_type(__c, __eof))
476 __gnu_cxx::__numeric_traits<streamsize>::__min;
477 __large_ignore =
true;
484 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
486 if (traits_type::eq_int_type(__c, __eof))
487 __err |= ios_base::eofbit;
491 this->_M_setstate(ios_base::badbit);
492 __throw_exception_again;
495 { this->_M_setstate(ios_base::badbit); }
497 this->setstate(__err);
502 template<
typename _CharT,
typename _Traits>
508 sentry __cerb(*
this,
true);
509 if (__cerb && __n > 0)
511 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
514 const int_type __eof = traits_type::eof();
519 bool __large_ignore =
false;
522 while (_M_gcount < __n
523 && !traits_type::eq_int_type(__c, __eof)
524 && !traits_type::eq_int_type(__c, __delim))
529 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
530 && !traits_type::eq_int_type(__c, __eof)
531 && !traits_type::eq_int_type(__c, __delim))
534 __gnu_cxx::__numeric_traits<streamsize>::__min;
535 __large_ignore =
true;
542 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
544 if (traits_type::eq_int_type(__c, __eof))
545 __err |= ios_base::eofbit;
546 else if (traits_type::eq_int_type(__c, __delim))
549 < __gnu_cxx::__numeric_traits<streamsize>::__max)
556 this->_M_setstate(ios_base::badbit);
557 __throw_exception_again;
560 { this->_M_setstate(ios_base::badbit); }
562 this->setstate(__err);
567 template<
typename _CharT,
typename _Traits>
574 sentry __cerb(*
this,
true);
577 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
580 __c = this->rdbuf()->sgetc();
581 if (traits_type::eq_int_type(__c, traits_type::eof()))
582 __err |= ios_base::eofbit;
586 this->_M_setstate(ios_base::badbit);
587 __throw_exception_again;
590 { this->_M_setstate(ios_base::badbit); }
592 this->setstate(__err);
597 template<
typename _CharT,
typename _Traits>
603 sentry __cerb(*
this,
true);
606 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
609 _M_gcount = this->rdbuf()->sgetn(__s, __n);
610 if (_M_gcount != __n)
611 __err |= (ios_base::eofbit | ios_base::failbit);
615 this->_M_setstate(ios_base::badbit);
616 __throw_exception_again;
619 { this->_M_setstate(ios_base::badbit); }
621 this->setstate(__err);
626 template<
typename _CharT,
typename _Traits>
632 sentry __cerb(*
this,
true);
635 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
639 const streamsize __num = this->rdbuf()->in_avail();
641 _M_gcount = this->rdbuf()->sgetn(__s,
std::min(__num, __n));
642 else if (__num == -1)
643 __err |= ios_base::eofbit;
647 this->_M_setstate(ios_base::badbit);
648 __throw_exception_again;
651 { this->_M_setstate(ios_base::badbit); }
653 this->setstate(__err);
658 template<
typename _CharT,
typename _Traits>
666 sentry __cerb(*
this,
true);
669 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
672 const int_type __eof = traits_type::eof();
675 || traits_type::eq_int_type(__sb->
sputbackc(__c), __eof))
676 __err |= ios_base::badbit;
680 this->_M_setstate(ios_base::badbit);
681 __throw_exception_again;
684 { this->_M_setstate(ios_base::badbit); }
686 this->setstate(__err);
691 template<
typename _CharT,
typename _Traits>
699 sentry __cerb(*
this,
true);
702 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
705 const int_type __eof = traits_type::eof();
708 || traits_type::eq_int_type(__sb->
sungetc(), __eof))
709 __err |= ios_base::badbit;
713 this->_M_setstate(ios_base::badbit);
714 __throw_exception_again;
717 { this->_M_setstate(ios_base::badbit); }
719 this->setstate(__err);
724 template<
typename _CharT,
typename _Traits>
732 sentry __cerb(*
this,
true);
735 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
742 __err |= ios_base::badbit;
749 this->_M_setstate(ios_base::badbit);
750 __throw_exception_again;
753 { this->_M_setstate(ios_base::badbit); }
755 this->setstate(__err);
760 template<
typename _CharT,
typename _Traits>
771 __ret = this->rdbuf()->pubseekoff(0, ios_base::cur,
776 this->_M_setstate(ios_base::badbit);
777 __throw_exception_again;
780 { this->_M_setstate(ios_base::badbit); }
784 template<
typename _CharT,
typename _Traits>
791 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
797 const pos_type __p = this->rdbuf()->pubseekpos(__pos,
802 __err |= ios_base::failbit;
807 this->_M_setstate(ios_base::badbit);
808 __throw_exception_again;
811 { this->_M_setstate(ios_base::badbit); }
813 this->setstate(__err);
817 template<
typename _CharT,
typename _Traits>
824 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
830 const pos_type __p = this->rdbuf()->pubseekoff(__off, __dir,
835 __err |= ios_base::failbit;
840 this->_M_setstate(ios_base::badbit);
841 __throw_exception_again;
844 { this->_M_setstate(ios_base::badbit); }
846 this->setstate(__err);
851 template<
typename _CharT,
typename _Traits>
856 typedef typename __istream_type::int_type __int_type;
858 typename __istream_type::sentry __cerb(__in,
false);
861 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
864 const __int_type __cb = __in.
rdbuf()->sbumpc();
865 if (!_Traits::eq_int_type(__cb, _Traits::eof()))
866 __c = _Traits::to_char_type(__cb);
868 __err |= (ios_base::eofbit | ios_base::failbit);
872 __in._M_setstate(ios_base::badbit);
873 __throw_exception_again;
876 { __in._M_setstate(ios_base::badbit); }
883 template<
typename _CharT,
typename _Traits>
884 basic_istream<_CharT, _Traits>&
889 typedef typename _Traits::int_type int_type;
890 typedef _CharT char_type;
894 ios_base::iostate __err = ios_base::iostate(ios_base::goodbit);
895 typename __istream_type::sentry __cerb(__in,
false);
903 __num = __gnu_cxx::__numeric_traits<streamsize>::__max;
905 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
907 const int_type __eof = _Traits::eof();
908 __streambuf_type* __sb = __in.
rdbuf();
909 int_type __c = __sb->sgetc();
911 while (__extracted < __num - 1
912 && !_Traits::eq_int_type(__c, __eof)
913 && !__ct.is(ctype_base::space,
914 _Traits::to_char_type(__c)))
916 *__s++ = _Traits::to_char_type(__c);
918 __c = __sb->snextc();
920 if (_Traits::eq_int_type(__c, __eof))
921 __err |= ios_base::eofbit;
930 __in._M_setstate(ios_base::badbit);
931 __throw_exception_again;
934 { __in._M_setstate(ios_base::badbit); }
937 __err |= ios_base::failbit;
944 template<
typename _CharT,
typename _Traits>
945 basic_istream<_CharT, _Traits>&
950 typedef typename __istream_type::int_type __int_type;
953 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
954 const __int_type __eof = _Traits::eof();
955 __streambuf_type* __sb = __in.
rdbuf();
956 __int_type __c = __sb->sgetc();
958 while (!_Traits::eq_int_type(__c, __eof)
959 && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))
960 __c = __sb->snextc();
962 if (_Traits::eq_int_type(__c, __eof))
970 #if _GLIBCXX_EXTERN_TEMPLATE
971 extern template class basic_istream<char>;
980 extern template istream& istream::_M_extract(
unsigned short&);
981 extern template istream& istream::_M_extract(
unsigned int&);
982 extern template istream& istream::_M_extract(
long&);
983 extern template istream& istream::_M_extract(
unsigned long&);
984 extern template istream& istream::_M_extract(
bool&);
985 #ifdef _GLIBCXX_USE_LONG_LONG
986 extern template istream& istream::_M_extract(
long long&);
987 extern template istream& istream::_M_extract(
unsigned long long&);
989 extern template istream& istream::_M_extract(
float&);
990 extern template istream& istream::_M_extract(
double&);
991 extern template istream& istream::_M_extract(
long double&);
992 extern template istream& istream::_M_extract(
void*&);
994 extern template class basic_iostream<char>;
996 #ifdef _GLIBCXX_USE_WCHAR_T
997 extern template class basic_istream<wchar_t>;
1002 extern template wistream& wistream::_M_extract(
unsigned short&);
1003 extern template wistream& wistream::_M_extract(
unsigned int&);
1004 extern template wistream& wistream::_M_extract(
long&);
1005 extern template wistream& wistream::_M_extract(
unsigned long&);
1006 extern template wistream& wistream::_M_extract(
bool&);
1007 #ifdef _GLIBCXX_USE_LONG_LONG
1008 extern template wistream& wistream::_M_extract(
long long&);
1009 extern template wistream& wistream::_M_extract(
unsigned long long&);
1011 extern template wistream& wistream::_M_extract(
float&);
1012 extern template wistream& wistream::_M_extract(
double&);
1013 extern template wistream& wistream::_M_extract(
long double&);
1014 extern template wistream& wistream::_M_extract(
void*&);
1016 extern template class basic_iostream<wchar_t>;
1020 _GLIBCXX_END_NAMESPACE