rlm@1: // IStream.h rlm@1: rlm@1: #ifndef __ISTREAM_H rlm@1: #define __ISTREAM_H rlm@1: rlm@1: #include "../Common/MyUnknown.h" rlm@1: #include "../Common/Types.h" rlm@1: rlm@1: #include "IDecl.h" rlm@1: rlm@1: #define STREAM_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 3, x) rlm@1: #define STREAM_INTERFACE(i, x) STREAM_INTERFACE_SUB(i, IUnknown, x) rlm@1: rlm@1: STREAM_INTERFACE(ISequentialInStream, 0x01) rlm@1: { rlm@1: STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize) PURE; rlm@1: /* rlm@1: Out: if size != 0, return_value = S_OK and (*processedSize == 0), rlm@1: then there are no more bytes in stream. rlm@1: if (size > 0) && there are bytes in stream, rlm@1: this function must read at least 1 byte. rlm@1: This function is allowed to read less than number of remaining bytes in stream. rlm@1: You must call Read function in loop, if you need exact amount of data rlm@1: */ rlm@1: }; rlm@1: rlm@1: STREAM_INTERFACE(ISequentialOutStream, 0x02) rlm@1: { rlm@1: STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize) PURE; rlm@1: /* rlm@1: if (size > 0) this function must write at least 1 byte. rlm@1: This function is allowed to write less than "size". rlm@1: You must call Write function in loop, if you need to write exact amount of data rlm@1: */ rlm@1: }; rlm@1: rlm@1: STREAM_INTERFACE_SUB(IInStream, ISequentialInStream, 0x03) rlm@1: { rlm@1: STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; rlm@1: }; rlm@1: rlm@1: STREAM_INTERFACE_SUB(IOutStream, ISequentialOutStream, 0x04) rlm@1: { rlm@1: STDMETHOD(Seek)(Int64 offset, UInt32 seekOrigin, UInt64 *newPosition) PURE; rlm@1: STDMETHOD(SetSize)(Int64 newSize) PURE; rlm@1: }; rlm@1: rlm@1: STREAM_INTERFACE(IStreamGetSize, 0x06) rlm@1: { rlm@1: STDMETHOD(GetSize)(UInt64 *size) PURE; rlm@1: }; rlm@1: rlm@1: STREAM_INTERFACE(IOutStreamFlush, 0x07) rlm@1: { rlm@1: STDMETHOD(Flush)() PURE; rlm@1: }; rlm@1: rlm@1: #endif