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