sl@0
|
1 |
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// ziparchive.h
|
sl@0
|
15 |
// $Revision: 1.1 $
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef _EZIP_ARCHIVE_H_
|
sl@0
|
20 |
#define _EZIP_ARCHIVE_H_
|
sl@0
|
21 |
|
sl@0
|
22 |
#include "localtypes.h"
|
sl@0
|
23 |
|
sl@0
|
24 |
/**
|
sl@0
|
25 |
This class represents a zip archive
|
sl@0
|
26 |
|
sl@0
|
27 |
@publishedAll
|
sl@0
|
28 |
@released
|
sl@0
|
29 |
*/
|
sl@0
|
30 |
namespace TOLDEZIP
|
sl@0
|
31 |
{
|
sl@0
|
32 |
class CZipArchive: public CBase
|
sl@0
|
33 |
{
|
sl@0
|
34 |
public:
|
sl@0
|
35 |
|
sl@0
|
36 |
enum
|
sl@0
|
37 |
{
|
sl@0
|
38 |
KZipArchiveError = -256,
|
sl@0
|
39 |
KCentralDirectoryTrailerNotFound = KZipArchiveError - 1,
|
sl@0
|
40 |
KCentralDirectoryTrailerInvalid = KZipArchiveError - 3,
|
sl@0
|
41 |
KCompressionMethodNotSupported = KZipArchiveError - 4,
|
sl@0
|
42 |
KLocalHeaderSignatureInvalid = KZipArchiveError - 5,
|
sl@0
|
43 |
KMultiDiskArchivesNotSupported = KZipArchiveError - 6,
|
sl@0
|
44 |
KMemberNotFound = KZipArchiveError - 7,
|
sl@0
|
45 |
|
sl@0
|
46 |
KZipArchiveMinError = KZipArchiveError - 8
|
sl@0
|
47 |
|
sl@0
|
48 |
};
|
sl@0
|
49 |
|
sl@0
|
50 |
enum TCompressionMethod
|
sl@0
|
51 |
{
|
sl@0
|
52 |
|
sl@0
|
53 |
EStored = 0,
|
sl@0
|
54 |
EShrunk = 1,
|
sl@0
|
55 |
EReducedCFOne = 2,
|
sl@0
|
56 |
EReducedCFTwo = 3,
|
sl@0
|
57 |
EReducedCFThree = 4,
|
sl@0
|
58 |
EReducedCFFour = 5,
|
sl@0
|
59 |
EImploded = 6,
|
sl@0
|
60 |
EReservedOne = 7,
|
sl@0
|
61 |
EDeflated = 8,
|
sl@0
|
62 |
EReservedTwo = 9,
|
sl@0
|
63 |
EPKWAREImploded = 10
|
sl@0
|
64 |
|
sl@0
|
65 |
};
|
sl@0
|
66 |
|
sl@0
|
67 |
protected:
|
sl@0
|
68 |
|
sl@0
|
69 |
enum // Constants
|
sl@0
|
70 |
{
|
sl@0
|
71 |
|
sl@0
|
72 |
KCentralDirectorySignature = 0x06054b50,
|
sl@0
|
73 |
KCentralDirectoryHeaderSignature = 0x02014b50,
|
sl@0
|
74 |
KLocalHeaderSignature = 0x04034b50
|
sl@0
|
75 |
};
|
sl@0
|
76 |
|
sl@0
|
77 |
enum // Lengths
|
sl@0
|
78 |
{
|
sl@0
|
79 |
|
sl@0
|
80 |
KCentralDirectoryTrailerFixedLength = 22,
|
sl@0
|
81 |
KLocalHeaderFixedLength = 30,
|
sl@0
|
82 |
KCentralDirectoryHeaderFixedLength = 46,
|
sl@0
|
83 |
KSignatureLength = 4,
|
sl@0
|
84 |
KMaxTrailerSearchLength = 65536
|
sl@0
|
85 |
};
|
sl@0
|
86 |
|
sl@0
|
87 |
enum // Offsets
|
sl@0
|
88 |
{
|
sl@0
|
89 |
|
sl@0
|
90 |
KCentralFileHeaderFileNameLengthOffset = 28,
|
sl@0
|
91 |
KCentralFileHeaderExtraFieldLengthOffset = 30,
|
sl@0
|
92 |
KCentralFileHeaderFileNameOffset = 46
|
sl@0
|
93 |
};
|
sl@0
|
94 |
|
sl@0
|
95 |
/**
|
sl@0
|
96 |
Represents the archive's central directory trailer - the central directory contains information
|
sl@0
|
97 |
about files in the arhive
|
sl@0
|
98 |
|
sl@0
|
99 |
@publishedAll
|
sl@0
|
100 |
@released
|
sl@0
|
101 |
*/
|
sl@0
|
102 |
struct TCentralDirectoryTrailer
|
sl@0
|
103 |
{
|
sl@0
|
104 |
TUint32 iSignature;
|
sl@0
|
105 |
TUint16 iDiskNumber;
|
sl@0
|
106 |
TUint16 iStartDiskNumber;
|
sl@0
|
107 |
TUint16 iLocalEntryCount;
|
sl@0
|
108 |
TUint16 iTotalEntryCount;
|
sl@0
|
109 |
TUint32 iSize;
|
sl@0
|
110 |
TUint32 iOffset;
|
sl@0
|
111 |
TUint16 iCommentLength;
|
sl@0
|
112 |
// comment -- variable length
|
sl@0
|
113 |
};
|
sl@0
|
114 |
|
sl@0
|
115 |
/**
|
sl@0
|
116 |
Represents the archive's central directory header - the central directory contains information
|
sl@0
|
117 |
about files in the arhive
|
sl@0
|
118 |
|
sl@0
|
119 |
@publishedAll
|
sl@0
|
120 |
@released
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
struct TCentralDirectoryHeader
|
sl@0
|
123 |
{
|
sl@0
|
124 |
TUint32 iSignature;
|
sl@0
|
125 |
TUint16 iMadeBy;
|
sl@0
|
126 |
TUint16 iRequired;
|
sl@0
|
127 |
TUint16 iFlags;
|
sl@0
|
128 |
TUint16 iCompressionMethod;
|
sl@0
|
129 |
TUint16 iLastModifiedFileTime;
|
sl@0
|
130 |
TUint16 iLastModifiedFileDate;
|
sl@0
|
131 |
TUint32 iCRC32;
|
sl@0
|
132 |
TUint32 iCompressedSize;
|
sl@0
|
133 |
TUint32 iUncompressedSize;
|
sl@0
|
134 |
TUint16 iFileNameLength;
|
sl@0
|
135 |
TUint16 iExtraFieldLength;
|
sl@0
|
136 |
TUint16 iFileCommentLength;
|
sl@0
|
137 |
TUint16 iDiskNumberStart;
|
sl@0
|
138 |
TUint16 iInternalFileAttributes;
|
sl@0
|
139 |
TUint32 iExternalFileAttributes;
|
sl@0
|
140 |
TUint32 iLocalHeaderOffset;
|
sl@0
|
141 |
// file name -- variable length
|
sl@0
|
142 |
// extra field -- variable length
|
sl@0
|
143 |
// file comment -- variable length
|
sl@0
|
144 |
};
|
sl@0
|
145 |
|
sl@0
|
146 |
/**
|
sl@0
|
147 |
Represents the archive's local header
|
sl@0
|
148 |
|
sl@0
|
149 |
@publishedAll
|
sl@0
|
150 |
@released
|
sl@0
|
151 |
*/
|
sl@0
|
152 |
struct TLocalHeader
|
sl@0
|
153 |
{
|
sl@0
|
154 |
TUint32 iSignature;
|
sl@0
|
155 |
TUint16 iVersionNeeded;
|
sl@0
|
156 |
TUint16 iFlags;
|
sl@0
|
157 |
TUint16 iCompressionMethod;
|
sl@0
|
158 |
TUint16 iLastModifiedFileTime;
|
sl@0
|
159 |
TUint16 iLastModifiedFileDate;
|
sl@0
|
160 |
TUint32 iCRC32;
|
sl@0
|
161 |
TUint32 iCompressedSize;
|
sl@0
|
162 |
TUint32 iUncompressedSize;
|
sl@0
|
163 |
TUint16 iFileNameLength;
|
sl@0
|
164 |
TUint16 iExtraFieldLength;
|
sl@0
|
165 |
// file name -- variable length
|
sl@0
|
166 |
// extra field -- variable length
|
sl@0
|
167 |
};
|
sl@0
|
168 |
};
|
sl@0
|
169 |
}//TOLDEZIP
|
sl@0
|
170 |
#endif /* !_ZIP_ARCHIVE_H_ */
|
sl@0
|
171 |
|