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
00034 #ifndef _CPP_ISTREAM
00035 #define _CPP_ISTREAM 1
00036
00037 #pragma GCC system_header
00038
00039 #include <bits/std_ios.h>
00040 #include <bits/std_limits.h>
00041
00042 namespace std
00043 {
00044
00045
00046 template<typename _CharT, typename _Traits>
00047 class basic_istream : virtual public basic_ios<_CharT, _Traits>
00048 {
00049 public:
00050
00051
00052 typedef _CharT char_type;
00053 typedef typename _Traits::int_type int_type;
00054 typedef typename _Traits::pos_type pos_type;
00055 typedef typename _Traits::off_type off_type;
00056 typedef _Traits traits_type;
00057
00058
00059 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
00060 typedef basic_ios<_CharT, _Traits> __ios_type;
00061 typedef basic_istream<_CharT, _Traits> __istream_type;
00062 typedef istreambuf_iterator<_CharT> __istreambuf_iter;
00063 typedef num_get<_CharT, __istreambuf_iter> __numget_type;
00064 typedef ctype<_CharT> __ctype_type;
00065
00066 protected:
00067
00068 streamsize _M_gcount;
00069
00070 public:
00071
00072 explicit
00073 basic_istream(__streambuf_type* __sb)
00074 {
00075 this->init(__sb);
00076 _M_gcount = streamsize(0);
00077 }
00078
00079 virtual
00080 ~basic_istream()
00081 {
00082 _M_gcount = streamsize(0);
00083 _M_fnumget = NULL;
00084 }
00085
00086
00087 class sentry;
00088 friend class sentry;
00089
00090
00091
00092 __istream_type&
00093 operator>>(__istream_type& (*__pf)(__istream_type&));
00094
00095 __istream_type&
00096 operator>>(__ios_type& (*__pf)(__ios_type&));
00097
00098 __istream_type&
00099 operator>>(ios_base& (*__pf)(ios_base&));
00100
00101
00102 __istream_type&
00103 operator>>(bool& __n);
00104
00105 __istream_type&
00106 operator>>(short& __n);
00107
00108 __istream_type&
00109 operator>>(unsigned short& __n);
00110
00111 __istream_type&
00112 operator>>(int& __n);
00113
00114 __istream_type&
00115 operator>>(unsigned int& __n);
00116
00117 __istream_type&
00118 operator>>(long& __n);
00119
00120 __istream_type&
00121 operator>>(unsigned long& __n);
00122
00123 #ifdef _GLIBCPP_USE_LONG_LONG
00124 __istream_type&
00125 operator>>(long long& __n);
00126
00127 __istream_type&
00128 operator>>(unsigned long long& __n);
00129 #endif
00130
00131 __istream_type&
00132 operator>>(float& __f);
00133
00134 __istream_type&
00135 operator>>(double& __f);
00136
00137 __istream_type&
00138 operator>>(long double& __f);
00139
00140 __istream_type&
00141 operator>>(void*& __p);
00142
00143 __istream_type&
00144 operator>>(__streambuf_type* __sb);
00145
00146
00147 inline streamsize
00148 gcount(void) const
00149 { return _M_gcount; }
00150
00151 int_type
00152 get(void);
00153
00154 __istream_type&
00155 get(char_type& __c);
00156
00157 __istream_type&
00158 get(char_type* __s, streamsize __n, char_type __delim);
00159
00160 inline __istream_type&
00161 get(char_type* __s, streamsize __n)
00162 { return get(__s, __n, this->widen('\n')); }
00163
00164 __istream_type&
00165 get(__streambuf_type& __sb, char_type __delim);
00166
00167 inline __istream_type&
00168 get(__streambuf_type& __sb)
00169 { return get(__sb, this->widen('\n')); }
00170
00171 __istream_type&
00172 getline(char_type* __s, streamsize __n, char_type __delim);
00173
00174 inline __istream_type&
00175 getline(char_type* __s, streamsize __n)
00176 { return getline(__s, __n, this->widen('\n')); }
00177
00178 __istream_type&
00179 ignore(streamsize __n = 1, int_type __delim = traits_type::eof());
00180
00181 int_type
00182 peek(void);
00183
00184 __istream_type&
00185 read(char_type* __s, streamsize __n);
00186
00187 streamsize
00188 readsome(char_type* __s, streamsize __n);
00189
00190 __istream_type&
00191 putback(char_type __c);
00192
00193 __istream_type&
00194 unget(void);
00195
00196 int
00197 sync(void);
00198
00199 pos_type
00200 tellg(void);
00201
00202 __istream_type&
00203 seekg(pos_type);
00204
00205 __istream_type&
00206 seekg(off_type, ios_base::seekdir);
00207
00208 private:
00209 #ifdef _GLIBCPP_RESOLVE_LIB_DEFECTS
00210
00211 __istream_type&
00212 operator=(const __istream_type&);
00213
00214 basic_istream(const __istream_type&);
00215 #endif
00216 };
00217
00218 template<typename _CharT, typename _Traits>
00219 class basic_istream<_CharT, _Traits>::sentry
00220 {
00221 public:
00222
00223 typedef _Traits traits_type;
00224 typedef basic_streambuf<_CharT, _Traits> __streambuf_type;
00225 typedef basic_istream<_CharT, _Traits> __istream_type;
00226 typedef __istream_type::__ctype_type __ctype_type;
00227 typedef typename _Traits::int_type __int_type;
00228
00229 explicit
00230 sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
00231
00232 operator bool() { return _M_ok; }
00233
00234 private:
00235 bool _M_ok;
00236 };
00237
00238
00239 template<typename _CharT, typename _Traits>
00240 basic_istream<_CharT, _Traits>&
00241 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c);
00242
00243 template<class _Traits>
00244 basic_istream<char, _Traits>&
00245 operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
00246 { return (__in >> reinterpret_cast<char&>(__c)); }
00247
00248 template<class _Traits>
00249 basic_istream<char, _Traits>&
00250 operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
00251 { return (__in >> reinterpret_cast<char&>(__c)); }
00252
00253 template<typename _CharT, typename _Traits>
00254 basic_istream<_CharT, _Traits>&
00255 operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s);
00256
00257 template<class _Traits>
00258 basic_istream<char,_Traits>&
00259 operator>>(basic_istream<char,_Traits>& __in, unsigned char* __s)
00260 { return (__in >> reinterpret_cast<char*>(__s)); }
00261
00262 template<class _Traits>
00263 basic_istream<char,_Traits>&
00264 operator>>(basic_istream<char,_Traits>& __in, signed char* __s)
00265 { return (__in >> reinterpret_cast<char*>(__s)); }
00266
00267
00268 template<typename _CharT, typename _Traits>
00269 class basic_iostream
00270 : public basic_istream<_CharT, _Traits>,
00271 public basic_ostream<_CharT, _Traits>
00272 {
00273 public:
00274
00275
00276 typedef basic_istream<_CharT, _Traits> __istream_type;
00277 typedef basic_ostream<_CharT, _Traits> __ostream_type;
00278
00279 explicit
00280 basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
00281 : __istream_type(__sb), __ostream_type(__sb)
00282 { }
00283
00284 virtual
00285 ~basic_iostream() { }
00286 };
00287
00288
00289 template<typename _CharT, typename _Traits>
00290 basic_istream<_CharT, _Traits>&
00291 ws(basic_istream<_CharT, _Traits>& __is);
00292
00293 }
00294
00295 #ifdef _GLIBCPP_NO_TEMPLATE_EXPORT
00296 # define export
00297 #ifdef _GLIBCPP_FULLY_COMPLIANT_HEADERS
00298 # include <bits/istream.tcc>
00299 #endif
00300 #endif
00301
00302 #endif
00303