| 1 |
// IStream.h |
| 2 |
|
| 3 |
#ifndef __ISTREAM_H |
| 4 |
#define __ISTREAM_H |
| 5 |
|
| 6 |
#include "../Common/MyUnknown.h" |
| 7 |
#include "../Common/Types.h" |
| 8 |
|
| 9 |
// "23170F69-40C1-278A-0000-000000xx0000" |
| 10 |
|
| 11 |
#define STREAM_INTERFACE_SUB(i, b, x) \ |
| 12 |
DEFINE_GUID(IID_ ## i, \ |
| 13 |
0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x00, 0x00, x, 0x00, 0x00); \ |
| 14 |
struct i: public b |
| 15 |
|
| 16 |
#define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x) |
| 17 |
|
| 18 |
STREAM_INTERFACE(ISequentialInStream, 0x01) |
| 19 |
{ |
| 20 |
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE; |
| 21 |
STDMETHOD(ReadPart)(void *data, UInt32 size, UInt32 *processedSize) PURE; |
| 22 |
|
| 23 |
// For both functions Out: if (*processedSize == 0) then |
| 24 |
// there are no more bytes in stream. |
| 25 |
// Read function always tries to read "size" bytes from stream. It |
| 26 |
// can read less only if it reaches end of stream. |
| 27 |
// ReadPart function can read X bytes: (0<=X<="size") and X can |
| 28 |
// be less than number of remaining bytes in stream. |
| 29 |
}; |
| 30 |
|
| 31 |
STREAM_INTERFACE(ISequentialOutStream, 0x02) |
| 32 |
{ |
| 33 |
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE; |
| 34 |
STDMETHOD(WritePart)(const void *data, UInt32 size, UInt32 *processedSize) PURE; |
| 35 |
}; |
| 36 |
|
| 37 |
STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03) |
| 38 |
{ |
| 39 |
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
| 40 |
}; |
| 41 |
|
| 42 |
STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04) |
| 43 |
{ |
| 44 |
STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
| 45 |
STDMETHOD(SetSize)(Int64 newSize) PURE; |
| 46 |
}; |
| 47 |
|
| 48 |
STREAM_INTERFACE(IStreamGetSize, 0x06) |
| 49 |
{ |
| 50 |
STDMETHOD(GetSize)(UInt64 *size) PURE; |
| 51 |
}; |
| 52 |
|
| 53 |
STREAM_INTERFACE(IOutStreamFlush, 0x07) |
| 54 |
{ |
| 55 |
STDMETHOD(Flush)() PURE; |
| 56 |
}; |
| 57 |
|
| 58 |
#endif |