ObjFW
OFZIPArchiveEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFArchiveEntry.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
23 typedef enum {
24  OFZIPArchiveEntryCompressionMethodNone = 0,
25  OFZIPArchiveEntryCompressionMethodShrink = 1,
26  OFZIPArchiveEntryCompressionMethodReduceFactor1 = 2,
27  OFZIPArchiveEntryCompressionMethodReduceFactor2 = 3,
28  OFZIPArchiveEntryCompressionMethodReduceFactor3 = 4,
29  OFZIPArchiveEntryCompressionMethodReduceFactor4 = 5,
30  OFZIPArchiveEntryCompressionMethodImplode = 6,
31  OFZIPArchiveEntryCompressionMethodDeflate = 8,
32  OFZIPArchiveEntryCompressionMethodDeflate64 = 9,
33  OFZIPArchiveEntryCompressionMethodBZIP2 = 12,
34  OFZIPArchiveEntryCompressionMethodLZMA = 14,
35  OFZIPArchiveEntryCompressionMethodWavPack = 97,
36  OFZIPArchiveEntryCompressionMethodPPMd = 98
37 } OFZIPArchiveEntryCompressionMethod;
38 
42 typedef enum {
84 
88 typedef enum {
92 
93 @class OFString;
94 @class OFData;
95 @class OFFile;
96 @class OFDate;
97 
106 {
108  OFZIPArchiveEntryAttributeCompatibility _minVersionNeeded;
109  uint16_t _generalPurposeBitFlag;
110  OFZIPArchiveEntryCompressionMethod _compressionMethod;
111  uint16_t _lastModifiedFileTime, _lastModifiedFileDate;
112  uint32_t _CRC32;
113  unsigned long long _compressedSize, _uncompressedSize;
114  OFString *_fileName;
115  OFData *_Nullable _extraField;
116  OFString *_Nullable _fileComment;
117  uint32_t _startDiskNumber;
118  uint16_t _internalAttributes;
119  uint32_t _versionSpecificAttributes;
120  int64_t _localFileHeaderOffset;
121  OF_RESERVE_IVARS(OFZIPArchiveEntry, 4)
122 }
123 
129 @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFData *extraField;
138 @property (readonly, nonatomic)
148 @property (readonly, nonatomic)
163 @property (readonly, nonatomic)
164  OFZIPArchiveEntryCompressionMethod compressionMethod;
169 @property (readonly, nonatomic) uint32_t CRC32;
177 @property (readonly, nonatomic) uint32_t versionSpecificAttributes;
184 @property (readonly, nonatomic) uint16_t generalPurposeBitFlag;
186 - (instancetype)init OF_UNAVAILABLE;
187 @end
188 
189 #ifdef __cplusplus
190 extern "C" {
191 #endif
192 
198 extern OFString *OFZIPArchiveEntryVersionToString(uint16_t version);
199 
208  OFZIPArchiveEntryCompressionMethod compressionMethod);
209 
221 extern size_t OFZIPArchiveEntryExtraFieldFind(OFData *extraField,
222  OFZIPArchiveEntryExtraFieldTag tag, uint16_t *size);
223 #ifdef __cplusplus
224 }
225 #endif
226 
227 OF_ASSUME_NONNULL_END
228 
229 #import "OFMutableZIPArchiveEntry.h"
Definition: OFZIPArchiveEntry.h:66
Definition: OFZIPArchiveEntry.h:56
Definition: OFZIPArchiveEntry.h:58
Definition: OFZIPArchiveEntry.h:60
A class which represents an entry in an archive.
Definition: OFArchiveEntry.h:22
A class for storing, accessing and comparing dates.
Definition: OFDate.h:29
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
Definition: OFZIPArchiveEntry.h:48
Definition: OFZIPArchiveEntry.h:76
Definition: OFZIPArchiveEntry.h:82
size_t OFZIPArchiveEntryExtraFieldFind(OFData *extraField, OFZIPArchiveEntryExtraFieldTag tag, uint16_t *size)
Gets a pointer to and the size of the extensible data field with the specified tag.
Definition: OFZIPArchiveEntry.m:144
A class for handling strings.
Definition: OFString.h:134
Definition: OFZIPArchiveEntry.h:70
Definition: OFZIPArchiveEntry.h:90
Definition: OFZIPArchiveEntry.h:80
Definition: OFZIPArchiveEntry.h:72
Definition: OFZIPArchiveEntry.h:50
Definition: OFZIPArchiveEntry.h:74
Definition: OFZIPArchiveEntry.h:68
Definition: OFZIPArchiveEntry.h:52
Definition: OFZIPArchiveEntry.h:54
OFZIPArchiveEntryExtraFieldTag
Tags for the extra field.
Definition: OFZIPArchiveEntry.h:88
Definition: OFZIPArchiveEntry.h:46
A class which represents an entry in the central directory of a ZIP archive.
Definition: OFZIPArchiveEntry.h:104
A class which provides methods to read and write files.
Definition: OFFile.h:36
Definition: OFZIPArchiveEntry.h:62
OFString * OFZIPArchiveEntryVersionToString(uint16_t version)
Converts the ZIP entry version to a string.
Definition: OFZIPArchiveEntry.m:30
Definition: OFZIPArchiveEntry.h:44
A protocol for the creation of mutable copies.
Definition: OFObject.h:1367
A protocol for the creation of copies.
Definition: OFObject.h:1346
Definition: OFZIPArchiveEntry.h:64
A class for storing arbitrary data in an array.
Definition: OFData.h:41
OFString * OFZIPArchiveEntryCompressionMethodName(OFZIPArchiveEntryCompressionMethod compressionMethod)
Convers the ZIP entry compression method to a string.
Definition: OFZIPArchiveEntry.m:108
Definition: OFZIPArchiveEntry.h:78
OFZIPArchiveEntryAttributeCompatibility
Attribute compatibility part of ZIP versions.
Definition: OFZIPArchiveEntry.h:42