Source code of Windows XP (NT5)
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.

81 lines
2.2 KiB

  1. /***
  2. * iostream.cpp - definitions for iostream classes
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the member function definitions for iostream classes. Also,
  8. * precompile all header files used by iostream lib into iostream.pch.
  9. *
  10. *Revision History:
  11. * 09-23-91 KRS Created.
  12. * 11-13-91 KRS Rearranged.
  13. * 11-20-91 KRS Added copy constructor and assignment operators.
  14. * 01-23-92 KRS Merge pch.cxx into this file.
  15. * 06-14-95 CFW Comment cleanup.
  16. *
  17. *******************************************************************************/
  18. // NOTE: the follow must include ALL header files used by any of the iostream
  19. // source files which we want built into iostream.pch. It is necessary
  20. // to have the pch associated with exactly one of the library modules
  21. // for efficient storage of Codeview info.
  22. #include <cruntime.h>
  23. #include <internal.h>
  24. #include <limits.h>
  25. #include <stdlib.h>
  26. #include <string.h>
  27. #include <stdio.h>
  28. #include <errno.h>
  29. #include <ctype.h>
  30. #include <share.h>
  31. #include <fcntl.h>
  32. #include <io.h>
  33. #include <ios.h>
  34. #include <sys\types.h>
  35. #include <float.h>
  36. #include <iostream.h>
  37. #include <fstream.h>
  38. #include <strstrea.h>
  39. #include <stdiostr.h>
  40. #include <dbgint.h>
  41. #pragma hdrstop // end of headers to precompile
  42. #if defined(_MT) && defined(_DEBUG)
  43. // Critical section size should never change, but just to be safe...
  44. #include <windows.h>
  45. #endif
  46. iostream::iostream()
  47. : istream(), ostream()
  48. {
  49. #ifdef _MT
  50. _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  51. #endif
  52. }
  53. iostream::iostream(streambuf * _sb)
  54. : istream(_sb), ostream(_sb)
  55. {
  56. #ifdef _MT
  57. _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  58. #endif
  59. }
  60. iostream::iostream(const iostream& _strm)
  61. : istream(_strm), ostream(_strm)
  62. {
  63. #ifdef _MT
  64. _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  65. #endif
  66. }
  67. iostream::~iostream()
  68. {
  69. // if both input and output share the same streambuf, but not the same ios,
  70. // make sure only deleted once
  71. if ((istream::bp==ostream::bp) && (&istream::bp!=&ostream::bp))
  72. istream::bp = NULL; // let ostream::ios::~ios() do it
  73. }