1 // 7zFolderInStream.h 2 3 #ifndef __7Z_FOLDER_IN_STREAM_H 4 #define __7Z_FOLDER_IN_STREAM_H 5 6 #include "../../../../C/7zCrc.h" 7 8 #include "../../../Common/MyCom.h" 9 #include "../../../Common/MyVector.h" 10 11 #include "../../ICoder.h" 12 #include "../IArchive.h" 13 14 namespace NArchive { 15 namespace N7z { 16 17 class CFolderInStream: 18 public ISequentialInStream, 19 public ICompressGetSubStreamSize, 20 public CMyUnknownImp 21 { 22 CMyComPtr<ISequentialInStream> _stream; 23 UInt64 _pos; 24 UInt32 _crc; 25 bool _size_Defined; 26 bool _times_Defined; 27 UInt64 _size; 28 FILETIME _cTime; 29 FILETIME _aTime; 30 FILETIME _mTime; 31 UInt32 _attrib; 32 33 unsigned _numFiles; 34 const UInt32 *_indexes; 35 36 CMyComPtr<IArchiveUpdateCallback> _updateCallback; 37 38 HRESULT OpenStream(); 39 HRESULT AddFileInfo(bool isProcessed); 40 41 public: 42 CRecordVector<bool> Processed; 43 CRecordVector<UInt32> CRCs; 44 CRecordVector<UInt64> Sizes; 45 CRecordVector<UInt64> CTimes; 46 CRecordVector<UInt64> ATimes; 47 CRecordVector<UInt64> MTimes; 48 CRecordVector<UInt32> Attribs; 49 CRecordVector<bool> TimesDefined; 50 51 bool Need_CTime; 52 bool Need_ATime; 53 bool Need_MTime; 54 bool Need_Attrib; 55 56 // CMyComPtr<IArchiveUpdateCallbackArcProp> _reportArcProp; 57 58 MY_UNKNOWN_IMP2(ISequentialInStream, ICompressGetSubStreamSize) 59 STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize); 60 STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value); 61 62 void Init(IArchiveUpdateCallback *updateCallback, const UInt32 *indexes, unsigned numFiles); 63 WasFinished()64 bool WasFinished() const { return Processed.Size() == _numFiles; } 65 GetFullSize()66 UInt64 GetFullSize() const 67 { 68 UInt64 size = 0; 69 FOR_VECTOR (i, Sizes) 70 size += Sizes[i]; 71 return size; 72 } 73 CFolderInStream()74 CFolderInStream(): 75 Need_CTime(false), 76 Need_ATime(false), 77 Need_MTime(false), 78 Need_Attrib(false) 79 {} 80 }; 81 82 }} 83 84 #endif 85