ObjFW
OFZIPArchiveEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2024 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;
142 @property (readonly, nonatomic)
152 @property (readonly, nonatomic)
167 @property (readonly, nonatomic)
168  OFZIPArchiveEntryCompressionMethod compressionMethod;
173 @property (readonly, nonatomic) uint32_t CRC32;
181 @property (readonly, nonatomic) uint32_t versionSpecificAttributes;
188 @property (readonly, nonatomic) uint16_t generalPurposeBitFlag;
190 - (instancetype)init OF_UNAVAILABLE;
191 @end
192 
193 #ifdef __cplusplus
194 extern "C" {
195 #endif
196 
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"
Definition: OFZIPArchiveEntry.h:70
Definition: OFZIPArchiveEntry.h:60
Definition: OFZIPArchiveEntry.h:62
Definition: OFZIPArchiveEntry.h:64
A class which represents an entry in an archive.
Definition: OFArchiveEntry.h:26
A class for storing, accessing and comparing dates.
Definition: OFDate.h:33
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
Definition: OFZIPArchiveEntry.h:52
Definition: OFZIPArchiveEntry.h:80
Definition: OFZIPArchiveEntry.h:86
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
A class for handling strings.
Definition: OFString.h:142
Definition: OFZIPArchiveEntry.h:74
Definition: OFZIPArchiveEntry.h:94
Definition: OFZIPArchiveEntry.h:84
Definition: OFZIPArchiveEntry.h:76
Definition: OFZIPArchiveEntry.h:54
Definition: OFZIPArchiveEntry.h:78
Definition: OFZIPArchiveEntry.h:72
Definition: OFZIPArchiveEntry.h:56
Definition: OFZIPArchiveEntry.h:58
OFZIPArchiveEntryExtraFieldTag
Tags for the extra field.
Definition: OFZIPArchiveEntry.h:92
Definition: OFZIPArchiveEntry.h:50
A class which represents an entry in the central directory of a ZIP archive.
Definition: OFZIPArchiveEntry.h:108
A class which provides methods to read and write files.
Definition: OFFile.h:40
Definition: OFZIPArchiveEntry.h:66
OFString * OFZIPArchiveEntryVersionToString(uint16_t version)
Converts the ZIP entry version to a string.
Definition: OFZIPArchiveEntry.m:36
Definition: OFZIPArchiveEntry.h:48
A protocol for the creation of mutable copies.
Definition: OFObject.h:1371
A protocol for the creation of copies.
Definition: OFObject.h:1350
Definition: OFZIPArchiveEntry.h:68
A class for storing arbitrary data in an array.
Definition: OFData.h:45
OFString * OFZIPArchiveEntryCompressionMethodName(OFZIPArchiveEntryCompressionMethod compressionMethod)
Converts the ZIP entry compression method to a string.
Definition: OFZIPArchiveEntry.m:114
Definition: OFZIPArchiveEntry.h:82
OFZIPArchiveEntryAttributeCompatibility
Attribute compatibility part of ZIP versions.
Definition: OFZIPArchiveEntry.h:46