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