7zUpdate.h revision baa3858d3f5d128a5c8466b700098109edcad5f2
1// 7zUpdate.h
2
3#ifndef __7Z_UPDATE_H
4#define __7Z_UPDATE_H
5
6#include "7zCompressionMode.h"
7#include "7zIn.h"
8#include "7zOut.h"
9
10#include "../IArchive.h"
11
12namespace NArchive {
13namespace N7z {
14
15struct CUpdateItem
16{
17  int IndexInArchive;
18  int IndexInClient;
19
20  UInt64 CTime;
21  UInt64 ATime;
22  UInt64 MTime;
23
24  UInt64 Size;
25  UString Name;
26
27  UInt32 Attrib;
28
29  bool NewData;
30  bool NewProps;
31
32  bool IsAnti;
33  bool IsDir;
34
35  bool AttribDefined;
36  bool CTimeDefined;
37  bool ATimeDefined;
38  bool MTimeDefined;
39
40  bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
41
42  CUpdateItem():
43      IsAnti(false),
44      IsDir(false),
45      AttribDefined(false),
46      CTimeDefined(false),
47      ATimeDefined(false),
48      MTimeDefined(false)
49      {}
50  void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); };
51
52  int GetExtensionPos() const;
53  UString GetExtension() const;
54};
55
56struct CUpdateOptions
57{
58  const CCompressionMethodMode *Method;
59  const CCompressionMethodMode *HeaderMethod;
60  bool UseFilters;
61  bool MaxFilter;
62
63  CHeaderOptions HeaderOptions;
64
65  UInt64 NumSolidFiles;
66  UInt64 NumSolidBytes;
67  bool SolidExtension;
68  bool RemoveSfxBlock;
69  bool VolumeMode;
70};
71
72HRESULT Update(
73    DECL_EXTERNAL_CODECS_LOC_VARS
74    IInStream *inStream,
75    const CArchiveDatabaseEx *db,
76    const CObjectVector<CUpdateItem> &updateItems,
77    COutArchive &archive,
78    CArchiveDatabase &newDatabase,
79    ISequentialOutStream *seqOutStream,
80    IArchiveUpdateCallback *updateCallback,
81    const CUpdateOptions &options
82    #ifndef _NO_CRYPTO
83    , ICryptoGetTextPassword *getDecoderPassword
84    #endif
85    );
86}}
87
88#endif
89