1 // 7zSpecStream.h 2 3 #ifndef __7Z_SPEC_STREAM_H 4 #define __7Z_SPEC_STREAM_H 5 6 #include "../../IStream.h" 7 #include "../../ICoder.h" 8 #include "../../../Common/MyCom.h" 9 10 class CSequentialInStreamSizeCount2: 11 public ISequentialInStream, 12 public ICompressGetSubStreamSize, 13 public CMyUnknownImp 14 { 15 CMyComPtr<ISequentialInStream> _stream; 16 CMyComPtr<ICompressGetSubStreamSize> _getSubStreamSize; 17 UInt64 _size; 18 public: Init(ISequentialInStream * stream)19 void Init(ISequentialInStream *stream) 20 { 21 _stream = stream; 22 _getSubStreamSize = 0; 23 _stream.QueryInterface(IID_ICompressGetSubStreamSize, &_getSubStreamSize); 24 _size = 0; 25 } GetSize()26 UInt64 GetSize() const { return _size; } 27 28 MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) 29 30 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 31 32 STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 33 }; 34 35 #endif 36