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.

135 lines
3.7 KiB

  1. /***
  2. *stdiostr.h - definitions/declarations for stdiobuf, stdiostream
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This file defines the classes, values, macros, and functions
  8. * used by the stdiostream and stdiobuf classes.
  9. * [AT&T C++]
  10. *
  11. * [Public]
  12. *
  13. *Revision History:
  14. * 01-23-92 KRS Ported from 16-bit version.
  15. * 02-23-93 SKS Update copyright to 1993
  16. * 10-12-93 GJF Support NT and Cuda builds. Enclose #pragma-s in
  17. * #ifdef _MSC_VER
  18. * 08-12-94 GJF Disable warning 4514 instead of 4505.
  19. * 11-03-94 GJF Changed pack pragma to 8 byte alignment.
  20. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  21. * 02-14-95 CFW Clean up Mac merge.
  22. * 05-11-95 CFW Only for use by C++ programs.
  23. * 12-14-95 JWM Add "#pragma once".
  24. * 03-04-96 JWM Made entire file #ifdef _OLD_IOSTREAMS.
  25. * 04-09-96 SKS Change _CRTIMP to _CRTIMP1 for special iostream build
  26. * 04-15-96 JWM Remove _OLD_IOSTREAMS, add '#pragma comment(lib,"cirt")'.
  27. * 04-16-96 JWM '#include useoldio.h' replaces '#pragma comment(...)'.
  28. * 02-24-97 GJF Cleaned out obsolete support for _NTSDK. Also,
  29. * detab-ed.
  30. * 05-17-99 PML Remove all Macintosh support.
  31. *
  32. ****/
  33. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  34. #pragma once
  35. #endif
  36. #ifdef __cplusplus
  37. #ifndef _INC_STDIOSTREAM
  38. #define _INC_STDIOSTREAM
  39. #if !defined(_WIN32)
  40. #error ERROR: Only Win32 target supported!
  41. #endif
  42. #ifndef _CRTBLD
  43. /* This version of the header files is NOT for user programs.
  44. * It is intended for use when building the C runtimes ONLY.
  45. * The version intended for public use will not have this message.
  46. */
  47. #error ERROR: Use of C runtime library internal header file.
  48. #endif /* _CRTBLD */
  49. #ifdef _MSC_VER
  50. // Currently, all MS C compilers for Win32 platforms default to 8 byte
  51. // alignment.
  52. #pragma pack(push,8)
  53. #include <useoldio.h>
  54. #endif // _MSC_VER
  55. /* Define _CRTIMP */
  56. #ifndef _CRTIMP
  57. /* current definition */
  58. #ifdef CRTDLL
  59. #define _CRTIMP __declspec(dllexport)
  60. #else /* ndef CRTDLL */
  61. #ifdef _DLL
  62. #define _CRTIMP __declspec(dllimport)
  63. #else /* ndef _DLL */
  64. #define _CRTIMP
  65. #endif /* _DLL */
  66. #endif /* CRTDLL */
  67. #endif /* _CRTIMP */
  68. #ifndef _INTERNAL_IFSTRIP_
  69. /* Define _CRTIMP1 */
  70. #ifndef _CRTIMP1
  71. #ifdef CRTDLL1
  72. #define _CRTIMP1 __declspec(dllexport)
  73. #else /* ndef CRTDLL1 */
  74. #define _CRTIMP1 _CRTIMP
  75. #endif /* CRTDLL1 */
  76. #endif /* _CRTIMP1 */
  77. #endif /* _INTERNAL_IFSTRIP_ */
  78. #include <iostream.h>
  79. #include <stdio.h>
  80. #ifdef _MSC_VER
  81. #pragma warning(disable:4514) // disable unwanted /W4 warning
  82. // #pragma warning(default:4514) // use this to reenable, if necessary
  83. #endif // _MSC_VER
  84. class _CRTIMP1 stdiobuf : public streambuf {
  85. public:
  86. stdiobuf(FILE* f);
  87. FILE * stdiofile() { return _str; }
  88. virtual int pbackfail(int c);
  89. virtual int overflow(int c = EOF);
  90. virtual int underflow();
  91. virtual streampos seekoff( streamoff, ios::seek_dir, int =ios::in|ios::out);
  92. virtual int sync();
  93. ~stdiobuf();
  94. int setrwbuf(int _rsize, int _wsize);
  95. // protected:
  96. // virtual int doallocate();
  97. private:
  98. FILE * _str;
  99. };
  100. // obsolescent
  101. class _CRTIMP1 stdiostream : public iostream { // note: spec.'d as : public IOS...
  102. public:
  103. stdiostream(FILE *);
  104. ~stdiostream();
  105. stdiobuf* rdbuf() const { return (stdiobuf*) ostream::rdbuf(); }
  106. private:
  107. };
  108. #ifdef _MSC_VER
  109. // Restore default packing
  110. #pragma pack(pop)
  111. #endif // _MSC_VER
  112. #endif // _INC_STDIOSTREAM
  113. #endif /* __cplusplus */