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.

85 lines
2.1 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Copyright (C) 1992, Microsoft Corporation.
  4. //
  5. // File: STREAMS.HXX
  6. //
  7. // Contents:
  8. //
  9. // Classes: CStream, CStreamA, CStreamW, CStreamASCIIStr, CStreamUnicodeStr
  10. //
  11. // History: 29-Jul-92 MikeHew Created
  12. // 23-Sep-92 AmyA Added CStreamUnicodeStr
  13. // Rewrote CStreamASCIIStr
  14. // 02-Nov-92 AmyA Added CSubStream
  15. // 20-Nov-92 AmyA Rewrote all streams for input/
  16. // output buffering
  17. //
  18. // Notes:
  19. //
  20. //----------------------------------------------------------------------------
  21. #pragma once
  22. #ifdef DISPLAY_INCLUDES
  23. #pragma message( "#include <" __FILE__ ">..." )
  24. #endif
  25. #include <sys\types.h> // for BOOL typedef
  26. #include <memory.h> // for memcpy
  27. //+---------------------------------------------------------------------------
  28. //
  29. // Class: CStream
  30. //
  31. // Purpose: General stream interface
  32. //
  33. // History: 29-Jul-92 MikeHew Created
  34. // 18-Nov-92 AmyA Removed GetChar(), now in CStreamA
  35. // and CStreamW
  36. //
  37. // Notes:
  38. //
  39. //----------------------------------------------------------------------------
  40. class CStream
  41. {
  42. public:
  43. CStream () : _eof(FALSE) {}
  44. virtual ~CStream() {};
  45. enum SEEK
  46. {
  47. SET = 0, // Seek from beginning of stream
  48. CUR = 1, // Seek from current position
  49. END = 2 // Seek from end
  50. };
  51. //
  52. // Status functions
  53. //
  54. virtual BOOL Ok() = 0;
  55. inline BOOL Eof() { return _eof; }
  56. //
  57. // Input from stream functions
  58. //
  59. virtual unsigned APINOT Read( void *dest, unsigned size ) = 0;
  60. //
  61. // Output to stream functions
  62. //
  63. virtual unsigned APINOT Write( const void *source, unsigned size ) = 0;
  64. //
  65. // Misc
  66. //
  67. virtual int APINOT Seek( LONG offset, SEEK origin ) = 0;
  68. protected:
  69. BOOL _eof;
  70. };