home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / iostream.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  3KB  |  132 lines

  1. /***
  2. *iostream.h - definitions/declarations for iostream classes
  3. *
  4. *       Copyright (c) 1990-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file defines the classes, values, macros, and functions
  8. *       used by the iostream classes.
  9. *       [AT&T C++]
  10. *
  11. *       [Public]
  12. *
  13. ****/
  14.  
  15. #if _MSC_VER > 1000
  16. #pragma once
  17. #endif  /* _MSC_VER > 1000 */
  18.  
  19. #ifdef __cplusplus
  20.  
  21. #ifndef _INC_IOSTREAM
  22. #define _INC_IOSTREAM
  23.  
  24. #if !defined (_WIN32) && !defined (_MAC)
  25. #error ERROR: Only Mac or Win32 targets supported!
  26. #endif  /* !defined (_WIN32) && !defined (_MAC) */
  27.  
  28. #ifndef _CRTBLD
  29. /* This version of the header files is NOT for user programs.
  30.  * It is intended for use when building the C runtimes ONLY.
  31.  * The version intended for public use will not have this message.
  32.  */
  33. #error ERROR: Use of C runtime library internal header file.
  34. #endif  /* _CRTBLD */
  35.  
  36. #ifdef _MSC_VER
  37. // Currently, all MS C compilers for Win32 platforms default to 8 byte
  38. // alignment.
  39. #pragma pack(push,8)
  40.  
  41. #include <useoldio.h>
  42.  
  43. #endif  /* _MSC_VER */
  44.  
  45. #ifndef _INTERNAL_IFSTRIP_
  46. #include <cruntime.h>
  47. #ifndef _WINSTATIC
  48. #define _WINSTATIC
  49. #endif  /* _WINSTATIC */
  50.  
  51. #endif  /* _INTERNAL_IFSTRIP_ */
  52.  
  53. /* Define _CRTIMP */
  54.  
  55. #ifndef _CRTIMP
  56. #ifdef CRTDLL
  57. #define _CRTIMP __declspec(dllexport)
  58. #else  /* CRTDLL */
  59. #ifdef _DLL
  60. #define _CRTIMP __declspec(dllimport)
  61. #else  /* _DLL */
  62. #define _CRTIMP
  63. #endif  /* _DLL */
  64. #endif  /* CRTDLL */
  65. #endif  /* _CRTIMP */
  66.  
  67. #ifndef _INTERNAL_IFSTRIP_
  68. /* Define _CRTIMP1 */
  69.  
  70. #ifndef _CRTIMP1
  71. #ifdef CRTDLL1
  72. #define _CRTIMP1 __declspec(dllexport)
  73. #else  /* CRTDLL1 */
  74. #define _CRTIMP1 _CRTIMP
  75. #endif  /* CRTDLL1 */
  76. #endif  /* _CRTIMP1 */
  77. #endif  /* _INTERNAL_IFSTRIP_ */
  78.  
  79. typedef long streamoff, streampos;
  80.  
  81. #include <ios.h>                // Define ios.
  82.  
  83. #include <streamb.h>            // Define streambuf.
  84.  
  85. #include <istream.h>            // Define istream.
  86.  
  87. #include <ostream.h>            // Define ostream.
  88.  
  89. #ifdef _MSC_VER
  90. // C4514: "unreferenced inline function has been removed"
  91. #pragma warning(disable:4514) // disable C4514 warning
  92. // #pragma warning(default:4514)        // use this to reenable, if desired
  93. #endif  /* _MSC_VER */
  94.  
  95. class _CRTIMP1 iostream : public istream, public ostream {
  96. public:
  97.         iostream(streambuf*);
  98.         virtual ~iostream();
  99. protected:
  100.         iostream();
  101.         iostream(const iostream&);
  102. inline iostream& operator=(streambuf*);
  103. inline iostream& operator=(iostream&);
  104. private:
  105.         iostream(ios&);
  106.         iostream(istream&);
  107.         iostream(ostream&);
  108. };
  109.  
  110. inline iostream& iostream::operator=(streambuf* _sb) { istream::operator=(_sb); ostream::operator=(_sb); return *this; }
  111.  
  112. inline iostream& iostream::operator=(iostream& _strm) { return operator=(_strm.rdbuf()); }
  113.  
  114. class _CRTIMP1 Iostream_init {
  115. public:
  116.         Iostream_init();
  117.         Iostream_init(ios &, int =0);   // treat as private
  118.         ~Iostream_init();
  119. };
  120.  
  121. // used internally
  122. // static Iostream_init __iostreaminit; // initializes cin/cout/cerr/clog
  123.  
  124. #ifdef _MSC_VER
  125. // Restore previous packing
  126. #pragma pack(pop)
  127. #endif  /* _MSC_VER */
  128.  
  129. #endif  /* _INC_IOSTREAM */
  130.  
  131. #endif  /* __cplusplus */
  132.