IStream.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. // IStream.h
  2. #ifndef __ISTREAM_H
  3. #define __ISTREAM_H
  4. #include "../Common/MyUnknown.h"
  5. #include "../Common/Types.h"
  6. #include "IDecl.h"
  7. #define STREAM_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 3, x)
  8. #define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x)
  9. STREAM_INTERFACE(ISequentialInStream, 0x01)
  10. {
  11. STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE;
  12. /*
  13. Out: if size != 0, return_value = S_OK and (*processedSize == 0),
  14. then there are no more bytes in stream.
  15. if (size > 0) && there are bytes in stream,
  16. this function must read at least 1 byte.
  17. This function is allowed to read less than number of remaining bytes in stream.
  18. You must call Read function in loop, if you need exact amount of data
  19. */
  20. };
  21. STREAM_INTERFACE(ISequentialOutStream, 0x02)
  22. {
  23. STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE;
  24. /*
  25. if (size > 0) this function must write at least 1 byte.
  26. This function is allowed to write less than "size".
  27. You must call Write function in loop, if you need to write exact amount of data
  28. */
  29. };
  30. STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
  31. {
  32. STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
  33. };
  34. STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04)
  35. {
  36. STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
  37. STDMETHOD(SetSize)(Int64 newSize) PURE;
  38. };
  39. STREAM_INTERFACE(IStreamGetSize, 0x06)
  40. {
  41. STDMETHOD(GetSize)(UInt64 *size) PURE;
  42. };
  43. STREAM_INTERFACE(IOutStreamFlush, 0x07)
  44. {
  45. STDMETHOD(Flush)() PURE;
  46. };
  47. #endif