Home | History | Annotate | Download | only in 7z
      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   UInt64 _size;
     27 
     28   const UInt32 *_indexes;
     29   unsigned _numFiles;
     30   unsigned _index;
     31 
     32   CMyComPtr<IArchiveUpdateCallback> _updateCallback;
     33 
     34   HRESULT OpenStream();
     35   void AddFileInfo(bool isProcessed);
     36 
     37 public:
     38   CRecordVector<bool> Processed;
     39   CRecordVector<UInt32> CRCs;
     40   CRecordVector<UInt64> Sizes;
     41 
     42   MY_UNKNOWN_IMP2(ISequentialInStream, ICompressGetSubStreamSize)
     43   STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
     44   STDMETHOD(GetSubStreamSize)(UInt64 subStream, UInt64 *value);
     45 
     46   void Init(IArchiveUpdateCallback *updateCallback, const UInt32 *indexes, unsigned numFiles);
     47 
     48   bool WasFinished() const { return _index == _numFiles; }
     49 
     50   UInt64 GetFullSize() const
     51   {
     52     UInt64 size = 0;
     53     FOR_VECTOR (i, Sizes)
     54       size += Sizes[i];
     55     return size;
     56   }
     57 };
     58 
     59 }}
     60 
     61 #endif
     62