00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00039 #ifndef _CPP_ISTREAM
00040 #define _CPP_ISTREAM 1
00041
00042 #pragma GCC system_header
00043
00044 #include <ios>
00045 #include <limits>
00046
00047 namespace std
00048 {
00049
00057 template<typename _CharT, typename _Traits>
00058 class basic_istream : virtual public basic_ios<_CharT, _Traits>
00059 {
00060 public:
00061
00062 typedef _CharT char_type;
00063 typedef typename _Traits::int_type int_type;
00064 typedef typename _Traits::pos_type pos_type;
00065 typedef typename _Traits::off_type off_type;
00066 typedef _Traits traits_type;
00067
00068
00069 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
00070 typedef basic_ios<_CharT, _Traits> __ios_type;
00071 typedef basic_istream<_CharT, _Traits> __istream_type;
00072 typedef istreambuf_iterator<_CharT, _Traits> __istreambuf_iter;
00073 typedef num_get<_CharT, __istreambuf_iter> __numget_type;
00074 typedef ctype<_CharT> __ctype_type;
00075
00076 protected:
00077
00084 streamsize _M_gcount;
00085
00086 public:
00087
00095 explicit
00096 basic_istream(__streambuf_type* __sb)
00097 {
00098 this->init(__sb);
00099 _M_gcount = streamsize(0);
00100 }
00101
00107 virtual
00108 ~basic_istream()
00109 { _M_gcount = streamsize(0); }
00110
00111
00112 class sentry;
00113 friend class sentry;
00114
00115
00116
00118
00125 __istream_type&
00126 operator>>(__istream_type& (*__pf)(__istream_type&));
00127
00128 __istream_type&
00129 operator>>(__ios_type& (*__pf)(__ios_type&));
00130
00131 __istream_type&
00132 operator>>(ios_base& (*__pf)(ios_base&));
00134
00135
00163 __istream_type&
00164 operator>>(bool& __n);
00165
00166 __istream_type&
00167 operator>>(short& __n);
00168
00169 __istream_type&
00170 operator>>(unsigned short& __n);
00171
00172 __istream_type&
00173 operator>>(int& __n);
00174
00175 __istream_type&
00176 operator>>(unsigned int& __n);
00177
00178 __istream_type&
00179 operator>>(long& __n);
00180
00181 __istream_type&
00182 operator>>(unsigned long& __n);
00183
00184 #ifdef _GLIBCPP_USE_LONG_LONG
00185 __istream_type&
00186 operator>>(long long& __n);
00187
00188 __istream_type&
00189 operator>>(unsigned long long& __n);
00190 #endif
00191
00192 __istream_type&
00193 operator>>(float& __f);
00194
00195 __istream_type&
00196 operator>>(double& __f);
00197
00198 __istream_type&
00199 operator>>(long double& __f);
00200
00201 __istream_type&
00202 operator>>(void*& __p);
00203
00224 __istream_type&
00225 operator>>(__streambuf_type* __sb);
00227
00228
00234 inline streamsize
00235 gcount() const
00236 { return _M_gcount; }
00237
00266 int_type
00267 get();
00268
00280 __istream_type&
00281 get(char_type& __c);
00282
00307 __istream_type&
00308 get(char_type* __s, streamsize __n, char_type __delim);
00309
00318 inline __istream_type&
00319 get(char_type* __s, streamsize __n)
00320 { return this->get(__s, __n, this->widen('\n')); }
00321
00341 __istream_type&
00342 get(__streambuf_type& __sb, char_type __delim);
00343
00351 inline __istream_type&
00352 get(__streambuf_type& __sb)
00353 { return this->get(__sb, this->widen('\n')); }
00354
00380 __istream_type&
00381 getline(char_type* __s, streamsize __n, char_type __delim);
00382
00391 inline __istream_type&
00392 getline(char_type* __s, streamsize __n)
00393 { return this->getline(__s, __n, this->widen('\n')); }
00394
00410 __istream_type&
00411 ignore(streamsize __n = 1, int_type __delim = traits_type::eof());
00412
00421 int_type
00422 peek();
00423
00439 __istream_type&
00440 read(char_type* __s, streamsize __n);
00441
00458 streamsize
00459 readsome(char_type* __s, streamsize __n);
00460
00478 __istream_type&
00479 putback(char_type __c);
00480
00493 __istream_type&
00494 unget();
00495
00514 int
00515 sync();
00516
00528 pos_type
00529 tellg();
00530
00546 __istream_type&
00547 seekg(pos_type);
00548
00565 __istream_type&
00566 seekg(off_type, ios_base::seekdir);
00568 };
00569
00581 template<typename _CharT, typename _Traits>
00582 class basic_istream<_CharT, _Traits>::sentry
00583 {
00584 public:
00586 typedef _Traits traits_type;
00587 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
00588 typedef basic_istream<_CharT, _Traits> __istream_type;
00589 typedef typename __istream_type::__ctype_type __ctype_type;
00590 typedef typename _Traits::int_type __int_type;
00591
00613 explicit
00614 sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
00615
00623 operator bool() { return _M_ok; }
00624
00625 private:
00626 bool _M_ok;
00627 };
00628
00629
00631
00642 template<typename _CharT, typename _Traits>
00643 basic_istream<_CharT, _Traits>&
00644 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
00645
00646 template<class _Traits>
00647 basic_istream<char, _Traits>&
00648 operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
00649 { return (__in >> reinterpret_cast<char&>(__c)); }
00650
00651 template<class _Traits>
00652 basic_istream<char, _Traits>&
00653 operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
00654 { return (__in >> reinterpret_cast<char&>(__c)); }
00656
00658
00683 template<typename _CharT, typename _Traits>
00684 basic_istream<_CharT, _Traits>&
00685 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
00686
00687 template<class _Traits>
00688 basic_istream<char,_Traits>&
00689 operator>>(basic_istream<char,_Traits>& __in, unsigned char* __s)
00690 { return (__in >> reinterpret_cast<char*>(__s)); }
00691
00692 template<class _Traits>
00693 basic_istream<char,_Traits>&
00694 operator>>(basic_istream<char,_Traits>& __in, signed char* __s)
00695 { return (__in >> reinterpret_cast<char*>(__s)); }
00697
00698
00705 template<typename _CharT, typename _Traits>
00706 class basic_iostream
00707 : public basic_istream<_CharT, _Traits>,
00708 public basic_ostream<_CharT, _Traits>
00709 {
00710 public:
00711 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00712
00713
00714 typedef _CharT char_type;
00715 typedef typename _Traits::int_type int_type;
00716 typedef typename _Traits::pos_type pos_type;
00717 typedef typename _Traits::off_type off_type;
00718 typedef _Traits traits_type;
00719 #endif
00720
00721
00722 typedef basic_istream<_CharT, _Traits> __istream_type;
00723 typedef basic_ostream<_CharT, _Traits> __ostream_type;
00724
00731 explicit
00732 basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
00733 : __istream_type(__sb), __ostream_type(__sb)
00734 { }
00735
00739 virtual
00740 ~basic_iostream() { }
00741 };
00742
00743
00764 template<typename _CharT, typename _Traits>
00765 basic_istream<_CharT, _Traits>&
00766 ws(basic_istream<_CharT, _Traits>& __is);
00767 }
00768
00769 #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
00770 # define export
00771 #endif
00772 #ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
00773 # include <bits/istream.tcc>
00774 #endif
00775
00776 #endif