37 #define _ISTREAM_TCC 1
39 #pragma GCC system_header
43 namespace std _GLIBCXX_VISIBILITY(default)
45 _GLIBCXX_BEGIN_NAMESPACE_VERSION
47 template<
typename _CharT,
typename _Traits>
58 const __int_type __eof = traits_type::eof();
60 __int_type __c = __sb->
sgetc();
63 while (!traits_type::eq_int_type(__c, __eof)
64 && __ct.
is(ctype_base::space,
65 traits_type::to_char_type(__c)))
71 if (traits_type::eq_int_type(__c, __eof))
85 template<
typename _CharT,
typename _Traits>
86 template<
typename _ValueT>
91 sentry __cerb(*
this,
false);
98 __ng.
get(*
this, 0, *
this, __err, __v);
103 __throw_exception_again;
113 template<
typename _CharT,
typename _Traits>
114 basic_istream<_CharT, _Traits>&
120 sentry __cerb(*
this,
false);
128 __ng.
get(*
this, 0, *
this, __err, __l);
132 if (__l < __gnu_cxx::__numeric_traits<short>::__min)
135 __n = __gnu_cxx::__numeric_traits<short>::__min;
137 else if (__l > __gnu_cxx::__numeric_traits<short>::__max)
140 __n = __gnu_cxx::__numeric_traits<short>::__max;
148 __throw_exception_again;
158 template<
typename _CharT,
typename _Traits>
165 sentry __cerb(*
this,
false);
173 __ng.
get(*
this, 0, *
this, __err, __l);
177 if (__l < __gnu_cxx::__numeric_traits<int>::__min)
180 __n = __gnu_cxx::__numeric_traits<int>::__min;
182 else if (__l > __gnu_cxx::__numeric_traits<int>::__max)
185 __n = __gnu_cxx::__numeric_traits<int>::__max;
193 __throw_exception_again;
203 template<
typename _CharT,
typename _Traits>
209 sentry __cerb(*
this,
false);
210 if (__cerb && __sbout)
215 if (!__copy_streambufs_eof(this->
rdbuf(), __sbout, __ineof))
223 __throw_exception_again;
235 template<
typename _CharT,
typename _Traits>
236 typename basic_istream<_CharT, _Traits>::int_type
240 const int_type __eof = traits_type::eof();
241 int_type __c = __eof;
244 sentry __cerb(*
this,
true);
249 __c = this->
rdbuf()->sbumpc();
251 if (!traits_type::eq_int_type(__c, __eof))
259 __throw_exception_again;
271 template<
typename _CharT,
typename _Traits>
278 sentry __cerb(*
this,
true);
283 const int_type __cb = this->
rdbuf()->sbumpc();
285 if (!traits_type::eq_int_type(__cb, traits_type::eof()))
288 __c = traits_type::to_char_type(__cb);
296 __throw_exception_again;
308 template<
typename _CharT,
typename _Traits>
315 sentry __cerb(*
this,
true);
320 const int_type __idelim = traits_type::to_int_type(__delim);
321 const int_type __eof = traits_type::eof();
323 int_type __c = __sb->
sgetc();
326 && !traits_type::eq_int_type(__c, __eof)
327 && !traits_type::eq_int_type(__c, __idelim))
329 *__s++ = traits_type::to_char_type(__c);
333 if (traits_type::eq_int_type(__c, __eof))
339 __throw_exception_again;
355 template<
typename _CharT,
typename _Traits>
362 sentry __cerb(*
this,
true);
367 const int_type __idelim = traits_type::to_int_type(__delim);
368 const int_type __eof = traits_type::eof();
370 int_type __c = __this_sb->
sgetc();
371 char_type __c2 = traits_type::to_char_type(__c);
373 while (!traits_type::eq_int_type(__c, __eof)
374 && !traits_type::eq_int_type(__c, __idelim)
375 && !traits_type::eq_int_type(__sb.
sputc(__c2), __eof))
378 __c = __this_sb->
snextc();
379 __c2 = traits_type::to_char_type(__c);
381 if (traits_type::eq_int_type(__c, __eof))
387 __throw_exception_again;
399 template<
typename _CharT,
typename _Traits>
406 sentry __cerb(*
this,
true);
411 const int_type __idelim = traits_type::to_int_type(__delim);
412 const int_type __eof = traits_type::eof();
414 int_type __c = __sb->
sgetc();
417 && !traits_type::eq_int_type(__c, __eof)
418 && !traits_type::eq_int_type(__c, __idelim))
420 *__s++ = traits_type::to_char_type(__c);
424 if (traits_type::eq_int_type(__c, __eof))
428 if (traits_type::eq_int_type(__c, __idelim))
440 __throw_exception_again;
459 template<
typename _CharT,
typename _Traits>
465 sentry __cerb(*
this,
true);
471 const int_type __eof = traits_type::eof();
474 if (traits_type::eq_int_type(__sb->
sbumpc(), __eof))
482 __throw_exception_again;
492 template<
typename _CharT,
typename _Traits>
498 sentry __cerb(*
this,
true);
499 if (__cerb && __n > 0)
504 const int_type __eof = traits_type::eof();
506 int_type __c = __sb->
sgetc();
515 bool __large_ignore =
false;
519 && !traits_type::eq_int_type(__c, __eof))
524 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
525 && !traits_type::eq_int_type(__c, __eof))
528 __gnu_cxx::__numeric_traits<streamsize>::__min;
529 __large_ignore =
true;
536 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
538 if (traits_type::eq_int_type(__c, __eof))
544 __throw_exception_again;
554 template<
typename _CharT,
typename _Traits>
560 sentry __cerb(*
this,
true);
561 if (__cerb && __n > 0)
566 const int_type __eof = traits_type::eof();
568 int_type __c = __sb->
sgetc();
571 bool __large_ignore =
false;
575 && !traits_type::eq_int_type(__c, __eof)
576 && !traits_type::eq_int_type(__c, __delim))
581 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
582 && !traits_type::eq_int_type(__c, __eof)
583 && !traits_type::eq_int_type(__c, __delim))
586 __gnu_cxx::__numeric_traits<streamsize>::__min;
587 __large_ignore =
true;
594 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
596 if (traits_type::eq_int_type(__c, __eof))
598 else if (traits_type::eq_int_type(__c, __delim))
601 < __gnu_cxx::__numeric_traits<streamsize>::__max)
609 __throw_exception_again;
619 template<
typename _CharT,
typename _Traits>
620 typename basic_istream<_CharT, _Traits>::int_type
624 int_type __c = traits_type::eof();
626 sentry __cerb(*
this,
true);
632 __c = this->
rdbuf()->sgetc();
633 if (traits_type::eq_int_type(__c, traits_type::eof()))
639 __throw_exception_again;
649 template<
typename _CharT,
typename _Traits>
655 sentry __cerb(*
this,
true);
668 __throw_exception_again;
678 template<
typename _CharT,
typename _Traits>
684 sentry __cerb(*
this,
true);
694 else if (__num == -1)
700 __throw_exception_again;
710 template<
typename _CharT,
typename _Traits>
720 sentry __cerb(*
this,
true);
726 const int_type __eof = traits_type::eof();
729 || traits_type::eq_int_type(__sb->
sputbackc(__c), __eof))
735 __throw_exception_again;
745 template<
typename _CharT,
typename _Traits>
755 sentry __cerb(*
this,
true);
761 const int_type __eof = traits_type::eof();
764 || traits_type::eq_int_type(__sb->
sungetc(), __eof))
770 __throw_exception_again;
780 template<
typename _CharT,
typename _Traits>
788 sentry __cerb(*
this,
true);
806 __throw_exception_again;
816 template<
typename _CharT,
typename _Traits>
817 typename basic_istream<_CharT, _Traits>::pos_type
823 pos_type __ret = pos_type(-1);
824 sentry __cerb(*
this,
true);
836 __throw_exception_again;
844 template<
typename _CharT,
typename _Traits>
853 sentry __cerb(*
this,
true);
862 const pos_type __p = this->
rdbuf()->pubseekpos(__pos,
866 if (__p == pos_type(off_type(-1)))
873 __throw_exception_again;
883 template<
typename _CharT,
typename _Traits>
886 seekg(off_type __off, ios_base::seekdir __dir)
892 sentry __cerb(*
this,
true);
901 const pos_type __p = this->
rdbuf()->pubseekoff(__off, __dir,
905 if (__p == pos_type(off_type(-1)))
912 __throw_exception_again;
923 template<
typename _CharT,
typename _Traits>
928 typedef typename __istream_type::int_type __int_type;
930 typename __istream_type::sentry __cerb(__in,
false);
936 const __int_type __cb = __in.
rdbuf()->sbumpc();
937 if (!_Traits::eq_int_type(__cb, _Traits::eof()))
938 __c = _Traits::to_char_type(__cb);
945 __throw_exception_again;
955 template<
typename _CharT,
typename _Traits>
956 basic_istream<_CharT, _Traits>&
961 typedef typename _Traits::int_type int_type;
962 typedef _CharT char_type;
967 typename __istream_type::sentry __cerb(__in,
false);
975 __num = __gnu_cxx::__numeric_traits<streamsize>::__max;
977 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
979 const int_type __eof = _Traits::eof();
980 __streambuf_type* __sb = __in.
rdbuf();
981 int_type __c = __sb->sgetc();
983 while (__extracted < __num - 1
984 && !_Traits::eq_int_type(__c, __eof)
985 && !__ct.is(ctype_base::space,
986 _Traits::to_char_type(__c)))
988 *__s++ = _Traits::to_char_type(__c);
990 __c = __sb->snextc();
992 if (_Traits::eq_int_type(__c, __eof))
1003 __throw_exception_again;
1016 template<
typename _CharT,
typename _Traits>
1017 basic_istream<_CharT, _Traits>&
1022 typedef typename __istream_type::int_type __int_type;
1025 const __ctype_type& __ct = use_facet<__ctype_type>(__in.
getloc());
1026 const __int_type __eof = _Traits::eof();
1027 __streambuf_type* __sb = __in.
rdbuf();
1028 __int_type __c = __sb->sgetc();
1030 while (!_Traits::eq_int_type(__c, __eof)
1031 && __ct.is(ctype_base::space, _Traits::to_char_type(__c)))
1032 __c = __sb->snextc();
1034 if (_Traits::eq_int_type(__c, __eof))
1041 #if _GLIBCXX_EXTERN_TEMPLATE
1042 extern template class basic_istream<char>;
1051 extern template istream& istream::_M_extract(
unsigned short&);
1052 extern template istream& istream::_M_extract(
unsigned int&);
1053 extern template istream& istream::_M_extract(
long&);
1054 extern template istream& istream::_M_extract(
unsigned long&);
1055 extern template istream& istream::_M_extract(
bool&);
1056 #ifdef _GLIBCXX_USE_LONG_LONG
1057 extern template istream& istream::_M_extract(
long long&);
1058 extern template istream& istream::_M_extract(
unsigned long long&);
1060 extern template istream& istream::_M_extract(
float&);
1061 extern template istream& istream::_M_extract(
double&);
1062 extern template istream& istream::_M_extract(
long double&);
1063 extern template istream& istream::_M_extract(
void*&);
1065 extern template class basic_iostream<char>;
1067 #ifdef _GLIBCXX_USE_WCHAR_T
1068 extern template class basic_istream<wchar_t>;
1073 extern template wistream& wistream::_M_extract(
unsigned short&);
1074 extern template wistream& wistream::_M_extract(
unsigned int&);
1075 extern template wistream& wistream::_M_extract(
long&);
1076 extern template wistream& wistream::_M_extract(
unsigned long&);
1077 extern template wistream& wistream::_M_extract(
bool&);
1078 #ifdef _GLIBCXX_USE_LONG_LONG
1079 extern template wistream& wistream::_M_extract(
long long&);
1080 extern template wistream& wistream::_M_extract(
unsigned long long&);
1082 extern template wistream& wistream::_M_extract(
float&);
1083 extern template wistream& wistream::_M_extract(
double&);
1084 extern template wistream& wistream::_M_extract(
long double&);
1085 extern template wistream& wistream::_M_extract(
void*&);
1087 extern template class basic_iostream<wchar_t>;
1091 _GLIBCXX_END_NAMESPACE_VERSION