Stream.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /****************************************************************************
  19. *
  20. * FILE
  21. * $Archive: $
  22. *
  23. * DESCRIPTION
  24. * Base class for data streaming functionality
  25. *
  26. * PROGRAMMER
  27. * Denzil E. Long, Jr.
  28. * $Author: $
  29. *
  30. * VERSION INFO
  31. * $Modtime: $
  32. * $Revision: $
  33. *
  34. ****************************************************************************/
  35. #ifndef STREAM_H
  36. #define STREAM_H
  37. #include <Support\UTypes.h>
  38. class Stream
  39. {
  40. public:
  41. // Stream marker positioning
  42. typedef enum
  43. {
  44. FromStart = 0,
  45. FromMarker,
  46. FromEnd,
  47. } EStreamFrom;
  48. //! Get the length of the stream
  49. virtual UInt32 GetLength(void) = 0;
  50. //! Set the length of the stream
  51. virtual void SetLength(UInt32 length) = 0;
  52. //! Get current position of stream marker
  53. virtual UInt32 GetMarker(void) = 0;
  54. //! Set position of stream marker
  55. virtual void SetMarker(Int32 offset, EStreamFrom from) = 0;
  56. //! End of stream test
  57. virtual bool AtEnd(void) = 0;
  58. //! Retrieve a sequence of bytes.
  59. virtual UInt32 GetBytes(void* ptr, UInt32 bytes) = 0;
  60. //! Write a sequence of bytes
  61. virtual UInt32 PutBytes(const void* ptr, UInt32 bytes) = 0;
  62. //! Retrieve a sequence of bytes without advancing marker.
  63. virtual UInt32 PeekBytes(void* ptr, UInt32 bytes) = 0;
  64. //! Flush the stream
  65. virtual void Flush(void) = 0;
  66. };
  67. #endif // STREAM_H