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