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 template<typename _CharT2, typename _Traits2>
00077 friend basic_istream<_CharT2, _Traits2>&
00078 operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2&);
00079
00080 template<typename _CharT2, typename _Traits2>
00081 friend basic_istream<_CharT2, _Traits2>&
00082 operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);
00083
00084 protected:
00085
00092 streamsize _M_gcount;
00093
00094 public:
00095
00103 explicit
00104 basic_istream(__streambuf_type* __sb)
00105 {
00106 this->init(__sb);
00107 _M_gcount = streamsize(0);
00108 }
00109
00115 virtual
00116 ~basic_istream()
00117 { _M_gcount = streamsize(0); }
00118
00119
00120 class sentry;
00121 friend class sentry;
00122
00123
00124
00126
00133 __istream_type&
00134 operator>>(__istream_type& (*__pf)(__istream_type&));
00135
00136 __istream_type&
00137 operator>>(__ios_type& (*__pf)(__ios_type&));
00138
00139 __istream_type&
00140 operator>>(ios_base& (*__pf)(ios_base&));
00142
00143
00171 __istream_type&
00172 operator>>(bool& __n);
00173
00174 __istream_type&
00175 operator>>(short& __n);
00176
00177 __istream_type&
00178 operator>>(unsigned short& __n);
00179
00180 __istream_type&
00181 operator>>(int& __n);
00182
00183 __istream_type&
00184 operator>>(unsigned int& __n);
00185
00186 __istream_type&
00187 operator>>(long& __n);
00188
00189 __istream_type&
00190 operator>>(unsigned long& __n);
00191
00192 #ifdef _GLIBCPP_USE_LONG_LONG
00193 __istream_type&
00194 operator>>(long long& __n);
00195
00196 __istream_type&
00197 operator>>(unsigned long long& __n);
00198 #endif
00199
00200 __istream_type&
00201 operator>>(float& __f);
00202
00203 __istream_type&
00204 operator>>(double& __f);
00205
00206 __istream_type&
00207 operator>>(long double& __f);
00208
00209 __istream_type&
00210 operator>>(void*& __p);
00211
00232 __istream_type&
00233 operator>>(__streambuf_type* __sb);
00235
00236
00242 inline streamsize
00243 gcount() const
00244 { return _M_gcount; }
00245
00274 int_type
00275 get();
00276
00288 __istream_type&
00289 get(char_type& __c);
00290
00315 __istream_type&
00316 get(char_type* __s, streamsize __n, char_type __delim);
00317
00326 inline __istream_type&
00327 get(char_type* __s, streamsize __n)
00328 { return this->get(__s, __n, this->widen('\n')); }
00329
00349 __istream_type&
00350 get(__streambuf_type& __sb, char_type __delim);
00351
00359 inline __istream_type&
00360 get(__streambuf_type& __sb)
00361 { return this->get(__sb, this->widen('\n')); }
00362
00388 __istream_type&
00389 getline(char_type* __s, streamsize __n, char_type __delim);
00390
00399 inline __istream_type&
00400 getline(char_type* __s, streamsize __n)
00401 { return this->getline(__s, __n, this->widen('\n')); }
00402
00418 __istream_type&
00419 ignore(streamsize __n = 1, int_type __delim = traits_type::eof());
00420
00429 int_type
00430 peek();
00431
00447 __istream_type&
00448 read(char_type* __s, streamsize __n);
00449
00466 streamsize
00467 readsome(char_type* __s, streamsize __n);
00468
00482 __istream_type&
00483 putback(char_type __c);
00484
00497 __istream_type&
00498 unget();
00499
00515 int
00516 sync();
00517
00529 pos_type
00530 tellg();
00531
00544 __istream_type&
00545 seekg(pos_type);
00546
00560 __istream_type&
00561 seekg(off_type, ios_base::seekdir);
00563 };
00564
00576 template<typename _CharT, typename _Traits>
00577 class basic_istream<_CharT, _Traits>::sentry
00578 {
00579 public:
00581 typedef _Traits traits_type;
00582 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
00583 typedef basic_istream<_CharT, _Traits> __istream_type;
00584 typedef typename __istream_type::__ctype_type __ctype_type;
00585 typedef typename _Traits::int_type __int_type;
00586
00608 explicit
00609 sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
00610
00618 operator bool() { return _M_ok; }
00619
00620 private:
00621 bool _M_ok;
00622 };
00623
00624
00626
00637 template<typename _CharT, typename _Traits>
00638 basic_istream<_CharT, _Traits>&
00639 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
00640
00641 template<class _Traits>
00642 basic_istream<char, _Traits>&
00643 operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
00644 { return (__in >> reinterpret_cast<char&>(__c)); }
00645
00646 template<class _Traits>
00647 basic_istream<char, _Traits>&
00648 operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
00649 { return (__in >> reinterpret_cast<char&>(__c)); }
00651
00653
00678 template<typename _CharT, typename _Traits>
00679 basic_istream<_CharT, _Traits>&
00680 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
00681
00682 template<class _Traits>
00683 basic_istream<char,_Traits>&
00684 operator>>(basic_istream<char,_Traits>& __in, unsigned char* __s)
00685 { return (__in >> reinterpret_cast<char*>(__s)); }
00686
00687 template<class _Traits>
00688 basic_istream<char,_Traits>&
00689 operator>>(basic_istream<char,_Traits>& __in, signed char* __s)
00690 { return (__in >> reinterpret_cast<char*>(__s)); }
00692
00693
00700 template<typename _CharT, typename _Traits>
00701 class basic_iostream
00702 : public basic_istream<_CharT, _Traits>,
00703 public basic_ostream<_CharT, _Traits>
00704 {
00705 public:
00706 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00707
00708
00709 typedef _CharT char_type;
00710 typedef typename _Traits::int_type int_type;
00711 typedef typename _Traits::pos_type pos_type;
00712 typedef typename _Traits::off_type off_type;
00713 typedef _Traits traits_type;
00714 #endif
00715
00716
00717 typedef basic_istream<_CharT, _Traits> __istream_type;
00718 typedef basic_ostream<_CharT, _Traits> __ostream_type;
00719
00726 explicit
00727 basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
00728 : __istream_type(__sb), __ostream_type(__sb)
00729 { }
00730
00734 virtual
00735 ~basic_iostream() { }
00736 };
00737
00738
00759 template<typename _CharT, typename _Traits>
00760 basic_istream<_CharT, _Traits>&
00761 ws(basic_istream<_CharT, _Traits>& __is);
00762 }
00763
00764 #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
00765 # define export
00766 #endif
00767 #ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
00768 # include <bits/istream.tcc>
00769 #endif
00770
00771 #endif