Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | // IStream.h |
michael@0 | 2 | |
michael@0 | 3 | #ifndef __ISTREAM_H |
michael@0 | 4 | #define __ISTREAM_H |
michael@0 | 5 | |
michael@0 | 6 | #include "../Common/MyUnknown.h" |
michael@0 | 7 | #include "../Common/Types.h" |
michael@0 | 8 | |
michael@0 | 9 | // "23170F69-40C1-278A-0000-000300xx0000" |
michael@0 | 10 | |
michael@0 | 11 | #define STREAM_INTERFACE_SUB(i, b, x) \ |
michael@0 | 12 | DEFINE_GUID(IID_ ## i, \ |
michael@0 | 13 | 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 0x00, x, 0x00, 0x00); \ |
michael@0 | 14 | struct i: public b |
michael@0 | 15 | |
michael@0 | 16 | #define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x) |
michael@0 | 17 | |
michael@0 | 18 | STREAM_INTERFACE(ISequentialInStream, 0x01) |
michael@0 | 19 | { |
michael@0 | 20 | STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE; |
michael@0 | 21 | /* |
michael@0 | 22 | Out: if size != 0, return_value = S_OK and (*processedSize == 0), |
michael@0 | 23 | then there are no more bytes in stream. |
michael@0 | 24 | if (size > 0) && there are bytes in stream, |
michael@0 | 25 | this function must read at least 1 byte. |
michael@0 | 26 | This function is allowed to read less than number of remaining bytes in stream. |
michael@0 | 27 | You must call Read function in loop, if you need exact amount of data |
michael@0 | 28 | */ |
michael@0 | 29 | }; |
michael@0 | 30 | |
michael@0 | 31 | STREAM_INTERFACE(ISequentialOutStream, 0x02) |
michael@0 | 32 | { |
michael@0 | 33 | STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE; |
michael@0 | 34 | /* |
michael@0 | 35 | if (size > 0) this function must write at least 1 byte. |
michael@0 | 36 | This function is allowed to write less than "size". |
michael@0 | 37 | You must call Write function in loop, if you need to write exact amount of data |
michael@0 | 38 | */ |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03) |
michael@0 | 42 | { |
michael@0 | 43 | STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04) |
michael@0 | 47 | { |
michael@0 | 48 | STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
michael@0 | 49 | STDMETHOD(SetSize)(Int64 newSize) PURE; |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | STREAM_INTERFACE(IStreamGetSize, 0x06) |
michael@0 | 53 | { |
michael@0 | 54 | STDMETHOD(GetSize)(UInt64 *size) PURE; |
michael@0 | 55 | }; |
michael@0 | 56 | |
michael@0 | 57 | STREAM_INTERFACE(IOutStreamFlush, 0x07) |
michael@0 | 58 | { |
michael@0 | 59 | STDMETHOD(Flush)() PURE; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | #endif |