|
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-000300xx0000" |
|
10 |
|
11 #define STREAM_INTERFACE_SUB(i, b, x) \ |
|
12 DEFINE_GUID(IID_ ## i, \ |
|
13 0x23170F69, 0x40C1, 0x278A, 0x00, 0x00, 0x00, 0x03, 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 /* |
|
22 Out: if size != 0, return_value = S_OK and (*processedSize == 0), |
|
23 then there are no more bytes in stream. |
|
24 if (size > 0) && there are bytes in stream, |
|
25 this function must read at least 1 byte. |
|
26 This function is allowed to read less than number of remaining bytes in stream. |
|
27 You must call Read function in loop, if you need exact amount of data |
|
28 */ |
|
29 }; |
|
30 |
|
31 STREAM_INTERFACE(ISequentialOutStream, 0x02) |
|
32 { |
|
33 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE; |
|
34 /* |
|
35 if (size > 0) this function must write at least 1 byte. |
|
36 This function is allowed to write less than "size". |
|
37 You must call Write function in loop, if you need to write exact amount of data |
|
38 */ |
|
39 }; |
|
40 |
|
41 STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03) |
|
42 { |
|
43 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
|
44 }; |
|
45 |
|
46 STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04) |
|
47 { |
|
48 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; |
|
49 STDMETHOD(SetSize)(Int64 newSize) PURE; |
|
50 }; |
|
51 |
|
52 STREAM_INTERFACE(IStreamGetSize, 0x06) |
|
53 { |
|
54 STDMETHOD(GetSize)(UInt64 *size) PURE; |
|
55 }; |
|
56 |
|
57 STREAM_INTERFACE(IOutStreamFlush, 0x07) |
|
58 { |
|
59 STDMETHOD(Flush)() PURE; |
|
60 }; |
|
61 |
|
62 #endif |