view src/win32/7zip/7z/CPP/7zip/IStream.h @ 1:f9f4f1b99eed

importing src directory
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:27 -0600
parents
children
line wrap: on
line source
1 // IStream.h
3 #ifndef __ISTREAM_H
4 #define __ISTREAM_H
6 #include "../Common/MyUnknown.h"
7 #include "../Common/Types.h"
9 #include "IDecl.h"
11 #define STREAM_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 3, x)
12 #define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x)
14 STREAM_INTERFACE(ISequentialInStream, 0x01)
15 {
16 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE;
17 /*
18 Out: if size != 0, return_value = S_OK and (*processedSize == 0),
19 then there are no more bytes in stream.
20 if (size > 0) && there are bytes in stream,
21 this function must read at least 1 byte.
22 This function is allowed to read less than number of remaining bytes in stream.
23 You must call Read function in loop, if you need exact amount of data
24 */
25 };
27 STREAM_INTERFACE(ISequentialOutStream, 0x02)
28 {
29 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE;
30 /*
31 if (size > 0) this function must write at least 1 byte.
32 This function is allowed to write less than "size".
33 You must call Write function in loop, if you need to write exact amount of data
34 */
35 };
37 STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03)
38 {
39 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE;
40 };
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 };
48 STREAM_INTERFACE(IStreamGetSize, 0x06)
49 {
50 STDMETHOD(GetSize)(UInt64 *size) PURE;
51 };
53 STREAM_INTERFACE(IOutStreamFlush, 0x07)
54 {
55 STDMETHOD(Flush)() PURE;
56 };
58 #endif