OLD | NEW |
(Empty) | |
| 1 /* |
| 2 For wchar support, you need to include the wchar.i file |
| 3 before this file, ie: |
| 4 |
| 5 %include <wchar.i> |
| 6 %include <std_iostream.i> |
| 7 |
| 8 or equivalently, just include |
| 9 |
| 10 %include <std_wiostream.i> |
| 11 */ |
| 12 |
| 13 %include <std_ios.i> |
| 14 %include <std_basic_string.i> |
| 15 %include <std_string.i> |
| 16 #if defined(SWIG_WCHAR) |
| 17 %include <std_wstring.i> |
| 18 #endif |
| 19 |
| 20 %{ |
| 21 #include <iostream> |
| 22 %} |
| 23 |
| 24 |
| 25 namespace std |
| 26 { |
| 27 // 27.6.2.1 Template class basic_ostream |
| 28 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 29 class basic_ostream : virtual public basic_ios<_CharT, _Traits> |
| 30 { |
| 31 public: |
| 32 // Types (inherited from basic_ios (27.4.4)): |
| 33 typedef _CharT char_type; |
| 34 typedef typename _Traits::int_type int_type; |
| 35 typedef typename _Traits::pos_type pos_type; |
| 36 typedef typename _Traits::off_type off_type; |
| 37 typedef _Traits traits_type; |
| 38 |
| 39 // 27.6.2.2 Constructor/destructor: |
| 40 explicit |
| 41 basic_ostream(basic_streambuf<_CharT, _Traits>* __sb); |
| 42 |
| 43 virtual |
| 44 ~basic_ostream(); |
| 45 |
| 46 // 27.6.2.5 Formatted output: |
| 47 // 27.6.2.5.3 basic_ostream::operator<< |
| 48 basic_ostream<_CharT, _Traits>& |
| 49 operator<<(basic_ostream<_CharT, _Traits>& (*__pf)(basic_ostream<_CharT, _Tr
aits>&)); |
| 50 |
| 51 |
| 52 basic_ostream<_CharT, _Traits>& |
| 53 operator<<(basic_ios<_CharT, _Traits>& (*__pf)(basic_ios<_CharT, _Traits>&))
; |
| 54 |
| 55 |
| 56 basic_ostream<_CharT, _Traits>& |
| 57 operator<<(ios_base& (*__pf) (ios_base&)); |
| 58 |
| 59 // 27.6.2.5.2 Arithmetic Inserters |
| 60 |
| 61 basic_ostream<_CharT, _Traits>& |
| 62 operator<<(long __n); |
| 63 |
| 64 basic_ostream<_CharT, _Traits>& |
| 65 operator<<(unsigned long __n); |
| 66 |
| 67 basic_ostream<_CharT, _Traits>& |
| 68 operator<<(bool __n); |
| 69 |
| 70 basic_ostream<_CharT, _Traits>& |
| 71 operator<<(short __n); |
| 72 |
| 73 basic_ostream<_CharT, _Traits>& |
| 74 operator<<(unsigned short __n); |
| 75 |
| 76 basic_ostream<_CharT, _Traits>& |
| 77 operator<<(int __n); |
| 78 |
| 79 basic_ostream<_CharT, _Traits>& |
| 80 operator<<(unsigned int __n); |
| 81 |
| 82 basic_ostream<_CharT, _Traits>& |
| 83 operator<<(long long __n); |
| 84 |
| 85 basic_ostream<_CharT, _Traits>& |
| 86 operator<<(unsigned long long __n); |
| 87 |
| 88 basic_ostream<_CharT, _Traits>& |
| 89 operator<<(double __f); |
| 90 |
| 91 basic_ostream<_CharT, _Traits>& |
| 92 operator<<(float __f); |
| 93 |
| 94 basic_ostream<_CharT, _Traits>& |
| 95 operator<<(long double __f); |
| 96 |
| 97 basic_ostream<_CharT, _Traits>& |
| 98 operator<<(const void* __p); |
| 99 |
| 100 basic_ostream<_CharT, _Traits>& |
| 101 operator<<(basic_streambuf<_CharT, _Traits>* __sb); |
| 102 |
| 103 %extend { |
| 104 std::basic_ostream<_CharT, _Traits >& |
| 105 operator<<(const std::basic_string<_CharT,_Traits, std::allocator<_CharT
> >& s) |
| 106 { |
| 107 *self << s; |
| 108 return *self; |
| 109 } |
| 110 } |
| 111 |
| 112 // Unformatted output: |
| 113 basic_ostream<_CharT, _Traits>& |
| 114 put(char_type __c); |
| 115 |
| 116 basic_ostream<_CharT, _Traits>& |
| 117 write(const char_type* __s, streamsize __n); |
| 118 |
| 119 basic_ostream<_CharT, _Traits>& |
| 120 flush(); |
| 121 |
| 122 // Seeks: |
| 123 pos_type |
| 124 tellp(); |
| 125 |
| 126 basic_ostream<_CharT, _Traits>& |
| 127 seekp(pos_type); |
| 128 |
| 129 basic_ostream<_CharT, _Traits>& |
| 130 seekp(off_type, ios_base::seekdir); |
| 131 |
| 132 }; |
| 133 |
| 134 // 27.6.1.1 Template class basic_istream |
| 135 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 136 class basic_istream : virtual public basic_ios<_CharT, _Traits> |
| 137 { |
| 138 public: |
| 139 // Types (inherited from basic_ios (27.4.4)): |
| 140 typedef _CharT char_type; |
| 141 typedef typename _Traits::int_type int_type; |
| 142 typedef typename _Traits::pos_type pos_type; |
| 143 typedef typename _Traits::off_type off_type; |
| 144 typedef _Traits traits_type; |
| 145 |
| 146 |
| 147 public: |
| 148 // 27.6.1.1.1 Constructor/destructor: |
| 149 explicit |
| 150 basic_istream(basic_streambuf<_CharT, _Traits>* __sb); |
| 151 |
| 152 virtual |
| 153 ~basic_istream(); |
| 154 |
| 155 // 27.6.1.2.3 basic_istream::operator>> |
| 156 basic_istream<_CharT, _Traits>& |
| 157 operator>>(basic_istream<_CharT, _Traits>& (*__pf)(basic_istream<_CharT, _Tr
aits>&)); |
| 158 |
| 159 basic_istream<_CharT, _Traits>& |
| 160 operator>>(basic_ios<_CharT, _Traits>& (*__pf)(basic_ios<_CharT, _Traits>&))
; |
| 161 |
| 162 basic_istream<_CharT, _Traits>& |
| 163 operator>>(ios_base& (*__pf)(ios_base&)); |
| 164 |
| 165 // 27.6.1.2.2 Arithmetic Extractors |
| 166 basic_istream<_CharT, _Traits>& |
| 167 operator>>(bool& __n); |
| 168 |
| 169 basic_istream<_CharT, _Traits>& |
| 170 operator>>(short& __n); |
| 171 |
| 172 basic_istream<_CharT, _Traits>& |
| 173 operator>>(unsigned short& __n); |
| 174 |
| 175 basic_istream<_CharT, _Traits>& |
| 176 operator>>(int& __n); |
| 177 |
| 178 basic_istream<_CharT, _Traits>& |
| 179 operator>>(unsigned int& __n); |
| 180 |
| 181 basic_istream<_CharT, _Traits>& |
| 182 operator>>(long& __n); |
| 183 |
| 184 basic_istream<_CharT, _Traits>& |
| 185 operator>>(unsigned long& __n); |
| 186 |
| 187 basic_istream<_CharT, _Traits>& |
| 188 operator>>(long long& __n); |
| 189 |
| 190 basic_istream<_CharT, _Traits>& |
| 191 operator>>(unsigned long long& __n); |
| 192 |
| 193 basic_istream<_CharT, _Traits>& |
| 194 operator>>(float& __f); |
| 195 |
| 196 basic_istream<_CharT, _Traits>& |
| 197 operator>>(double& __f); |
| 198 |
| 199 basic_istream<_CharT, _Traits>& |
| 200 operator>>(long double& __f); |
| 201 |
| 202 basic_istream<_CharT, _Traits>& |
| 203 operator>>(void*& __p); |
| 204 |
| 205 basic_istream<_CharT, _Traits>& |
| 206 operator>>(basic_streambuf<_CharT, _Traits>* __sb); |
| 207 |
| 208 // 27.6.1.3 Unformatted input: |
| 209 inline streamsize |
| 210 gcount(void) const; |
| 211 |
| 212 int_type |
| 213 get(void); |
| 214 |
| 215 basic_istream<_CharT, _Traits>& |
| 216 get(char_type& __c); |
| 217 |
| 218 basic_istream<_CharT, _Traits>& |
| 219 get(char_type* __s, streamsize __n, char_type __delim); |
| 220 |
| 221 inline basic_istream<_CharT, _Traits>& |
| 222 get(char_type* __s, streamsize __n); |
| 223 |
| 224 basic_istream<_CharT, _Traits>& |
| 225 get(basic_streambuf<_CharT, _Traits>& __sb, char_type __delim); |
| 226 |
| 227 inline basic_istream<_CharT, _Traits>& |
| 228 get(basic_streambuf<_CharT, _Traits>& __sb); |
| 229 |
| 230 basic_istream<_CharT, _Traits>& |
| 231 getline(char_type* __s, streamsize __n, char_type __delim); |
| 232 |
| 233 inline basic_istream<_CharT, _Traits>& |
| 234 getline(char_type* __s, streamsize __n); |
| 235 |
| 236 basic_istream<_CharT, _Traits>& |
| 237 ignore(streamsize __n = 1, int_type __delim = _Traits::eof()); |
| 238 |
| 239 int_type |
| 240 peek(void); |
| 241 |
| 242 basic_istream<_CharT, _Traits>& |
| 243 read(char_type* __s, streamsize __n); |
| 244 |
| 245 streamsize |
| 246 readsome(char_type* __s, streamsize __n); |
| 247 |
| 248 basic_istream<_CharT, _Traits>& |
| 249 putback(char_type __c); |
| 250 |
| 251 basic_istream<_CharT, _Traits>& |
| 252 unget(void); |
| 253 |
| 254 int |
| 255 sync(void); |
| 256 |
| 257 pos_type |
| 258 tellg(void); |
| 259 |
| 260 basic_istream<_CharT, _Traits>& |
| 261 seekg(pos_type); |
| 262 |
| 263 basic_istream<_CharT, _Traits>& |
| 264 seekg(off_type, ios_base::seekdir); |
| 265 }; |
| 266 |
| 267 // 27.6.1.5 Template class basic_iostream |
| 268 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 269 class basic_iostream |
| 270 : public basic_istream<_CharT, _Traits>, |
| 271 public basic_ostream<_CharT, _Traits> |
| 272 { |
| 273 public: |
| 274 typedef _CharT char_type; |
| 275 typedef typename _Traits::int_type int_type; |
| 276 typedef typename _Traits::pos_type pos_type; |
| 277 typedef typename _Traits::off_type off_type; |
| 278 typedef _Traits traits_type; |
| 279 |
| 280 explicit |
| 281 basic_iostream(basic_streambuf<_CharT, _Traits>* __sb); |
| 282 |
| 283 virtual |
| 284 ~basic_iostream(); |
| 285 }; |
| 286 |
| 287 typedef basic_ostream<char> ostream ; |
| 288 typedef basic_istream<char> istream; |
| 289 typedef basic_iostream<char> iostream; |
| 290 |
| 291 extern istream cin; |
| 292 extern ostream cout; |
| 293 extern ostream cerr; |
| 294 extern ostream clog; |
| 295 |
| 296 #if defined(SWIG_WCHAR) |
| 297 typedef basic_ostream<wchar_t> wostream; |
| 298 typedef basic_istream<wchar_t> wistream; |
| 299 typedef basic_iostream<wchar_t> wiostream; |
| 300 |
| 301 extern wistream wcin; |
| 302 extern wostream wcout; |
| 303 extern wostream wcerr; |
| 304 extern wostream wclog; |
| 305 #endif |
| 306 |
| 307 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 308 std::basic_ostream<_CharT, _Traits>& |
| 309 endl(std::basic_ostream<_CharT, _Traits>&); |
| 310 |
| 311 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 312 std::basic_ostream<_CharT, _Traits>& |
| 313 ends(std::basic_ostream<_CharT, _Traits>&); |
| 314 |
| 315 template<typename _CharT, typename _Traits = char_traits<_CharT> > |
| 316 std::basic_ostream<_CharT, _Traits>& |
| 317 flush(std::basic_ostream<_CharT, _Traits>&); |
| 318 } |
| 319 |
| 320 namespace std { |
| 321 %template(ostream) basic_ostream<char>; |
| 322 %template(istream) basic_istream<char>; |
| 323 %template(iostream) basic_iostream<char>; |
| 324 |
| 325 %template(endl) endl<char, std::char_traits<char> >; |
| 326 %template(ends) ends<char, std::char_traits<char> >; |
| 327 %template(flush) flush<char, std::char_traits<char> >; |
| 328 |
| 329 #if defined(SWIG_WCHAR) |
| 330 %template(wostream) basic_ostream<wchar_t>; |
| 331 %template(wistream) basic_istream<wchar_t>; |
| 332 %template(wiostream) basic_iostream<wchar_t>; |
| 333 |
| 334 %template(wendl) endl<wchar_t, std::char_traits<wchar_t> >; |
| 335 %template(wends) ends<wchar_t, std::char_traits<wchar_t> >; |
| 336 %template(wflush) flush<wchar_t, std::char_traits<wchar_t> >; |
| 337 #endif |
| 338 } |
| 339 |
OLD | NEW |