xref: /third_party/lzma/CPP/7zip/Archive/7z/7zUpdate.h (revision 370b324c)
1370b324cSopenharmony_ci// 7zUpdate.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_7Z_UPDATE_H
4370b324cSopenharmony_ci#define ZIP7_INC_7Z_UPDATE_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../IArchive.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci// #include "../../Common/UniqBlocks.h"
9370b324cSopenharmony_ci
10370b324cSopenharmony_ci#include "7zCompressionMode.h"
11370b324cSopenharmony_ci#include "7zIn.h"
12370b324cSopenharmony_ci
13370b324cSopenharmony_cinamespace NArchive {
14370b324cSopenharmony_cinamespace N7z {
15370b324cSopenharmony_ci
16370b324cSopenharmony_ci/*
17370b324cSopenharmony_cistruct CTreeFolder
18370b324cSopenharmony_ci{
19370b324cSopenharmony_ci  UString Name;
20370b324cSopenharmony_ci  int Parent;
21370b324cSopenharmony_ci  CIntVector SubFolders;
22370b324cSopenharmony_ci  int UpdateItemIndex;
23370b324cSopenharmony_ci  int SortIndex;
24370b324cSopenharmony_ci  int SortIndexEnd;
25370b324cSopenharmony_ci
26370b324cSopenharmony_ci  CTreeFolder(): UpdateItemIndex(-1) {}
27370b324cSopenharmony_ci};
28370b324cSopenharmony_ci*/
29370b324cSopenharmony_ci
30370b324cSopenharmony_cistruct CUpdateItem
31370b324cSopenharmony_ci{
32370b324cSopenharmony_ci  int IndexInArchive;
33370b324cSopenharmony_ci  unsigned IndexInClient;
34370b324cSopenharmony_ci
35370b324cSopenharmony_ci  UInt64 CTime;
36370b324cSopenharmony_ci  UInt64 ATime;
37370b324cSopenharmony_ci  UInt64 MTime;
38370b324cSopenharmony_ci
39370b324cSopenharmony_ci  UInt64 Size;
40370b324cSopenharmony_ci  UString Name;
41370b324cSopenharmony_ci  /*
42370b324cSopenharmony_ci  bool IsAltStream;
43370b324cSopenharmony_ci  int ParentFolderIndex;
44370b324cSopenharmony_ci  int TreeFolderIndex;
45370b324cSopenharmony_ci  */
46370b324cSopenharmony_ci
47370b324cSopenharmony_ci  // that code is not used in 9.26
48370b324cSopenharmony_ci  // int ParentSortIndex;
49370b324cSopenharmony_ci  // int ParentSortIndexEnd;
50370b324cSopenharmony_ci
51370b324cSopenharmony_ci  UInt32 Attrib;
52370b324cSopenharmony_ci
53370b324cSopenharmony_ci  bool NewData;
54370b324cSopenharmony_ci  bool NewProps;
55370b324cSopenharmony_ci
56370b324cSopenharmony_ci  bool IsAnti;
57370b324cSopenharmony_ci  bool IsDir;
58370b324cSopenharmony_ci
59370b324cSopenharmony_ci  bool AttribDefined;
60370b324cSopenharmony_ci  bool CTimeDefined;
61370b324cSopenharmony_ci  bool ATimeDefined;
62370b324cSopenharmony_ci  bool MTimeDefined;
63370b324cSopenharmony_ci
64370b324cSopenharmony_ci  // bool ATime_WasReadByAnalysis;
65370b324cSopenharmony_ci
66370b324cSopenharmony_ci  // int SecureIndex; // 0 means (no_security)
67370b324cSopenharmony_ci
68370b324cSopenharmony_ci  bool HasStream() const { return !IsDir && !IsAnti && Size != 0; }
69370b324cSopenharmony_ci  // bool HasStream() const { return !IsDir && !IsAnti /* && Size != 0 */; } // for test purposes
70370b324cSopenharmony_ci
71370b324cSopenharmony_ci  CUpdateItem():
72370b324cSopenharmony_ci      // ParentSortIndex(-1),
73370b324cSopenharmony_ci      // IsAltStream(false),
74370b324cSopenharmony_ci      IsAnti(false),
75370b324cSopenharmony_ci      IsDir(false),
76370b324cSopenharmony_ci      AttribDefined(false),
77370b324cSopenharmony_ci      CTimeDefined(false),
78370b324cSopenharmony_ci      ATimeDefined(false),
79370b324cSopenharmony_ci      MTimeDefined(false)
80370b324cSopenharmony_ci      // , ATime_WasReadByAnalysis(false)
81370b324cSopenharmony_ci      // SecureIndex(0)
82370b324cSopenharmony_ci      {}
83370b324cSopenharmony_ci  void SetDirStatusFromAttrib() { IsDir = ((Attrib & FILE_ATTRIBUTE_DIRECTORY) != 0); }
84370b324cSopenharmony_ci
85370b324cSopenharmony_ci  // unsigned GetExtensionPos() const;
86370b324cSopenharmony_ci  // UString GetExtension() const;
87370b324cSopenharmony_ci};
88370b324cSopenharmony_ci
89370b324cSopenharmony_cistruct CUpdateOptions
90370b324cSopenharmony_ci{
91370b324cSopenharmony_ci  const CCompressionMethodMode *Method;
92370b324cSopenharmony_ci  const CCompressionMethodMode *HeaderMethod;
93370b324cSopenharmony_ci  bool UseFilters; // use additional filters for some files
94370b324cSopenharmony_ci  bool MaxFilter;  // use BCJ2 filter instead of BCJ
95370b324cSopenharmony_ci  int AnalysisLevel;
96370b324cSopenharmony_ci
97370b324cSopenharmony_ci  UInt64 NumSolidFiles;
98370b324cSopenharmony_ci  UInt64 NumSolidBytes;
99370b324cSopenharmony_ci  bool SolidExtension;
100370b324cSopenharmony_ci
101370b324cSopenharmony_ci  bool UseTypeSorting;
102370b324cSopenharmony_ci
103370b324cSopenharmony_ci  bool RemoveSfxBlock;
104370b324cSopenharmony_ci  bool MultiThreadMixer;
105370b324cSopenharmony_ci
106370b324cSopenharmony_ci  bool Need_CTime;
107370b324cSopenharmony_ci  bool Need_ATime;
108370b324cSopenharmony_ci  bool Need_MTime;
109370b324cSopenharmony_ci  bool Need_Attrib;
110370b324cSopenharmony_ci  // bool Need_Crc;
111370b324cSopenharmony_ci
112370b324cSopenharmony_ci  CHeaderOptions HeaderOptions;
113370b324cSopenharmony_ci
114370b324cSopenharmony_ci  CUpdateOptions():
115370b324cSopenharmony_ci      Method(NULL),
116370b324cSopenharmony_ci      HeaderMethod(NULL),
117370b324cSopenharmony_ci      UseFilters(false),
118370b324cSopenharmony_ci      MaxFilter(false),
119370b324cSopenharmony_ci      AnalysisLevel(-1),
120370b324cSopenharmony_ci      NumSolidFiles((UInt64)(Int64)(-1)),
121370b324cSopenharmony_ci      NumSolidBytes((UInt64)(Int64)(-1)),
122370b324cSopenharmony_ci      SolidExtension(false),
123370b324cSopenharmony_ci      UseTypeSorting(true),
124370b324cSopenharmony_ci      RemoveSfxBlock(false),
125370b324cSopenharmony_ci      MultiThreadMixer(true),
126370b324cSopenharmony_ci      Need_CTime(false),
127370b324cSopenharmony_ci      Need_ATime(false),
128370b324cSopenharmony_ci      Need_MTime(false),
129370b324cSopenharmony_ci      Need_Attrib(false)
130370b324cSopenharmony_ci      // , Need_Crc(true)
131370b324cSopenharmony_ci    {}
132370b324cSopenharmony_ci};
133370b324cSopenharmony_ci
134370b324cSopenharmony_ciHRESULT Update(
135370b324cSopenharmony_ci    DECL_EXTERNAL_CODECS_LOC_VARS
136370b324cSopenharmony_ci    IInStream *inStream,
137370b324cSopenharmony_ci    const CDbEx *db,
138370b324cSopenharmony_ci    CObjectVector<CUpdateItem> &updateItems,
139370b324cSopenharmony_ci    // const CObjectVector<CTreeFolder> &treeFolders, // treeFolders[0] is root
140370b324cSopenharmony_ci    // const CUniqBlocks &secureBlocks,
141370b324cSopenharmony_ci    ISequentialOutStream *seqOutStream,
142370b324cSopenharmony_ci    IArchiveUpdateCallback *updateCallback,
143370b324cSopenharmony_ci    const CUpdateOptions &options);
144370b324cSopenharmony_ci}}
145370b324cSopenharmony_ci
146370b324cSopenharmony_ci#endif
147