ObjFW
OFZIPArchiveEntry.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2026 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 
30 typedef enum {
33  OFZIPArchiveEntryCompressionMethodShrink = 1,
34  OFZIPArchiveEntryCompressionMethodReduceFactor1 = 2,
35  OFZIPArchiveEntryCompressionMethodReduceFactor2 = 3,
36  OFZIPArchiveEntryCompressionMethodReduceFactor3 = 4,
37  OFZIPArchiveEntryCompressionMethodReduceFactor4 = 5,
38  OFZIPArchiveEntryCompressionMethodImplode = 6,
43  OFZIPArchiveEntryCompressionMethodBZIP2 = 12,
44  OFZIPArchiveEntryCompressionMethodLZMA = 14,
45  OFZIPArchiveEntryCompressionMethodWavPack = 97,
46  OFZIPArchiveEntryCompressionMethodPPMd = 98
48 
52 typedef enum {
94 
98 typedef enum {
102 
103 @class OFString;
104 @class OFData;
105 @class OFFile;
106 @class OFDate;
107 
116 {
118  OFZIPArchiveEntryAttributeCompatibility _minVersionNeeded;
119  uint16_t _generalPurposeBitFlag;
120  OFZIPArchiveEntryCompressionMethod _compressionMethod;
121  uint16_t _lastModifiedFileTime, _lastModifiedFileDate;
122  uint32_t _CRC32;
123  unsigned long long _compressedSize, _uncompressedSize;
124  OFString *_fileName;
125  OFData *_Nullable _extraField;
126  OFString *_Nullable _fileComment;
127  uint32_t _startDiskNumber;
128  uint16_t _internalAttributes;
129  uint32_t _versionSpecificAttributes;
130  int64_t _localFileHeaderOffset;
131  OF_RESERVE_IVARS(OFZIPArchiveEntry, 4)
132 }
133 
139 @property OF_NULLABLE_PROPERTY (readonly, copy, nonatomic) OFData *extraField;
148 @property (readonly, nonatomic)
158 @property (readonly, nonatomic)
170 @property (readonly, nonatomic)
171  OFZIPArchiveEntryCompressionMethod compressionMethod;
176 @property (readonly, nonatomic) uint32_t CRC32;
184 @property (readonly, nonatomic) uint32_t versionSpecificAttributes;
191 @property (readonly, nonatomic) uint16_t generalPurposeBitFlag;
193 - (instancetype)init OF_UNAVAILABLE;
194 @end
195 
196 #ifdef __cplusplus
197 extern "C" {
198 #endif
199 
205 extern OFString *OFZIPArchiveEntryVersionToString(uint16_t version);
206 
215  OFZIPArchiveEntryCompressionMethod compressionMethod);
216 
228 extern size_t OFZIPArchiveEntryExtraFieldFind(OFData *extraField,
229  OFZIPArchiveEntryExtraFieldTag tag, uint16_t *size);
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 OF_ASSUME_NONNULL_END
235 
236 #import "OFMutableZIPArchiveEntry.h"
Definition: OFZIPArchiveEntry.h:76
No compression.
Definition: OFZIPArchiveEntry.h:32
Definition: OFZIPArchiveEntry.h:66
Definition: OFZIPArchiveEntry.h:68
Definition: OFZIPArchiveEntry.h:70
A class which represents an entry in an archive.
A class for storing, accessing and comparing dates.
Definition: OFDate.h:33
The root class for all other classes inside ObjFW.
Definition: OFObject.h:954
Definition: OFZIPArchiveEntry.h:58
Definition: OFZIPArchiveEntry.h:86
Definition: OFZIPArchiveEntry.h:92
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:80
Definition: OFZIPArchiveEntry.h:100
OFZIPArchiveEntryCompressionMethod
ZIP compression method.
Definition: OFZIPArchiveEntry.h:30
Definition: OFZIPArchiveEntry.h:90
Definition: OFZIPArchiveEntry.h:82
Definition: OFZIPArchiveEntry.h:60
Definition: OFZIPArchiveEntry.h:84
Definition: OFZIPArchiveEntry.h:78
Definition: OFZIPArchiveEntry.h:62
Definition: OFZIPArchiveEntry.h:64
OFZIPArchiveEntryExtraFieldTag
Tags for the extra field.
Definition: OFZIPArchiveEntry.h:98
Definition: OFZIPArchiveEntry.h:56
A class which represents an entry in the central directory of a ZIP archive.
Definition: OFZIPArchiveEntry.h:114
A class which provides methods to read and write files.
Definition: OFFile.h:40
Definition: OFZIPArchiveEntry.h:72
OFString * OFZIPArchiveEntryVersionToString(uint16_t version)
Converts the ZIP entry version to a string.
Definition: OFZIPArchiveEntry.m:36
Definition: OFZIPArchiveEntry.h:54
A protocol for the creation of mutable copies.
Definition: OFObject.h:1639
A protocol for the creation of copies.
Definition: OFObject.h:1618
Definition: OFZIPArchiveEntry.h:74
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
Deflate.
Definition: OFZIPArchiveEntry.h:40
Deflate64.
Definition: OFZIPArchiveEntry.h:42
Definition: OFZIPArchiveEntry.h:88
OFZIPArchiveEntryAttributeCompatibility
Attribute compatibility part of ZIP versions.
Definition: OFZIPArchiveEntry.h:52