1 // 7zFolderInStream.h 2 3 #ifndef __7Z_FOLDER_IN_STREAM_H 4 #define __7Z_FOLDER_IN_STREAM_H 5 6 #include "../../ICoder.h" 7 #include "../IArchive.h" 8 #include "../Common/InStreamWithCRC.h" 9 10 #include "7zItem.h" 11 12 namespace NArchive { 13 namespace N7z { 14 15 class CFolderInStream: 16 public ISequentialInStream, 17 public ICompressGetSubStreamSize, 18 public CMyUnknownImp 19 { 20 CSequentialInStreamWithCRC *_inStreamWithHashSpec; 21 CMyComPtr<ISequentialInStream> _inStreamWithHash; 22 CMyComPtr<IArchiveUpdateCallback> _updateCallback; 23 24 bool _currentSizeIsDefined; 25 bool _fileIsOpen; 26 UInt64 _currentSize; 27 UInt64 _filePos; 28 const UInt32 *_fileIndices; 29 UInt32 _numFiles; 30 UInt32 _fileIndex; 31 32 HRESULT OpenStream(); 33 HRESULT CloseStream(); 34 void AddDigest(); 35 36 public: 37 CRecordVector<bool> Processed; 38 CRecordVector<UInt32> CRCs; 39 CRecordVector<UInt64> Sizes; 40 41 MY_UNKNOWN_IMP1(ICompressGetSubStreamSize) 42 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 43 STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 44 45 CFolderInStream(); 46 void Init(IArchiveUpdateCallback *updateCallback, const UInt32 *fileIndices, UInt32 numFiles); GetFullSize()47 UInt64 GetFullSize() const 48 { 49 UInt64 size = 0; 50 for (int i = 0; i < Sizes.Size(); i++) 51 size += Sizes[i]; 52 return size; 53 } 54 }; 55 56 }} 57 58 #endif 59