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#include "IDecl.h" 10 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) 13 14STREAM_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}; 26 27STREAM_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}; 36 37STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03) 38{ 39 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; 40}; 41 42STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04) 43{ 44 STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; 45 STDMETHOD(SetSize)(UInt64 newSize) PURE; 46}; 47 48STREAM_INTERFACE(IStreamGetSize, 0x06) 49{ 50 STDMETHOD(GetSize)(UInt64 *size) PURE; 51}; 52 53STREAM_INTERFACE(IOutStreamFlush, 0x07) 54{ 55 STDMETHOD(Flush)() PURE; 56}; 57 58#endif 59