ObjFW
OFZIPArchiveEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2025 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFArchiveEntry.h"
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
27 typedef enum {
28  OFZIPArchiveEntryCompressionMethodNone = 0,
29  OFZIPArchiveEntryCompressionMethodShrink = 1,
30  OFZIPArchiveEntryCompressionMethodReduceFactor1 = 2,
31  OFZIPArchiveEntryCompressionMethodReduceFactor2 = 3,
32  OFZIPArchiveEntryCompressionMethodReduceFactor3 = 4,
33  OFZIPArchiveEntryCompressionMethodReduceFactor4 = 5,
34  OFZIPArchiveEntryCompressionMethodImplode = 6,
35  OFZIPArchiveEntryCompressionMethodDeflate = 8,
36  OFZIPArchiveEntryCompressionMethodDeflate64 = 9,
37  OFZIPArchiveEntryCompressionMethodBZIP2 = 12,
38  OFZIPArchiveEntryCompressionMethodLZMA = 14,
39  OFZIPArchiveEntryCompressionMethodWavPack = 97,
40  OFZIPArchiveEntryCompressionMethodPPMd = 98
41 } OFZIPArchiveEntryCompressionMethod;
42 
46 typedef enum {
88 
92 typedef enum {
96 
97 @class OFString;
98 @class OFData;
99 @class OFFile;
100 @class OFDate;
101 
110 {
112  OFZIPArchiveEntryAttributeCompatibility _minVersionNeeded;
113  uint16_t _generalPurposeBitFlag;
114  OFZIPArchiveEntryCompressionMethod _compressionMethod;
115  uint16_t _lastModifiedFileTime, _lastModifiedFileDate;
116  uint32_t _CRC32;
117  unsigned long long _compressedSize, _uncompressedSize;
118  OFString *_fileName;
119  OFData *_Nullable _extraField;
120  OFString *_Nullable _fileComment;
121  uint32_t _startDiskNumber;
122  uint16_t _internalAttributes;
123  uint32_t _versionSpecificAttributes;
124  int64_t _localFileHeaderOffset;
125  OF_RESERVE_IVARS(OFZIPArchiveEntry, 4)
126 }
127 
133 @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFData *extraField;
134 
142 @property (readonly, nonatomic)
144 
152 @property (readonly, nonatomic)
154 
167 @property (readonly, nonatomic)
168  OFZIPArchiveEntryCompressionMethod compressionMethod;
169 
173 @property (readonly, nonatomic) uint32_t CRC32;
174 
181 @property (readonly, nonatomic) uint32_t versionSpecificAttributes;
182 
188 @property (readonly, nonatomic) uint16_t generalPurposeBitFlag;
189 
190 - (instancetype)init OF_UNAVAILABLE;
191 @end
192 
193 #ifdef __cplusplus
194 extern "C" {
195 #endif
202 extern OFString *OFZIPArchiveEntryVersionToString(uint16_t version);
203 
212  OFZIPArchiveEntryCompressionMethod compressionMethod);
213 
225 extern size_t OFZIPArchiveEntryExtraFieldFind(OFData *extraField,
226  OFZIPArchiveEntryExtraFieldTag tag, uint16_t *size);
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 OF_ASSUME_NONNULL_END
232 
233 #import "OFMutableZIPArchiveEntry.h"
OFZIPArchiveEntryAttributeCompatibility
Attribute compatibility part of ZIP versions.
Definition: OFZIPArchiveEntry.h:46
@ OFZIPArchiveEntryAttributeCompatibilityAtariST
Definition: OFZIPArchiveEntry.h:58
@ OFZIPArchiveEntryAttributeCompatibilityOpenVMS
Definition: OFZIPArchiveEntry.h:52
@ OFZIPArchiveEntryAttributeCompatibilityOS400
Definition: OFZIPArchiveEntry.h:84
@ OFZIPArchiveEntryAttributeCompatibilityAcornRISCOS
Definition: OFZIPArchiveEntry.h:74
@ OFZIPArchiveEntryAttributeCompatibilityWindowsNTFS
Definition: OFZIPArchiveEntry.h:68
@ OFZIPArchiveEntryAttributeCompatibilityBeOS
Definition: OFZIPArchiveEntry.h:80
@ OFZIPArchiveEntryAttributeCompatibilityMacintosh
Definition: OFZIPArchiveEntry.h:62
@ OFZIPArchiveEntryAttributeCompatibilityMSDOS
Definition: OFZIPArchiveEntry.h:48
@ OFZIPArchiveEntryAttributeCompatibilityMVS
Definition: OFZIPArchiveEntry.h:70
@ OFZIPArchiveEntryAttributeCompatibilityCPM
Definition: OFZIPArchiveEntry.h:66
@ OFZIPArchiveEntryAttributeCompatibilityVFAT
Definition: OFZIPArchiveEntry.h:76
@ OFZIPArchiveEntryAttributeCompatibilityAlternateMVS
Definition: OFZIPArchiveEntry.h:78
@ OFZIPArchiveEntryAttributeCompatibilityVSE
Definition: OFZIPArchiveEntry.h:72
@ OFZIPArchiveEntryAttributeCompatibilityUNIX
Definition: OFZIPArchiveEntry.h:54
@ OFZIPArchiveEntryAttributeCompatibilityOS2HPFS
Definition: OFZIPArchiveEntry.h:60
@ OFZIPArchiveEntryAttributeCompatibilityOSX
Definition: OFZIPArchiveEntry.h:86
@ OFZIPArchiveEntryAttributeCompatibilityVM_CMS
Definition: OFZIPArchiveEntry.h:56
@ OFZIPArchiveEntryAttributeCompatibilityTandem
Definition: OFZIPArchiveEntry.h:82
@ OFZIPArchiveEntryAttributeCompatibilityZSystem
Definition: OFZIPArchiveEntry.h:64
@ OFZIPArchiveEntryAttributeCompatibilityAmiga
Definition: OFZIPArchiveEntry.h:50
OFString * OFZIPArchiveEntryVersionToString(uint16_t version)
Converts the ZIP entry version to a string.
Definition: OFZIPArchiveEntry.m:36
OFZIPArchiveEntryExtraFieldTag
Tags for the extra field.
Definition: OFZIPArchiveEntry.h:92
@ OFZIPArchiveEntryExtraFieldTagZIP64
Definition: OFZIPArchiveEntry.h:94
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:150
OFString * OFZIPArchiveEntryCompressionMethodName(OFZIPArchiveEntryCompressionMethod compressionMethod)
Converts the ZIP entry compression method to a string.
Definition: OFZIPArchiveEntry.m:114
A class for storing arbitrary data in an array.
Definition: OFData.h:46
A class for storing, accessing and comparing dates.
Definition: OFDate.h:34
A class which provides methods to read and write files.
Definition: OFFile.h:41
The root class for all other classes inside ObjFW.
Definition: OFObject.h:692
A class for handling strings.
Definition: OFString.h:143
A class which represents an entry in the central directory of a ZIP archive.
Definition: OFZIPArchiveEntry.h:111
A class which represents an entry in an archive.
Definition: OFArchiveEntry.h:33
A protocol for the creation of copies.
Definition: OFObject.h:1354
A protocol for the creation of mutable copies.
Definition: OFObject.h:1375