Mercurial > vba-linux
comparison src/win32/7zip/7z/CPP/7zip/Archive/Zip/ZipIn.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // Archive/ZipIn.h | |
2 | |
3 #ifndef __ZIP_IN_H | |
4 #define __ZIP_IN_H | |
5 | |
6 #include "../../../Common/MyCom.h" | |
7 #include "../../IStream.h" | |
8 | |
9 #include "ZipHeader.h" | |
10 #include "ZipItemEx.h" | |
11 | |
12 namespace NArchive { | |
13 namespace NZip { | |
14 | |
15 class CInArchiveException | |
16 { | |
17 public: | |
18 enum ECauseType | |
19 { | |
20 kUnexpectedEndOfArchive = 0, | |
21 kArchiceHeaderCRCError, | |
22 kFileHeaderCRCError, | |
23 kIncorrectArchive, | |
24 kDataDescroptorsAreNotSupported, | |
25 kMultiVolumeArchiveAreNotSupported, | |
26 kReadStreamError, | |
27 kSeekStreamError | |
28 } | |
29 Cause; | |
30 CInArchiveException(ECauseType cause): Cause(cause) {} | |
31 }; | |
32 | |
33 class CInArchiveInfo | |
34 { | |
35 public: | |
36 UInt64 Base; | |
37 UInt64 StartPosition; | |
38 CByteBuffer Comment; | |
39 CInArchiveInfo(): Base(0), StartPosition(0) {} | |
40 void Clear() | |
41 { | |
42 Base = 0; | |
43 StartPosition = 0; | |
44 Comment.SetCapacity(0); | |
45 } | |
46 }; | |
47 | |
48 class CProgressVirt | |
49 { | |
50 public: | |
51 STDMETHOD(SetTotal)(UInt64 numFiles) PURE; | |
52 STDMETHOD(SetCompleted)(UInt64 numFiles) PURE; | |
53 }; | |
54 | |
55 struct CCdInfo | |
56 { | |
57 // UInt64 NumEntries; | |
58 UInt64 Size; | |
59 UInt64 Offset; | |
60 }; | |
61 | |
62 class CInArchive | |
63 { | |
64 CMyComPtr<IInStream> m_Stream; | |
65 UInt32 m_Signature; | |
66 UInt64 m_StreamStartPosition; | |
67 UInt64 m_Position; | |
68 AString m_NameBuffer; | |
69 | |
70 HRESULT Seek(UInt64 offset); | |
71 | |
72 HRESULT FindAndReadMarker(IInStream *stream, const UInt64 *searchHeaderSizeLimit); | |
73 bool ReadUInt32(UInt32 &signature); | |
74 AString ReadFileName(UInt32 nameSize); | |
75 | |
76 HRESULT ReadBytes(void *data, UInt32 size, UInt32 *processedSize); | |
77 bool ReadBytesAndTestSize(void *data, UInt32 size); | |
78 void SafeReadBytes(void *data, UInt32 size); | |
79 void ReadBuffer(CByteBuffer &buffer, UInt32 size); | |
80 Byte ReadByte(); | |
81 UInt16 ReadUInt16(); | |
82 UInt32 ReadUInt32(); | |
83 UInt64 ReadUInt64(); | |
84 | |
85 void IncreaseRealPosition(UInt64 addValue); | |
86 | |
87 void ReadExtra(UInt32 extraSize, CExtraBlock &extraBlock, | |
88 UInt64 &unpackSize, UInt64 &packSize, UInt64 &localHeaderOffset, UInt32 &diskStartNumber); | |
89 HRESULT ReadLocalItem(CItemEx &item); | |
90 HRESULT ReadLocalItemDescriptor(CItemEx &item); | |
91 HRESULT ReadCdItem(CItemEx &item); | |
92 HRESULT TryEcd64(UInt64 offset, CCdInfo &cdInfo); | |
93 HRESULT FindCd(CCdInfo &cdInfo); | |
94 HRESULT TryReadCd(CObjectVector<CItemEx> &items, UInt64 cdOffset, UInt64 cdSize, CProgressVirt *progress); | |
95 HRESULT ReadCd(CObjectVector<CItemEx> &items, UInt64 &cdOffset, UInt64 &cdSize, CProgressVirt *progress); | |
96 HRESULT ReadLocalsAndCd(CObjectVector<CItemEx> &items, CProgressVirt *progress, UInt64 &cdOffset); | |
97 public: | |
98 CInArchiveInfo m_ArchiveInfo; | |
99 bool IsZip64; | |
100 | |
101 HRESULT ReadHeaders(CObjectVector<CItemEx> &items, CProgressVirt *progress); | |
102 HRESULT ReadLocalItemAfterCdItem(CItemEx &item); | |
103 HRESULT ReadLocalItemAfterCdItemFull(CItemEx &item); | |
104 HRESULT Open(IInStream *stream, const UInt64 *searchHeaderSizeLimit); | |
105 void Close(); | |
106 void GetArchiveInfo(CInArchiveInfo &archiveInfo) const; | |
107 bool SeekInArchive(UInt64 position); | |
108 ISequentialInStream *CreateLimitedStream(UInt64 position, UInt64 size); | |
109 IInStream* CreateStream(); | |
110 | |
111 bool IsOpen() const { return m_Stream != NULL; } | |
112 }; | |
113 | |
114 }} | |
115 | |
116 #endif |