35 #define _ISTREAM_TCC 1
37 #pragma GCC system_header
41 namespace std _GLIBCXX_VISIBILITY(default)
43 _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _CharT,
typename _Traits>
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))
83 template<
typename _CharT,
typename _Traits>
84 template<
typename _ValueT>
89 sentry __cerb(*
this,
false);
96 __ng.
get(*
this, 0, *
this, __err, __v);
101 __throw_exception_again;
111 template<
typename _CharT,
typename _Traits>
112 basic_istream<_CharT, _Traits>&
118 sentry __cerb(*
this,
false);
126 __ng.
get(*
this, 0, *
this, __err, __l);
130 if (__l < __gnu_cxx::__numeric_traits<short>::__min)
133 __n = __gnu_cxx::__numeric_traits<short>::__min;
135 else if (__l > __gnu_cxx::__numeric_traits<short>::__max)
138 __n = __gnu_cxx::__numeric_traits<short>::__max;
146 __throw_exception_again;
156 template<
typename _CharT,
typename _Traits>
163 sentry __cerb(*
this,
false);
171 __ng.
get(*
this, 0, *
this, __err, __l);
175 if (__l < __gnu_cxx::__numeric_traits<int>::__min)
178 __n = __gnu_cxx::__numeric_traits<int>::__min;
180 else if (__l > __gnu_cxx::__numeric_traits<int>::__max)
183 __n = __gnu_cxx::__numeric_traits<int>::__max;
191 __throw_exception_again;
201 template<
typename _CharT,
typename _Traits>
207 sentry __cerb(*
this,
false);
208 if (__cerb && __sbout)
213 if (!__copy_streambufs_eof(this->
rdbuf(), __sbout, __ineof))
221 __throw_exception_again;
233 template<
typename _CharT,
typename _Traits>
234 typename basic_istream<_CharT, _Traits>::int_type
238 const int_type __eof = traits_type::eof();
239 int_type __c = __eof;
242 sentry __cerb(*
this,
true);
247 __c = this->
rdbuf()->sbumpc();
249 if (!traits_type::eq_int_type(__c, __eof))
257 __throw_exception_again;
269 template<
typename _CharT,
typename _Traits>
276 sentry __cerb(*
this,
true);
281 const int_type __cb = this->
rdbuf()->sbumpc();
283 if (!traits_type::eq_int_type(__cb, traits_type::eof()))
286 __c = traits_type::to_char_type(__cb);
294 __throw_exception_again;
306 template<
typename _CharT,
typename _Traits>
313 sentry __cerb(*
this,
true);
318 const int_type __idelim = traits_type::to_int_type(__delim);
319 const int_type __eof = traits_type::eof();
321 int_type __c = __sb->
sgetc();
324 && !traits_type::eq_int_type(__c, __eof)
325 && !traits_type::eq_int_type(__c, __idelim))
327 *__s++ = traits_type::to_char_type(__c);
331 if (traits_type::eq_int_type(__c, __eof))
337 __throw_exception_again;
353 template<
typename _CharT,
typename _Traits>
360 sentry __cerb(*
this,
true);
365 const int_type __idelim = traits_type::to_int_type(__delim);
366 const int_type __eof = traits_type::eof();
368 int_type __c = __this_sb->
sgetc();
369 char_type __c2 = traits_type::to_char_type(__c);
371 while (!traits_type::eq_int_type(__c, __eof)
372 && !traits_type::eq_int_type(__c, __idelim)
373 && !traits_type::eq_int_type(__sb.
sputc(__c2), __eof))
376 __c = __this_sb->
snextc();
377 __c2 = traits_type::to_char_type(__c);
379 if (traits_type::eq_int_type(__c, __eof))
385 __throw_exception_again;
397 template<
typename _CharT,
typename _Traits>
404 sentry __cerb(*
this,
true);
409 const int_type __idelim = traits_type::to_int_type(__delim);
410 const int_type __eof = traits_type::eof();
412 int_type __c = __sb->
sgetc();
415 && !traits_type::eq_int_type(__c, __eof)
416 && !traits_type::eq_int_type(__c, __idelim))
418 *__s++ = traits_type::to_char_type(__c);
422 if (traits_type::eq_int_type(__c, __eof))
426 if (traits_type::eq_int_type(__c, __idelim))
438 __throw_exception_again;
457 template<
typename _CharT,
typename _Traits>
463 sentry __cerb(*
this,
true);
469 const int_type __eof = traits_type::eof();
472 if (traits_type::eq_int_type(__sb->
sbumpc(), __eof))
480 __throw_exception_again;
490 template<
typename _CharT,
typename _Traits>
496 sentry __cerb(*
this,
true);
497 if (__cerb && __n > 0)
502 const int_type __eof = traits_type::eof();
504 int_type __c = __sb->
sgetc();
513 bool __large_ignore =
false;
517 && !traits_type::eq_int_type(__c, __eof))
522 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
523 && !traits_type::eq_int_type(__c, __eof))
526 __gnu_cxx::__numeric_traits<streamsize>::__min;
527 __large_ignore =
true;
534 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
536 if (traits_type::eq_int_type(__c, __eof))
542 __throw_exception_again;
552 template<
typename _CharT,
typename _Traits>
558 sentry __cerb(*
this,
true);
559 if (__cerb && __n > 0)
564 const int_type __eof = traits_type::eof();
566 int_type __c = __sb->
sgetc();
569 bool __large_ignore =
false;
573 && !traits_type::eq_int_type(__c, __eof)
574 && !traits_type::eq_int_type(__c, __delim))
579 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
580 && !traits_type::eq_int_type(__c, __eof)
581 && !traits_type::eq_int_type(__c, __delim))
584 __gnu_cxx::__numeric_traits<streamsize>::__min;
585 __large_ignore =
true;
592 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
594 if (traits_type::eq_int_type(__c, __eof))
596 else if (traits_type::eq_int_type(__c, __delim))
599 < __gnu_cxx::__numeric_traits<streamsize>::__max)
607 __throw_exception_again;
617 template<
typename _CharT,
typename _Traits>
618 typename basic_istream<_CharT, _Traits>::int_type
622 int_type __c = traits_type::eof();
624 sentry __cerb(*
this,
true);
630 __c = this->
rdbuf()->sgetc();
631 if (traits_type::eq_int_type(__c, traits_type::eof()))
637 __throw_exception_again;
647 template<
typename _CharT,
typename _Traits>
653 sentry __cerb(*
this,
true);
666 __throw_exception_again;
676 template<
typename _CharT,
typename _Traits>
682 sentry __cerb(*
this,
true);
692 else if (__num == -1)
698 __throw_exception_again;
708 template<
typename _CharT,
typename _Traits>
718 sentry __cerb(*
this,
true);
724 const int_type __eof = traits_type::eof();
727 || traits_type::eq_int_type(__sb->
sputbackc(__c), __eof))
733 __throw_exception_again;
743 template<
typename _CharT,
typename _Traits>
753 sentry __cerb(*
this,
true);
759 const int_type __eof = traits_type::eof();
762 || traits_type::eq_int_type(__sb->
sungetc(), __eof))
768 __throw_exception_again;
778 template<
typename _CharT,
typename _Traits>
786 sentry __cerb(*
this,
true);
804 __throw_exception_again;
814 template<
typename _CharT,
typename _Traits>
815 typename basic_istream<_CharT, _Traits>::pos_type
821 pos_type __ret = pos_type(-1);
822 sentry __cerb(*
this,
true);
834 __throw_exception_again;
842 template<
typename _CharT,
typename _Traits>
851 sentry __cerb(*
this,
true);
860 const pos_type __p = this->
rdbuf()->pubseekpos(__pos,
864 if (__p == pos_type(off_type(-1)))
871 __throw_exception_again;
881 template<
typename _CharT,
typename _Traits>
884 seekg(off_type __off, ios_base::seekdir __dir)
890 sentry __cerb(*
this,
true);
899 const pos_type __p = this->
rdbuf()->pubseekoff(__off, __dir,
903 if (__p == pos_type(off_type(-1)))
910 __throw_exception_again;
921 template<
typename _CharT,
typename _Traits>
926 typedef typename __istream_type::int_type __int_type;
928 typename __istream_type::sentry __cerb(__in,
false);
934 const __int_type __cb = __in.
rdbuf()->sbumpc();
935 if (!_Traits::eq_int_type(__cb, _Traits::eof()))
936 __c = _Traits::to_char_type(__cb);
943 __throw_exception_again;
953 template<
typename _CharT,
typename _Traits>
954 basic_istream<_CharT, _Traits>&
959 typedef typename _Traits::int_type int_type;
960 typedef _CharT char_type;
965 typename __istream_type::sentry __cerb(__in,
false);
973 __num = __gnu_cxx::__numeric_traits<streamsize>::__max;
975 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
977 const int_type __eof = _Traits::eof();
978 __streambuf_type* __sb = __in.
rdbuf();
979 int_type __c = __sb->sgetc();
981 while (__extracted < __num - 1
982 && !_Traits::eq_int_type(__c, __eof)
983 && !__ct.is(ctype_base::space,
984 _Traits::to_char_type(__c)))
986 *__s++ = _Traits::to_char_type(__c);
988 __c = __sb->snextc();
990 if (_Traits::eq_int_type(__c, __eof))
1001 __throw_exception_again;
1014 template<
typename _CharT,
typename _Traits>
1015 basic_istream<_CharT, _Traits>&
1020 typedef typename __istream_type::int_type __int_type;
1023 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
1024 const __int_type __eof = _Traits::eof();
1025 __streambuf_type* __sb = __in.
rdbuf();
1026 __int_type __c = __sb->sgetc();
1028 while (!_Traits::eq_int_type(__c, __eof)
1029 && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))
1030 __c = __sb->snextc();
1032 if (_Traits::eq_int_type(__c, __eof))
1039 #if _GLIBCXX_EXTERN_TEMPLATE
1040 extern template class basic_istream<char>;
1049 extern template istream& istream::_M_extract(
unsigned short&);
1050 extern template istream& istream::_M_extract(
unsigned int&);
1051 extern template istream& istream::_M_extract(
long&);
1052 extern template istream& istream::_M_extract(
unsigned long&);
1053 extern template istream& istream::_M_extract(
bool&);
1054 #ifdef _GLIBCXX_USE_LONG_LONG
1055 extern template istream& istream::_M_extract(
long long&);
1056 extern template istream& istream::_M_extract(
unsigned long long&);
1058 extern template istream& istream::_M_extract(
float&);
1059 extern template istream& istream::_M_extract(
double&);
1060 extern template istream& istream::_M_extract(
long double&);
1061 extern template istream& istream::_M_extract(
void*&);
1063 extern template class basic_iostream<char>;
1065 #ifdef _GLIBCXX_USE_WCHAR_T
1066 extern template class basic_istream<wchar_t>;
1071 extern template wistream& wistream::_M_extract(
unsigned short&);
1072 extern template wistream& wistream::_M_extract(
unsigned int&);
1073 extern template wistream& wistream::_M_extract(
long&);
1074 extern template wistream& wistream::_M_extract(
unsigned long&);
1075 extern template wistream& wistream::_M_extract(
bool&);
1076 #ifdef _GLIBCXX_USE_LONG_LONG
1077 extern template wistream& wistream::_M_extract(
long long&);
1078 extern template wistream& wistream::_M_extract(
unsigned long long&);
1080 extern template wistream& wistream::_M_extract(
float&);
1081 extern template wistream& wistream::_M_extract(
double&);
1082 extern template wistream& wistream::_M_extract(
long double&);
1083 extern template wistream& wistream::_M_extract(
void*&);
1085 extern template class basic_iostream<wchar_t>;
1089 _GLIBCXX_END_NAMESPACE_VERSION