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