37#pragma GCC system_header
41namespace std _GLIBCXX_VISIBILITY(default)
43_GLIBCXX_BEGIN_NAMESPACE_VERSION
45 template<
typename _CharT,
typename _Traits>
57 const __int_type
__eof = traits_type::eof();
59 __int_type __c =
__sb->sgetc();
62 while (!traits_type::eq_int_type(__c,
__eof)
63 &&
__ct.is(ctype_base::space,
64 traits_type::to_char_type(__c)))
70 if (traits_type::eq_int_type(__c,
__eof))
77 __throw_exception_again;
91 template<
typename _CharT,
typename _Traits>
92 template<
typename _ValueT>
109 __throw_exception_again;
119 template<
typename _CharT,
typename _Traits>
120 basic_istream<_CharT, _Traits>&
138 if (
__l < __gnu_cxx::__numeric_traits<short>::__min)
141 __n = __gnu_cxx::__numeric_traits<short>::__min;
143 else if (
__l > __gnu_cxx::__numeric_traits<short>::__max)
146 __n = __gnu_cxx::__numeric_traits<short>::__max;
154 __throw_exception_again;
164 template<
typename _CharT,
typename _Traits>
183 if (
__l < __gnu_cxx::__numeric_traits<int>::__min)
186 __n = __gnu_cxx::__numeric_traits<int>::__min;
188 else if (
__l > __gnu_cxx::__numeric_traits<int>::__max)
191 __n = __gnu_cxx::__numeric_traits<int>::__max;
199 __throw_exception_again;
209 template<
typename _CharT,
typename _Traits>
210 basic_istream<_CharT, _Traits>&
221 if (!__copy_streambufs_eof(this->
rdbuf(), __sbout,
__ineof))
229 __throw_exception_again;
241 template<
typename _CharT,
typename _Traits>
242 typename basic_istream<_CharT, _Traits>::int_type
246 const int_type
__eof = traits_type::eof();
247 int_type __c =
__eof;
255 __c = this->
rdbuf()->sbumpc();
257 if (!traits_type::eq_int_type(__c,
__eof))
265 __throw_exception_again;
277 template<
typename _CharT,
typename _Traits>
278 basic_istream<_CharT, _Traits>&
289 const int_type
__cb = this->
rdbuf()->sbumpc();
291 if (!traits_type::eq_int_type(
__cb, traits_type::eof()))
294 __c = traits_type::to_char_type(
__cb);
302 __throw_exception_again;
314 template<
typename _CharT,
typename _Traits>
315 basic_istream<_CharT, _Traits>&
327 const int_type
__eof = traits_type::eof();
329 int_type __c =
__sb->sgetc();
332 && !traits_type::eq_int_type(__c,
__eof)
333 && !traits_type::eq_int_type(__c,
__idelim))
335 *
__s++ = traits_type::to_char_type(__c);
337 __c =
__sb->snextc();
339 if (traits_type::eq_int_type(__c,
__eof))
345 __throw_exception_again;
361 template<
typename _CharT,
typename _Traits>
362 basic_istream<_CharT, _Traits>&
374 const int_type
__eof = traits_type::eof();
377 char_type __c2 = traits_type::to_char_type(__c);
380 while (!traits_type::eq_int_type(__c,
__eof)
381 && !traits_type::eq_int_type(__c,
__idelim)
382 && !traits_type::eq_int_type(
__sb.sputc(__c2),
__eof))
386 __c2 = traits_type::to_char_type(__c);
388 if (traits_type::eq_int_type(__c,
__eof))
392 if (
__gcount <= __gnu_cxx::__numeric_traits<streamsize>::__max)
395 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
400 __throw_exception_again;
412 template<
typename _CharT,
typename _Traits>
413 basic_istream<_CharT, _Traits>&
419 sentry
__cerb(*
this,
true);
425 const int_type
__eof = traits_type::eof();
427 int_type __c =
__sb->sgetc();
430 && !traits_type::eq_int_type(__c,
__eof)
431 && !traits_type::eq_int_type(__c,
__idelim))
433 *
__s++ = traits_type::to_char_type(__c);
434 __c =
__sb->snextc();
437 if (traits_type::eq_int_type(__c,
__eof))
441 if (traits_type::eq_int_type(__c,
__idelim))
453 __throw_exception_again;
472 template<
typename _CharT,
typename _Traits>
484 const int_type
__eof = traits_type::eof();
487 if (traits_type::eq_int_type(
__sb->sbumpc(),
__eof))
495 __throw_exception_again;
505 template<
typename _CharT,
typename _Traits>
517 const int_type
__eof = traits_type::eof();
519 int_type __c =
__sb->sgetc();
532 && !traits_type::eq_int_type(__c,
__eof))
535 __c =
__sb->snextc();
537 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
538 && !traits_type::eq_int_type(__c,
__eof))
541 __gnu_cxx::__numeric_traits<streamsize>::__min;
548 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max)
551 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
553 if (traits_type::eq_int_type(__c, __eof))
558 if (traits_type::eq_int_type(__c,
__eof))
565 __throw_exception_again;
575 template<
typename _CharT,
typename _Traits>
576 basic_istream<_CharT, _Traits>&
587 const int_type
__eof = traits_type::eof();
589 int_type __c =
__sb->sgetc();
596 && !traits_type::eq_int_type(__c,
__eof)
597 && !traits_type::eq_int_type(__c,
__delim))
600 __c =
__sb->snextc();
602 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max
603 && !traits_type::eq_int_type(__c,
__eof)
604 && !traits_type::eq_int_type(__c,
__delim))
607 __gnu_cxx::__numeric_traits<streamsize>::__min;
614 if (__n == __gnu_cxx::__numeric_traits<streamsize>::__max)
617 _M_gcount = __gnu_cxx::__numeric_traits<streamsize>::__max;
619 if (traits_type::eq_int_type(__c, __eof))
630 if (traits_type::eq_int_type(__c, __eof))
642 __throw_exception_again;
652 template<
typename _CharT,
typename _Traits>
653 typename basic_istream<_CharT, _Traits>::int_type
657 int_type __c = traits_type::eof();
665 __c = this->
rdbuf()->sgetc();
666 if (traits_type::eq_int_type(__c, traits_type::eof()))
672 __throw_exception_again;
682 template<
typename _CharT,
typename _Traits>
701 __throw_exception_again;
711 template<
typename _CharT,
typename _Traits>
727 else if (
__num == -1)
733 __throw_exception_again;
743 template<
typename _CharT,
typename _Traits>
744 basic_istream<_CharT, _Traits>&
759 const int_type
__eof = traits_type::eof();
762 || traits_type::eq_int_type(
__sb->sputbackc(__c),
__eof))
768 __throw_exception_again;
778 template<
typename _CharT,
typename _Traits>
794 const int_type
__eof = traits_type::eof();
797 || traits_type::eq_int_type(
__sb->sungetc(),
__eof))
803 __throw_exception_again;
813 template<
typename _CharT,
typename _Traits>
830 if (
__sb->pubsync() == -1)
839 __throw_exception_again;
849 template<
typename _CharT,
typename _Traits>
850 typename basic_istream<_CharT, _Traits>::pos_type
856 pos_type
__ret = pos_type(-1);
869 __throw_exception_again;
877 template<
typename _CharT,
typename _Traits>
895 const pos_type __p = this->
rdbuf()->pubseekpos(__pos,
899 if (__p == pos_type(off_type(-1)))
906 __throw_exception_again;
916 template<
typename _CharT,
typename _Traits>
934 const pos_type __p = this->
rdbuf()->pubseekoff(__off,
__dir,
938 if (__p == pos_type(off_type(-1)))
945 __throw_exception_again;
956 template<
typename _CharT,
typename _Traits>
961 typedef typename __istream_type::int_type __int_type;
963 typename __istream_type::sentry
__cerb(
__in,
false);
969 const __int_type
__cb =
__in.rdbuf()->sbumpc();
970 if (!_Traits::eq_int_type(
__cb, _Traits::eof()))
971 __c = _Traits::to_char_type(
__cb);
978 __throw_exception_again;
988 template<
typename _CharT,
typename _Traits>
990 __istream_extract(basic_istream<_CharT, _Traits>& __in, _CharT* __s,
993 typedef basic_istream<_CharT, _Traits> __istream_type;
994 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
995 typedef typename _Traits::int_type int_type;
996 typedef _CharT char_type;
997 typedef ctype<_CharT> __ctype_type;
1001 typename __istream_type::sentry __cerb(__in,
false);
1008 if (0 < __width && __width < __num)
1011 const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc());
1013 const int_type __eof = _Traits::eof();
1014 __streambuf_type* __sb = __in.rdbuf();
1015 int_type __c = __sb->
sgetc();
1017 while (__extracted < __num - 1
1018 && !_Traits::eq_int_type(__c, __eof)
1019 && !__ct.is(ctype_base::space,
1020 _Traits::to_char_type(__c)))
1022 *__s++ = _Traits::to_char_type(__c);
1024 __c = __sb->snextc();
1027 if (__extracted < __num - 1
1028 && _Traits::eq_int_type(__c, __eof))
1039 __throw_exception_again;
1047 __in.setstate(__err);
1051 template<
typename _CharT,
typename _Traits>
1052 basic_istream<_CharT, _Traits>&
1057 typedef typename __istream_type::int_type __int_type;
1061 const __int_type
__eof = _Traits::eof();
1062 __streambuf_type*
__sb =
__in.rdbuf();
1063 __int_type __c =
__sb->sgetc();
1065 while (!_Traits::eq_int_type(__c,
__eof)
1066 &&
__ct.is(ctype_base::space, _Traits::to_char_type(__c)))
1067 __c =
__sb->snextc();
1069 if (_Traits::eq_int_type(__c,
__eof))
1076#if _GLIBCXX_EXTERN_TEMPLATE
1077 extern template class basic_istream<char>;
1083 extern template istream& istream::_M_extract(
unsigned short&);
1084 extern template istream& istream::_M_extract(
unsigned int&);
1085 extern template istream& istream::_M_extract(
long&);
1086 extern template istream& istream::_M_extract(
unsigned long&);
1087 extern template istream& istream::_M_extract(
bool&);
1088#ifdef _GLIBCXX_USE_LONG_LONG
1089 extern template istream& istream::_M_extract(
long long&);
1090 extern template istream& istream::_M_extract(
unsigned long long&);
1092 extern template istream& istream::_M_extract(
float&);
1093 extern template istream& istream::_M_extract(
double&);
1094 extern template istream& istream::_M_extract(
long double&);
1095 extern template istream& istream::_M_extract(
void*&);
1097 extern template class basic_iostream<char>;
1099#ifdef _GLIBCXX_USE_WCHAR_T
1100 extern template class basic_istream<wchar_t>;
1105 extern template wistream& wistream::_M_extract(
unsigned short&);
1106 extern template wistream& wistream::_M_extract(
unsigned int&);
1107 extern template wistream& wistream::_M_extract(
long&);
1108 extern template wistream& wistream::_M_extract(
unsigned long&);
1109 extern template wistream& wistream::_M_extract(
bool&);
1110#ifdef _GLIBCXX_USE_LONG_LONG
1111 extern template wistream& wistream::_M_extract(
long long&);
1112 extern template wistream& wistream::_M_extract(
unsigned long long&);
1114 extern template wistream& wistream::_M_extract(
float&);
1115 extern template wistream& wistream::_M_extract(
double&);
1116 extern template wistream& wistream::_M_extract(
long double&);
1117 extern template wistream& wistream::_M_extract(
void*&);
1119 extern template class basic_iostream<wchar_t>;
1123_GLIBCXX_END_NAMESPACE_VERSION
basic_istream< char > istream
Base class for char input streams.
basic_istream< wchar_t > wistream
Base class for wchar_t input streams.
constexpr const _Tp & min(const _Tp &, const _Tp &)
This does what you think it does.
ISO C++ entities toplevel namespace is std.
ptrdiff_t streamsize
Integral type for I/O operation counts and buffer sizes.
basic_istream< _CharT, _Traits > & ws(basic_istream< _CharT, _Traits > &__is)
Quick and easy way to eat whitespace.
void clear(iostate __state=goodbit)
[Re]sets the error state.
void setstate(iostate __state)
Sets additional flags in the error state.
iostate rdstate() const
Returns the error state of the stream buffer.
bool fail() const
Fast error checking.
basic_streambuf< _CharT, _Traits > * rdbuf() const
Accessing the underlying buffer.
The actual work of input and output (interface).
int_type sbumpc()
Getting the next character.
int_type sgetc()
Getting the next character.
Template class basic_istream.
__istream_type & seekg(pos_type)
Changing the current read position.
int_type get()
Simple extraction.
streamsize readsome(char_type *__s, streamsize __n)
Extraction until the buffer is exhausted, but no more.
int_type peek()
Looking ahead in the stream.
__istream_type & unget()
Unextracting the previous character.
pos_type tellg()
Getting the current read position.
__istream_type & ignore()
Simple extraction.
__istream_type & read(char_type *__s, streamsize __n)
Extraction without delimiters.
__istream_type & putback(char_type __c)
Unextracting a single character.
__istream_type & getline(char_type *__s, streamsize __n, char_type __delim)
String extraction.
__istream_type & operator>>(__istream_type &(*__pf)(__istream_type &))
Interface for manipulators.
int sync()
Synchronizing the stream buffer.
Performs setup work for input streams.
sentry(basic_istream< _CharT, _Traits > &__is, bool __noskipws=false)
The constructor performs all the work.
Thrown as part of forced unwinding.
static const fmtflags skipws
Skips leading white space before certain input operations.
_Ios_Iostate iostate
This is a bitmask type.
static const seekdir cur
Request a seek relative to the current position within the sequence.
static const openmode in
Open for input. Default for ifstream and fstream.
static const iostate eofbit
Indicates that an input operation reached the end of an input sequence.
static const iostate goodbit
Indicates all is well.
static const iostate badbit
Indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error fro...
static const iostate failbit
Indicates that an input operation failed to read the expected characters, or that an output operation...