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