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.

320 lines
13 KiB

  1. // iosfwd standard header
  2. #ifndef _IOSFWD_
  3. #define _IOSFWD_
  4. #include <cstdio>
  5. #include <cstring>
  6. #include <cwchar>
  7. #include <xstddef>
  8. #ifdef _MSC_VER
  9. #pragma pack(push,8)
  10. #endif /* _MSC_VER */
  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 // _WIN64
  20. const streamoff _BADOFF = -1;
  21. extern _CRTIMP const fpos_t _Fpz;
  22. // TEMPLATE CLASS fpos (from <streambuf>)
  23. template<class _St>
  24. class fpos {
  25. typedef fpos<_St> _Myt;
  26. public:
  27. #ifdef _MT
  28. fpos(streamoff _O = 0)
  29. : _Off(_O), _Fpos(_Fpz)
  30. {_Lockit _Lk;
  31. _State = _Stz; }
  32. #else
  33. fpos(streamoff _O = 0)
  34. : _Off(_O), _Fpos(_Fpz), _State(_Stz) {}
  35. #endif
  36. fpos(_St _S, fpos_t _F)
  37. : _Off(0), _Fpos(_F), _State(_S) {}
  38. _St state() const
  39. {return (_State); }
  40. void state(_St _S)
  41. {_State = _S; }
  42. fpos_t get_fpos_t() const
  43. {return (_Fpos); }
  44. operator streamoff() const
  45. {return (_Off + _FPOSOFF(_Fpos)); }
  46. streamoff operator-(const _Myt& _R) const
  47. {return ((streamoff)*this - (streamoff)_R); }
  48. _Myt& operator+=(streamoff _O)
  49. {_Off += _O;
  50. return (*this); }
  51. _Myt& operator-=(streamoff _O)
  52. {_Off -= _O;
  53. return (*this); }
  54. _Myt operator+(streamoff _O) const
  55. {_Myt _Tmp = *this;
  56. return (_Tmp += _O); }
  57. _Myt operator-(streamoff _O) const
  58. {_Myt _Tmp = *this;
  59. return (_Tmp -= _O); }
  60. bool operator==(const _Myt& _R) const
  61. {return ((streamoff)*this == (streamoff)_R); }
  62. bool operator!=(const _Myt& _R) const
  63. {return (!(*this == _R)); }
  64. private:
  65. static _St _Stz;
  66. streamoff _Off;
  67. fpos_t _Fpos;
  68. _St _State;
  69. };
  70. template<class _St>
  71. _St fpos<_St>::_Stz;
  72. typedef fpos<mbstate_t> streampos;
  73. typedef streampos wstreampos;
  74. // TEMPLATE STRUCT char_traits (FROM <string>)
  75. template<class _E>
  76. struct char_traits {
  77. typedef _E char_type;
  78. typedef _E int_type;
  79. typedef streampos pos_type;
  80. typedef streamoff off_type;
  81. typedef mbstate_t state_type;
  82. static void __cdecl assign(_E& _X, const _E& _Y)
  83. {_X = _Y; }
  84. static bool __cdecl eq(const _E& _X, const _E& _Y)
  85. {return (_X == _Y); }
  86. static bool __cdecl lt(const _E& _X, const _E& _Y)
  87. {return (_X < _Y); }
  88. static int __cdecl compare(const _E *_U, const _E *_V, size_t _N)
  89. {for (size_t _I = 0; _I < _N; ++_I, ++_U, ++_V)
  90. if (!eq(*_U, *_V))
  91. return (lt(*_U, *_V) ? -1 : +1);
  92. return (0); }
  93. static size_t __cdecl length(const _E *_U)
  94. {size_t _N;
  95. for (_N = 0; !eq(*_U, _E(0)); ++_U)
  96. ++_N;
  97. return (_N); }
  98. static _E * __cdecl copy(_E *_U, const _E *_V, size_t _N)
  99. {_E *_S = _U;
  100. for (; 0 < _N; --_N, ++_U, ++_V)
  101. assign(*_U, *_V);
  102. return (_S); }
  103. static const _E * __cdecl find(const _E *_U, size_t _N,
  104. const _E& _C)
  105. {for (; 0 < _N; --_N, ++_U)
  106. if (eq(*_U, _C))
  107. return (_U);
  108. return (0); }
  109. static _E * __cdecl move(_E *_U, const _E *_V, size_t _N)
  110. {_E *_Ans = _U;
  111. if (_V < _U && _U < _V + _N)
  112. for (_U += _N, _V += _N; 0 < _N; --_N)
  113. assign(*--_U, *--_V);
  114. else
  115. for (; 0 < _N; --_N, ++_U, ++_V)
  116. assign(*_U, *_V);
  117. return (_Ans); }
  118. static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C)
  119. {_E *_Ans = _U;
  120. for (; 0 < _N; --_N, ++_U)
  121. assign(*_U, _C);
  122. return (_Ans); }
  123. static _E __cdecl to_char_type(const int_type& _C)
  124. {return ((_E)_C); }
  125. static int_type __cdecl to_int_type(const _E& _C)
  126. {return ((int_type)_C); }
  127. static bool __cdecl eq_int_type(const int_type& _X,
  128. const int_type& _Y)
  129. {return (_X == _Y); }
  130. static int_type __cdecl eof()
  131. {return (EOF); }
  132. static int_type __cdecl not_eof(const int_type& _C)
  133. {return (_C != eof() ? _C : !eof()); }
  134. };
  135. // STRUCT char_traits<wchar_t>
  136. template<> struct _CRTIMP char_traits<wchar_t> {
  137. typedef wchar_t _E;
  138. typedef _E char_type; // for overloads
  139. typedef wint_t int_type;
  140. typedef streampos pos_type;
  141. typedef streamoff off_type;
  142. typedef mbstate_t state_type;
  143. static void __cdecl assign(_E& _X, const _E& _Y)
  144. {_X = _Y; }
  145. static bool __cdecl eq(const _E& _X, const _E& _Y)
  146. {return (_X == _Y); }
  147. static bool __cdecl lt(const _E& _X, const _E& _Y)
  148. {return (_X < _Y); }
  149. static int __cdecl compare(const _E *_U, const _E *_V, size_t _N)
  150. {return (wmemcmp(_U, _V, _N)); }
  151. static size_t __cdecl length(const _E *_U)
  152. {return (wcslen(_U)); }
  153. static _E *__cdecl copy(_E *_U, const _E *_V, size_t _N)
  154. {return (wmemcpy(_U, _V, _N)); }
  155. static const _E * __cdecl find(const _E *_U, size_t _N,
  156. const _E& _C)
  157. {return ((const _E *)wmemchr(_U, _C, _N)); }
  158. static _E * __cdecl move(_E *_U, const _E *_V, size_t _N)
  159. {return (wmemmove(_U, _V, _N)); }
  160. static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C)
  161. {return (wmemset(_U, _C, _N)); }
  162. static _E __cdecl to_char_type(const int_type& _C)
  163. {return ((_E)_C); }
  164. static int_type __cdecl to_int_type(const _E& _C)
  165. {return ((int_type)_C); }
  166. static bool __cdecl eq_int_type(const int_type& _X,
  167. const int_type& _Y)
  168. {return (_X == _Y); }
  169. static int_type __cdecl eof()
  170. {return (WEOF); }
  171. static int_type __cdecl not_eof(const int_type& _C)
  172. {return (_C != eof() ? _C : !eof()); }
  173. };
  174. // STRUCT char_traits<char> (FROM <string>)
  175. template<> struct _CRTIMP char_traits<char> {
  176. typedef char _E;
  177. typedef _E char_type;
  178. typedef int int_type;
  179. typedef streampos pos_type;
  180. typedef streamoff off_type;
  181. typedef mbstate_t state_type;
  182. static void __cdecl assign(_E& _X, const _E& _Y)
  183. {_X = _Y; }
  184. static bool __cdecl eq(const _E& _X, const _E& _Y)
  185. {return (_X == _Y); }
  186. static bool __cdecl lt(const _E& _X, const _E& _Y)
  187. {return (_X < _Y); }
  188. static int __cdecl compare(const _E *_U, const _E *_V, size_t _N)
  189. {return (memcmp(_U, _V, _N)); }
  190. static size_t __cdecl length(const _E *_U)
  191. {return (strlen(_U)); }
  192. static _E * __cdecl copy(_E *_U, const _E *_V, size_t _N)
  193. {return ((_E *)memcpy(_U, _V, _N)); }
  194. static const _E * __cdecl find(const _E *_U, size_t _N,
  195. const _E& _C)
  196. {return ((const _E *)memchr(_U, _C, _N)); }
  197. static _E * __cdecl move(_E *_U, const _E *_V, size_t _N)
  198. {return ((_E *)memmove(_U, _V, _N)); }
  199. static _E * __cdecl assign(_E *_U, size_t _N, const _E& _C)
  200. {return ((_E *)memset(_U, _C, _N)); }
  201. static _E __cdecl to_char_type(const int_type& _C)
  202. {return ((_E)_C); }
  203. static int_type __cdecl to_int_type(const _E& _C)
  204. {return ((int_type)((unsigned char)_C)); }
  205. static bool __cdecl eq_int_type(const int_type& _X,
  206. const int_type& _Y)
  207. {return (_X == _Y); }
  208. static int_type __cdecl eof()
  209. {return (EOF); }
  210. static int_type __cdecl not_eof(const int_type& _C)
  211. {return (_C != eof() ? _C : !eof()); }
  212. };
  213. // FORWARD REFERENCES
  214. template<class T>
  215. class allocator;
  216. class ios_base;
  217. template<class _E, class _Tr = char_traits<_E> >
  218. class basic_ios;
  219. template<class _E, class _Tr = char_traits<_E> >
  220. class istreambuf_iterator;
  221. template<class _E, class _Tr = char_traits<_E> >
  222. class ostreambuf_iterator;
  223. template<class _E, class _Tr = char_traits<_E> >
  224. class basic_streambuf;
  225. template<class _E, class _Tr = char_traits<_E> >
  226. class basic_istream;
  227. template<class _E, class _Tr = char_traits<_E> >
  228. class basic_ostream;
  229. template<class _E, class _Tr = char_traits<_E> >
  230. class basic_iostream;
  231. template<class _E, class _Tr = char_traits<_E>,
  232. class _A = allocator<_E> >
  233. class basic_stringbuf;
  234. template<class _E, class _Tr = char_traits<_E>,
  235. class _A = allocator<_E> >
  236. class basic_istringstream;
  237. template<class _E, class _Tr = char_traits<_E>,
  238. class _A = allocator<_E> >
  239. class basic_ostringstream;
  240. template<class _E, class _Tr = char_traits<_E>,
  241. class _A = allocator<_E> >
  242. class basic_stringstream;
  243. template<class _E, class _Tr = char_traits<_E> >
  244. class basic_filebuf;
  245. template<class _E, class _Tr = char_traits<_E> >
  246. class basic_ifstream;
  247. template<class _E, class _Tr = char_traits<_E> >
  248. class basic_ofstream;
  249. template<class _E, class _Tr = char_traits<_E> >
  250. class basic_fstream;
  251. // char TYPEDEFS
  252. typedef basic_ios<char, char_traits<char> > ios;
  253. typedef basic_streambuf<char, char_traits<char> > streambuf;
  254. typedef basic_istream<char, char_traits<char> > istream;
  255. typedef basic_ostream<char, char_traits<char> > ostream;
  256. typedef basic_iostream<char, char_traits<char> > iostream;
  257. typedef basic_stringbuf<char, char_traits<char>,
  258. allocator<char> > stringbuf;
  259. typedef basic_istringstream<char, char_traits<char>,
  260. allocator<char> > istringstream;
  261. typedef basic_ostringstream<char, char_traits<char>,
  262. allocator<char> > ostringstream;
  263. typedef basic_stringstream<char, char_traits<char>,
  264. allocator<char> > stringstream;
  265. typedef basic_filebuf<char, char_traits<char> > filebuf;
  266. typedef basic_ifstream<char, char_traits<char> > ifstream;
  267. typedef basic_ofstream<char, char_traits<char> > ofstream;
  268. typedef basic_fstream<char, char_traits<char> > fstream;
  269. // wchar_t TYPEDEFS
  270. typedef basic_ios<wchar_t, char_traits<wchar_t> > wios;
  271. typedef basic_streambuf<wchar_t, char_traits<wchar_t> >
  272. wstreambuf;
  273. typedef basic_istream<wchar_t, char_traits<wchar_t> > wistream;
  274. typedef basic_ostream<wchar_t, char_traits<wchar_t> > wostream;
  275. typedef basic_iostream<wchar_t, char_traits<wchar_t> > wiostream;
  276. typedef basic_stringbuf<wchar_t, char_traits<wchar_t>,
  277. allocator<wchar_t> > wstringbuf;
  278. typedef basic_istringstream<wchar_t, char_traits<wchar_t>,
  279. allocator<wchar_t> > wistringstream;
  280. typedef basic_ostringstream<wchar_t, char_traits<wchar_t>,
  281. allocator<wchar_t> > wostringstream;
  282. typedef basic_stringstream<wchar_t, char_traits<wchar_t>,
  283. allocator<wchar_t> > wstringstream;
  284. typedef basic_filebuf<wchar_t, char_traits<wchar_t> > wfilebuf;
  285. typedef basic_ifstream<wchar_t, char_traits<wchar_t> > wifstream;
  286. typedef basic_ofstream<wchar_t, char_traits<wchar_t> > wofstream;
  287. typedef basic_fstream<wchar_t, char_traits<wchar_t> > wfstream;
  288. #ifdef _DLL
  289. template<class _E, class _II >
  290. class num_get;
  291. template<class _E, class _OI >
  292. class num_put;
  293. template<class _E>
  294. class collate;
  295. typedef num_get<char, istreambuf_iterator<char, char_traits<char> > > numget;
  296. typedef num_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >
  297. wnumget;
  298. typedef num_put<char, ostreambuf_iterator<char, char_traits<char> > > numput;
  299. typedef num_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >
  300. wnumput;
  301. typedef collate<char> ncollate;
  302. typedef collate<wchar_t> wcollate;
  303. #endif
  304. _STD_END
  305. #ifdef _MSC_VER
  306. #pragma pack(pop)
  307. #endif /* _MSC_VER */
  308. #endif /* _IOSFWD_ */
  309. /*
  310. * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
  311. * Consult your license regarding permissions and restrictions.
  312. */