Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

629 lines
18 KiB

  1. // iosfwd standard header
  2. #pragma once
  3. #ifndef _IOSFWD_
  4. #define _IOSFWD_
  5. #include <cstdio>
  6. #include <cstring>
  7. #include <cwchar>
  8. #include <xstddef>
  9. #pragma pack(push,8)
  10. #pragma warning(push,3)
  11. _STD_BEGIN
  12. // STREAM POSITIONING TYPES (from <streambuf>)
  13. #ifdef _WIN64
  14. typedef __int64 streamoff;
  15. typedef __int64 streamsize;
  16. #else
  17. typedef long streamoff;
  18. typedef int streamsize;
  19. #endif
  20. extern _CRTIMP2 fpos_t _Fpz;
  21. extern _CRTIMP2 const streamoff _BADOFF;
  22. // TEMPLATE CLASS fpos (from <streambuf>)
  23. template<class _Statetype>
  24. class fpos
  25. { // store arbitrary file position
  26. typedef fpos<_Statetype> _Myt;
  27. public:
  28. fpos(streamoff _Off = 0)
  29. : _Myoff(_Off), _Fpos(_Fpz), _Mystate(_Stz)
  30. { // construct with stream offset
  31. }
  32. fpos(_Statetype _State, fpos_t _Fileposition)
  33. : _Myoff(0), _Fpos(_Fileposition), _Mystate(_State)
  34. { // construct with conversion state and C file position
  35. }
  36. _Statetype state() const
  37. { // return conversion state
  38. return (_Mystate);
  39. }
  40. void state(_Statetype _State)
  41. { // set conversion state
  42. _Mystate = _State;
  43. }
  44. fpos_t seekpos() const
  45. { // return C file position
  46. return (_Fpos);
  47. }
  48. operator streamoff() const
  49. { // return offset
  50. return (_Myoff + _FPOSOFF(_Fpos));
  51. }
  52. streamoff operator-(const _Myt& _Right) const
  53. { // return difference of file positions as an offset
  54. return ((streamoff)*this - (streamoff)_Right);
  55. }
  56. _Myt& operator+=(streamoff _Off)
  57. { // add offset
  58. _Myoff += _Off;
  59. return (*this);
  60. }
  61. _Myt& operator-=(streamoff _Off)
  62. { // subtract offset
  63. _Myoff -= _Off;
  64. return (*this);
  65. }
  66. _Myt operator+(streamoff _Off) const
  67. { // return this + offset
  68. _Myt _Tmp = *this;
  69. return (_Tmp += _Off);
  70. }
  71. _Myt operator-(streamoff _Off) const
  72. { // return this - offset
  73. _Myt _Tmp = *this;
  74. return (_Tmp -= _Off);
  75. }
  76. bool operator==(const _Myt& _Right) const
  77. { // test for file position equality
  78. return ((streamoff)*this == (streamoff)_Right);
  79. }
  80. bool operator!=(const _Myt& _Right) const
  81. { // test for file position inequality
  82. return (!(*this == _Right));
  83. }
  84. private:
  85. static _Statetype _Stz; // initial conversion state
  86. streamoff _Myoff; // stream offset
  87. fpos_t _Fpos; // C file position
  88. _Statetype _Mystate; // current conversion state
  89. };
  90. // STATIC fpos::_Stz OBJECT
  91. template<class _Statetype>
  92. _Statetype fpos<_Statetype>::_Stz;
  93. typedef fpos<mbstate_t> streampos;
  94. typedef streampos wstreampos;
  95. // TEMPLATE STRUCT char_traits (FROM <string>)
  96. template<class _Elem>
  97. struct char_traits
  98. { // properties of a string or stream element
  99. typedef _Elem char_type;
  100. typedef _Elem int_type;
  101. typedef streampos pos_type;
  102. typedef streamoff off_type;
  103. typedef mbstate_t state_type;
  104. static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
  105. { // assign an element
  106. _Left = _Right;
  107. }
  108. static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
  109. { // test for element equality
  110. return (_Left == _Right);
  111. }
  112. static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
  113. { // test if _Left precedes _Right
  114. return (_Left < _Right);
  115. }
  116. static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
  117. size_t _Count)
  118. { // compare [_First1, _First1 + _Count) with [_First2, ...)
  119. for (; 0 < _Count; --_Count, ++_First1, ++_First2)
  120. if (!eq(*_First1, *_First2))
  121. return (lt(*_First1, *_First2) ? -1 : +1);
  122. return (0);
  123. }
  124. static size_t __cdecl length(const _Elem *_First)
  125. { // find length of null-terminated sequence
  126. size_t _Count;
  127. for (_Count = 0; !eq(*_First, _Elem()); ++_First)
  128. ++_Count;
  129. return (_Count);
  130. }
  131. static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
  132. size_t _Count)
  133. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  134. _Elem *_Next = _First1;
  135. for (; 0 < _Count; --_Count, ++_Next, ++_First2)
  136. assign(*_Next, *_First2);
  137. return (_First1);
  138. }
  139. static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
  140. const _Elem& _Ch)
  141. { // look for _Ch in [_First, _First + _Count)
  142. for (; 0 < _Count; --_Count, ++_First)
  143. if (eq(*_First, _Ch))
  144. return (_First);
  145. return (0);
  146. }
  147. static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
  148. size_t _Count)
  149. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  150. _Elem *_Next = _First1;
  151. if (_First2 < _Next && _Next < _First2 + _Count)
  152. for (_Next += _Count, _First2 += _Count; 0 < _Count; --_Count)
  153. assign(*--_Next, *--_First2);
  154. else
  155. for (; 0 < _Count; --_Count, ++_Next, ++_First2)
  156. assign(*_Next, *_First2);
  157. return (_First1);
  158. }
  159. static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
  160. { // assign _Count * _Ch to [_First, ...)
  161. _Elem *_Next = _First;
  162. for (; 0 < _Count; --_Count, ++_Next)
  163. assign(*_Next, _Ch);
  164. return (_First);
  165. }
  166. static _Elem __cdecl to_char_type(const int_type& _Meta)
  167. { // convert metacharacter to character
  168. return (_Meta);
  169. }
  170. static int_type __cdecl to_int_type(const _Elem& _Ch)
  171. { // convert character to metacharacter
  172. return (_Ch);
  173. }
  174. static bool __cdecl eq_int_type(const int_type& _Left,
  175. const int_type& _Right)
  176. { // test for metacharacter equality
  177. return (_Left == _Right);
  178. }
  179. static int_type __cdecl eof()
  180. { // return end-of-file metacharacter
  181. return ((int_type)EOF);
  182. }
  183. static int_type __cdecl not_eof(const int_type& _Meta)
  184. { // return anything but EOF
  185. return (_Meta != eof() ? _Meta : !eof());
  186. }
  187. };
  188. // STRUCT char_traits<wchar_t>
  189. template<> struct _CRTIMP2 char_traits<wchar_t>
  190. { // properties of a string or stream wchar_t element
  191. typedef wchar_t _Elem;
  192. typedef _Elem char_type; // for overloads
  193. typedef wint_t int_type;
  194. typedef streampos pos_type;
  195. typedef streamoff off_type;
  196. typedef mbstate_t state_type;
  197. static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
  198. { // assign an element
  199. _Left = _Right;
  200. }
  201. static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
  202. { // test for element equality
  203. return (_Left == _Right);
  204. }
  205. static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
  206. { // test if _Left precedes _Right
  207. return (_Left < _Right);
  208. }
  209. static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
  210. size_t _Count)
  211. { // compare [_First1, _First1 + _Count) with [_First2, ...)
  212. return (::wmemcmp(_First1, _First2, _Count));
  213. }
  214. static size_t __cdecl length(const _Elem *_First)
  215. { // find length of null-terminated sequence
  216. return (::wcslen(_First));
  217. }
  218. static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
  219. size_t _Count)
  220. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  221. return (::wmemcpy(_First1, _First2, _Count));
  222. }
  223. static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
  224. const _Elem& _Ch)
  225. { // look for _Ch in [_First, _First + _Count)
  226. return ((const _Elem *)::wmemchr(_First, _Ch, _Count));
  227. }
  228. static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
  229. size_t _Count)
  230. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  231. return (::wmemmove(_First1, _First2, _Count));
  232. }
  233. static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
  234. { // assign _Count * _Ch to [_First, ...)
  235. return (::wmemset(_First, _Ch, _Count));
  236. }
  237. static _Elem __cdecl to_char_type(const int_type& _Meta)
  238. { // convert metacharacter to character
  239. return (_Meta);
  240. }
  241. static int_type __cdecl to_int_type(const _Elem& _Ch)
  242. { // convert character to metacharacter
  243. return (_Ch);
  244. }
  245. static bool __cdecl eq_int_type(const int_type& _Left,
  246. const int_type& _Right)
  247. { // test for metacharacter equality
  248. return (_Left == _Right);
  249. }
  250. static int_type __cdecl eof()
  251. { // return end-of-file metacharacter
  252. return (WEOF);
  253. }
  254. static int_type __cdecl not_eof(const int_type& _Meta)
  255. { // return anything but EOF
  256. return (_Meta != eof() ? _Meta : !eof());
  257. }
  258. };
  259. #ifdef _CRTBLD_NATIVE_WCHAR_T
  260. // STRUCT char_traits<unsigned short>
  261. template<> struct _CRTIMP2 char_traits<unsigned short>
  262. { // properties of a string or stream unsigned short element
  263. typedef unsigned short _Elem;
  264. typedef _Elem char_type; // for overloads
  265. typedef wint_t int_type;
  266. typedef streampos pos_type;
  267. typedef streamoff off_type;
  268. typedef mbstate_t state_type;
  269. static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
  270. { // assign an element
  271. _Left = _Right;
  272. }
  273. static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
  274. { // test for element equality
  275. return (_Left == _Right);
  276. }
  277. static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
  278. { // test if _Left precedes _Right
  279. return (_Left < _Right);
  280. }
  281. static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
  282. size_t _Count)
  283. { // compare [_First1, _First1 + _Count) with [_First2, ...)
  284. return (::wmemcmp((const wchar_t *)_First1, (const wchar_t *)_First2, _Count));
  285. }
  286. static size_t __cdecl length(const _Elem *_First)
  287. { // find length of null-terminated sequence
  288. return (::wcslen((const wchar_t *)_First));
  289. }
  290. static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
  291. size_t _Count)
  292. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  293. return ((_Elem *)::wmemcpy((wchar_t *)_First1, (const wchar_t *)_First2, _Count));
  294. }
  295. static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
  296. const _Elem& _Ch)
  297. { // look for _Ch in [_First, _First + _Count)
  298. return ((const _Elem *)::wmemchr((const wchar_t *)_First, _Ch, _Count));
  299. }
  300. static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
  301. size_t _Count)
  302. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  303. return ((_Elem *)::wmemmove((wchar_t *)_First1, (const wchar_t *)_First2, _Count));
  304. }
  305. static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
  306. { // assign _Count * _Ch to [_First, ...)
  307. return ((_Elem *)::wmemset((wchar_t *)_First, _Ch, _Count));
  308. }
  309. static _Elem __cdecl to_char_type(const int_type& _Meta)
  310. { // convert metacharacter to character
  311. return (_Meta);
  312. }
  313. static int_type __cdecl to_int_type(const _Elem& _Ch)
  314. { // convert character to metacharacter
  315. return (_Ch);
  316. }
  317. static bool __cdecl eq_int_type(const int_type& _Left,
  318. const int_type& _Right)
  319. { // test for metacharacter equality
  320. return (_Left == _Right);
  321. }
  322. static int_type __cdecl eof()
  323. { // return end-of-file metacharacter
  324. return (WEOF);
  325. }
  326. static int_type __cdecl not_eof(const int_type& _Meta)
  327. { // return anything but EOF
  328. return (_Meta != eof() ? _Meta : !eof());
  329. }
  330. };
  331. #endif
  332. // STRUCT char_traits<char> (FROM <string>)
  333. template<> struct _CRTIMP2 char_traits<char>
  334. { // properties of a string or stream char element
  335. typedef char _Elem;
  336. typedef _Elem char_type;
  337. typedef int int_type;
  338. typedef streampos pos_type;
  339. typedef streamoff off_type;
  340. typedef mbstate_t state_type;
  341. static void __cdecl assign(_Elem& _Left, const _Elem& _Right)
  342. { // assign an element
  343. _Left = _Right;
  344. }
  345. static bool __cdecl eq(const _Elem& _Left, const _Elem& _Right)
  346. { // test for element equality
  347. return (_Left == _Right);
  348. }
  349. static bool __cdecl lt(const _Elem& _Left, const _Elem& _Right)
  350. { // test if _Left precedes _Right
  351. return (_Left < _Right);
  352. }
  353. static int __cdecl compare(const _Elem *_First1, const _Elem *_First2,
  354. size_t _Count)
  355. { // compare [_First1, _First1 + _Count) with [_First2, ...)
  356. return (::memcmp(_First1, _First2, _Count));
  357. }
  358. static size_t __cdecl length(const _Elem *_First)
  359. { // find length of null-terminated string
  360. return (::strlen(_First));
  361. }
  362. static _Elem *__cdecl copy(_Elem *_First1, const _Elem *_First2,
  363. size_t _Count)
  364. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  365. return ((_Elem *)::memcpy(_First1, _First2, _Count));
  366. }
  367. static const _Elem *__cdecl find(const _Elem *_First, size_t _Count,
  368. const _Elem& _Ch)
  369. { // look for _Ch in [_First, _First + _Count)
  370. return ((const _Elem *)::memchr(_First, _Ch, _Count));
  371. }
  372. static _Elem *__cdecl move(_Elem *_First1, const _Elem *_First2,
  373. size_t _Count)
  374. { // copy [_First1, _First1 + _Count) to [_First2, ...)
  375. return ((_Elem *)::memmove(_First1, _First2, _Count));
  376. }
  377. static _Elem *__cdecl assign(_Elem *_First, size_t _Count, _Elem _Ch)
  378. { // assign _Count * _Ch to [_First, ...)
  379. return ((_Elem *)::memset(_First, _Ch, _Count));
  380. }
  381. static _Elem __cdecl to_char_type(const int_type& _Meta)
  382. { // convert metacharacter to character
  383. return ((_Elem)_Meta);
  384. }
  385. static int_type __cdecl to_int_type(const _Elem& _Ch)
  386. { // convert character to metacharacter
  387. return ((unsigned char)_Ch);
  388. }
  389. static bool __cdecl eq_int_type(const int_type& _Left,
  390. const int_type& _Right)
  391. { // test for metacharacter equality
  392. return (_Left == _Right);
  393. }
  394. static int_type __cdecl eof()
  395. { // return end-of-file metacharacter
  396. return (EOF);
  397. }
  398. static int_type __cdecl not_eof(const int_type& _Meta)
  399. { // return anything but EOF
  400. return (_Meta != eof() ? _Meta : !eof());
  401. }
  402. };
  403. // FORWARD REFERENCES
  404. template<class _Ty>
  405. class allocator;
  406. class ios_base;
  407. template<class _Elem,
  408. class _Traits = char_traits<_Elem> >
  409. class basic_ios;
  410. template<class _Elem,
  411. class _Traits = char_traits<_Elem> >
  412. class istreambuf_iterator;
  413. template<class _Elem,
  414. class _Traits = char_traits<_Elem> >
  415. class ostreambuf_iterator;
  416. template<class _Elem,
  417. class _Traits = char_traits<_Elem> >
  418. class basic_streambuf;
  419. template<class _Elem,
  420. class _Traits = char_traits<_Elem> >
  421. class basic_istream;
  422. template<class _Elem,
  423. class _Traits = char_traits<_Elem> >
  424. class basic_ostream;
  425. template<class _Elem,
  426. class _Traits = char_traits<_Elem> >
  427. class basic_iostream;
  428. template<class _Elem,
  429. class _Traits = char_traits<_Elem>,
  430. class _Alloc = allocator<_Elem> >
  431. class basic_stringbuf;
  432. template<class _Elem,
  433. class _Traits = char_traits<_Elem>,
  434. class _Alloc = allocator<_Elem> >
  435. class basic_istringstream;
  436. template<class _Elem,
  437. class _Traits = char_traits<_Elem>,
  438. class _Alloc = allocator<_Elem> >
  439. class basic_ostringstream;
  440. template<class _Elem,
  441. class _Traits = char_traits<_Elem>,
  442. class _Alloc = allocator<_Elem> >
  443. class basic_stringstream;
  444. template<class _Elem,
  445. class _Traits = char_traits<_Elem> >
  446. class basic_filebuf;
  447. template<class _Elem,
  448. class _Traits = char_traits<_Elem> >
  449. class basic_ifstream;
  450. template<class _Elem,
  451. class _Traits = char_traits<_Elem> >
  452. class basic_ofstream;
  453. template<class _Elem,
  454. class _Traits = char_traits<_Elem> >
  455. class basic_fstream;
  456. #ifdef _DLL_CPPLIB
  457. template<class _Elem,
  458. class _InIt >
  459. class num_get;
  460. template<class _Elem,
  461. class _OutIt >
  462. class num_put;
  463. template<class _Elem>
  464. class collate;
  465. #endif // _DLL_CPPLIB
  466. // char TYPEDEFS
  467. typedef basic_ios<char, char_traits<char> > ios;
  468. typedef basic_streambuf<char, char_traits<char> > streambuf;
  469. typedef basic_istream<char, char_traits<char> > istream;
  470. typedef basic_ostream<char, char_traits<char> > ostream;
  471. typedef basic_iostream<char, char_traits<char> > iostream;
  472. typedef basic_stringbuf<char, char_traits<char>,
  473. allocator<char> > stringbuf;
  474. typedef basic_istringstream<char, char_traits<char>,
  475. allocator<char> > istringstream;
  476. typedef basic_ostringstream<char, char_traits<char>,
  477. allocator<char> > ostringstream;
  478. typedef basic_stringstream<char, char_traits<char>,
  479. allocator<char> > stringstream;
  480. typedef basic_filebuf<char, char_traits<char> > filebuf;
  481. typedef basic_ifstream<char, char_traits<char> > ifstream;
  482. typedef basic_ofstream<char, char_traits<char> > ofstream;
  483. typedef basic_fstream<char, char_traits<char> > fstream;
  484. // wchat_t TYPEDEFS
  485. typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
  486. typedef basic_streambuf<wchar_t, char_traits<wchar_t> >
  487. wstreambuf;
  488. typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
  489. typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
  490. typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
  491. typedef basic_stringbuf<wchar_t, char_traits<wchar_t>,
  492. allocator<wchar_t> > wstringbuf;
  493. typedef basic_istringstream<wchar_t, char_traits<wchar_t>,
  494. allocator<wchar_t> > wistringstream;
  495. typedef basic_ostringstream<wchar_t, char_traits<wchar_t>,
  496. allocator<wchar_t> > wostringstream;
  497. typedef basic_stringstream<wchar_t, char_traits<wchar_t>,
  498. allocator<wchar_t> > wstringstream;
  499. typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
  500. typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
  501. typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
  502. typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
  503. #ifdef _CRTBLD_NATIVE_WCHAR_T
  504. typedef basic_ios<unsigned short, char_traits<unsigned short> > ushios;
  505. typedef basic_streambuf<unsigned short, char_traits<unsigned short> >
  506. ushstreambuf;
  507. typedef basic_istream<unsigned short, char_traits<unsigned short> > ushistream;
  508. typedef basic_ostream<unsigned short, char_traits<unsigned short> > ushostream;
  509. typedef basic_iostream<unsigned short, char_traits<unsigned short> > ushiostream;
  510. typedef basic_stringbuf<unsigned short, char_traits<unsigned short>,
  511. allocator<unsigned short> > ushstringbuf;
  512. typedef basic_istringstream<unsigned short, char_traits<unsigned short>,
  513. allocator<unsigned short> > ushistringstream;
  514. typedef basic_ostringstream<unsigned short, char_traits<unsigned short>,
  515. allocator<unsigned short> > ushostringstream;
  516. typedef basic_stringstream<unsigned short, char_traits<unsigned short>,
  517. allocator<unsigned short> > ushstringstream;
  518. typedef basic_filebuf<unsigned short, char_traits<unsigned short> > ushfilebuf;
  519. typedef basic_ifstream<unsigned short, char_traits<unsigned short> > ushifstream;
  520. typedef basic_ofstream<unsigned short, char_traits<unsigned short> > ushofstream;
  521. typedef basic_fstream<unsigned short, char_traits<unsigned short> > ushfstream;
  522. #endif
  523. #ifdef _DLL_CPPLIB
  524. typedef num_get<char, istreambuf_iterator<char, char_traits<char> > >
  525. numget;
  526. typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >
  527. wnumget;
  528. typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > >
  529. numput;
  530. typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >
  531. wnumput;
  532. typedef collate<char> ncollate;
  533. typedef collate<wchar_t> wcollate;
  534. #endif // _DLL_CPPLIB
  535. _STD_END
  536. #pragma warning(pop)
  537. #pragma pack(pop)
  538. #endif /* _IOSFWD_ */
  539. /*
  540. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  541. * Consult your license regarding permissions and restrictions.
  542. V3.10:0009 */