Home | History | Annotate | Download | only in 7z
      1 // 7zUpdate.h
      2 
      3 #ifndef __7Z_UPDATE_H
      4 #define __7Z_UPDATE_H
      5 
      6 #include "../IArchive.h"
      7 
      8 // #include "../../Common/UniqBlocks.h"
      9 
     10 #include "7zCompressionMode.h"
     11 #include "7zIn.h"
     12 #include "7zOut.h"
     13 
     14 namespace NArchive {
     15 namespace N7z {
     16 
     17 /*
     18 struct CTreeFolder
     19 {
     20   UString Name;
     21   int Parent;
     22   CIntVector SubFolders;
     23   int UpdateItemIndex;
     24   int SortIndex;
     25   int SortIndexEnd;
     26 
     27   CTreeFolder(): UpdateItemIndex(-1) {}
     28 };
     29 */
     30 
     31 struct CUpdateItem
     32 {
     33   int IndexInArchive;
     34   int IndexInClient;
     35 
     36   UInt64 CTime;
     37   UInt64 ATime;
     38   UInt64 MTime;
     39 
     40   UInt64 Size;
     41   UString Name;
     42   /*
     43   bool IsAltStream;
     44   int ParentFolderIndex;
     45   int TreeFolderIndex;
     46   */
     47 
     48   // that code is not used in 9.26
     49   // int ParentSortIndex;
     50   // int ParentSortIndexEnd;
     51 
     52   UInt32 Attrib;
     53 
     54   bool NewData;
     55   bool NewProps;
     56 
     57   bool IsAnti;
     58   bool IsDir;
     59 
     60   bool AttribDefined;
     61   bool CTimeDefined;
     62   bool ATimeDefined;
     63   bool MTimeDefined;
     64 
     65   // int SecureIndex; // 0 means (no_security)
     66 
     67   bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
     68 
     69   CUpdateItem():
     70       // ParentSortIndex(-1),
     71       // IsAltStream(false),
     72       IsAnti(false),
     73       IsDir(false),
     74       AttribDefined(false),
     75       CTimeDefined(false),
     76       ATimeDefined(false),
     77       MTimeDefined(false)
     78       // SecureIndex(0)
     79       {}
     80   void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); };
     81 
     82   int GetExtensionPos() const;
     83   UString GetExtension() const;
     84 };
     85 
     86 struct CUpdateOptions
     87 {
     88   const CCompressionMethodMode *Method;
     89   const CCompressionMethodMode *HeaderMethod;
     90   bool UseFilters;
     91   bool MaxFilter;
     92 
     93   CHeaderOptions HeaderOptions;
     94 
     95   UInt64 NumSolidFiles;
     96   UInt64 NumSolidBytes;
     97   bool SolidExtension;
     98   bool RemoveSfxBlock;
     99   bool VolumeMode;
    100 };
    101 
    102 HRESULT Update(
    103     DECL_EXTERNAL_CODECS_LOC_VARS
    104     IInStream *inStream,
    105     const CDbEx *db,
    106     const CObjectVector<CUpdateItem> &updateItems,
    107     // const CObjectVector<CTreeFolder> &treeFolders, // treeFolders[0] is root
    108     // const CUniqBlocks &secureBlocks,
    109     COutArchive &archive,
    110     CArchiveDatabaseOut &newDatabase,
    111     ISequentialOutStream *seqOutStream,
    112     IArchiveUpdateCallback *updateCallback,
    113     const CUpdateOptions &options
    114     #ifndef _NO_CRYPTO
    115     , ICryptoGetTextPassword *getDecoderPassword
    116     #endif
    117     );
    118 }}
    119 
    120 #endif
    121