Comment: | Add OFMutableZooArchiveEntry |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d631674979f9032ef97395401b5fcc6b |
User & Date: | js on 2024-03-02 18:45:47 |
Other Links: | manifest | tags |
2024-03-02
| ||
18:52 | OFMutableZooArchiveEntry: Support for local time check-in: f8e24e08f5 user: js tags: trunk | |
18:45 | Add OFMutableZooArchiveEntry check-in: d631674979 user: js tags: trunk | |
17:58 | Fix documentation for mutable classes check-in: 18045dffca user: js tags: trunk | |
Modified src/Makefile from [fc3f492094] to [2ac3433b66].
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | OFMutableLHAArchiveEntry.m \ OFMutablePair.m \ OFMutableSet.m \ OFMutableString.m \ OFMutableTarArchiveEntry.m \ OFMutableTriple.m \ OFMutableZIPArchiveEntry.m \ OFNotification.m \ OFNotificationCenter.m \ OFNull.m \ OFNumber.m \ OFObject.m \ OFObject+KeyValueCoding.m \ OFOnce.m \ | > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | OFMutableLHAArchiveEntry.m \ OFMutablePair.m \ OFMutableSet.m \ OFMutableString.m \ OFMutableTarArchiveEntry.m \ OFMutableTriple.m \ OFMutableZIPArchiveEntry.m \ OFMutableZooArchiveEntry.m \ OFNotification.m \ OFNotificationCenter.m \ OFNull.m \ OFNumber.m \ OFObject.m \ OFObject+KeyValueCoding.m \ OFOnce.m \ |
︙ | ︙ |
Modified src/OFMutableLHAArchiveEntry.h from [bf622fc22c] to [315ae80199].
︙ | ︙ | |||
10 11 12 13 14 15 16 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFLHAArchiveEntry.h" | < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFLHAArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFMutableLHAArchiveEntry OFLHAArchiveEntry.h ObjFW/OFHAArchiveEntry.h * * @brief A class which represents a mutable entry in an LHA archive. |
︙ | ︙ |
Modified src/OFMutableLHAArchiveEntry.m from [7c8fd92ff1] to [9d7e559898].
︙ | ︙ | |||
13 14 15 16 17 18 19 | * file. */ #include "config.h" #import "OFMutableLHAArchiveEntry.h" #import "OFLHAArchiveEntry+Private.h" | < | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | * file. */ #include "config.h" #import "OFMutableLHAArchiveEntry.h" #import "OFLHAArchiveEntry+Private.h" #import "OFArray.h" #import "OFData.h" #import "OFDate.h" #import "OFNumber.h" #import "OFString.h" @implementation OFMutableLHAArchiveEntry |
︙ | ︙ |
Modified src/OFMutableTarArchiveEntry.h from [1adaffd665] to [19379cd18c].
︙ | ︙ | |||
10 11 12 13 14 15 16 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFTarArchiveEntry.h" | < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFTarArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFMutableTarArchiveEntry OFTarArchiveEntry.h ObjFW/OFTarArchiveEntry.h * * @brief A class which represents a mutable entry of a tar archive. |
︙ | ︙ |
Modified src/OFMutableZIPArchiveEntry.h from [2c44770ad2] to [c307086d80].
︙ | ︙ | |||
10 11 12 13 14 15 16 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFZIPArchiveEntry.h" | < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFZIPArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFMutableZIPArchiveEntry OFZIPArchiveEntry.h ObjFW/OFZIPArchiveEntry.h * * @brief A class which represents a mutable entry in the central directory of |
︙ | ︙ |
Modified src/OFMutableZIPArchiveEntry.m from [f4a3f02da1] to [1aea0e1342].
︙ | ︙ | |||
13 14 15 16 17 18 19 | * file. */ #include "config.h" #import "OFMutableZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" | | | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | * file. */ #include "config.h" #import "OFMutableZIPArchiveEntry.h" #import "OFZIPArchiveEntry+Private.h" #import "OFData.h" #import "OFDate.h" #import "OFString.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" @implementation OFMutableZIPArchiveEntry @dynamic fileName, fileComment, extraField, versionMadeBy, minVersionNeeded; @dynamic modificationDate, compressionMethod, compressedSize, uncompressedSize; |
︙ | ︙ |
Added src/OFMutableZooArchiveEntry.h version [e624065819].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFZooArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFMutableZooArchiveEntry OFZooArchiveEntry.h ObjFW/OFZooArchiveEntry.h * * @brief A class which represents a mutable entry in a Zoo archive. */ @interface OFMutableZooArchiveEntry: OFZooArchiveEntry <OFMutableArchiveEntry> { OF_RESERVE_IVARS(OFMutableZooArchiveEntry, 4) } /** * @brief The header type of the entry. */ @property (readwrite, nonatomic) uint8_t headerType; /** * @brief The compression method of the entry. */ @property (readwrite, nonatomic) uint8_t compressionMethod; /** * @brief The CRC16 of the file. */ @property (readwrite, nonatomic) uint16_t CRC16; /** * @brief The minimum version required to extract the file. * * The upper 8 bits are the major version and the lower 8 bits the minor * version. */ @property (readwrite, nonatomic) uint16_t minVersionNeeded; /** * @brief Whether the file was deleted. */ @property (readwrite, nonatomic, getter=isDeleted) bool deleted; /** * @brief The operating system identifier of the file. */ @property (readwrite, nonatomic) uint16_t operatingSystemIdentifier; /** * @brief The time zone in which the file was stored, as an offset in hours * from UTC (as a float). * * @note Make sure to set the correct time zone before setting the modification * date! */ @property OF_NULLABLE_PROPERTY (readwrite, retain, nonatomic) OFNumber *timeZone; /** * @brief Creates a new OFMutableZooArchiveEntry with the specified file name. * * @param fileName The file name for the OFZooArchiveEntry * @return A new, autoreleased OFZooArchiveEntry */ + (instancetype)entryWithFileName: (OFString *)fileName; /** * @brief Initializes an already allocated OFMutableZooArchiveEntry with the * specified file name. * * @param fileName The file name for the OFZooArchiveEntry * @return An initialized OFZooArchiveEntry */ - (instancetype)initWithFileName: (OFString *)fileName; /** * @brief Converts the OFMutableZooArchiveEntry to an immutable * OFZooArchiveEntry. */ - (void)makeImmutable; @end OF_ASSUME_NONNULL_END |
Added src/OFMutableZooArchiveEntry.m version [1d42b1617a].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFMutableZooArchiveEntry.h" #import "OFZooArchiveEntry+Private.h" #import "OFDate.h" #import "OFNumber.h" #import "OFString.h" @implementation OFMutableZooArchiveEntry @dynamic headerType, compressionMethod, modificationDate, CRC16; @dynamic uncompressedSize, compressedSize, minVersionNeeded, deleted; @dynamic fileComment, fileName, operatingSystemIdentifier, POSIXPermissions; @dynamic timeZone; + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } - (instancetype)initWithFileName: (OFString *)fileName { self = [super of_init]; @try { void *pool = objc_autoreleasePoolPush(); _fileName = [fileName copy]; self.modificationDate = [OFDate date]; objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } return self; } - (id)copy { OFMutableZooArchiveEntry *copy = [self mutableCopy]; [copy makeImmutable]; return copy; } - (void)setHeaderType: (uint8_t)headerType { _headerType = headerType; } - (void)setCompressionMethod: (uint8_t)compressionMethod { _compressionMethod = compressionMethod; } - (void)setModificationDate: (OFDate *)date { void *pool = objc_autoreleasePoolPush(); if (_timeZone != 0x7F) date = [date dateByAddingTimeInterval: -(OFTimeInterval)_timeZone * 900]; _lastModifiedFileDate = (((date.year - 1980) & 0xFF) << 9) | ((date.monthOfYear & 0x0F) << 5) | (date.dayOfMonth & 0x1F); _lastModifiedFileTime = ((date.hour & 0x1F) << 11) | ((date.minute & 0x3F) << 5) | ((date.second >> 1) & 0x0F); objc_autoreleasePoolPop(pool); } - (void)setCRC16: (uint16_t)CRC16 { _CRC16 = CRC16; } - (void)setUncompressedSize: (unsigned long long)uncompressedSize { _uncompressedSize = uncompressedSize; } - (void)setCompressedSize: (unsigned long long)compressedSize { _compressedSize = compressedSize; } - (void)setMinVersionNeeded: (uint16_t)minVersionNeeded { _minVersionNeeded = minVersionNeeded; } - (void)setDeleted: (bool)deleted { _deleted = deleted; } - (void)setFileComment: (OFString *)fileComment { OFString *old = _fileComment; _fileComment = [fileComment copy]; [old release]; } - (void)setFileName: (OFString *)fileName { OFString *old = _fileName; _fileName = [fileName copy]; [old release]; [_directoryName release]; _directoryName = nil; } - (void)setOperatingSystemIdentifier: (uint16_t)operatingSystemIdentifier { _operatingSystemIdentifier = operatingSystemIdentifier; } - (void)setPOSIXPermissions: (OFNumber *)POSIXPermissions { OFNumber *old = _POSIXPermissions; _POSIXPermissions = [POSIXPermissions copy]; [old release]; } - (void)setTimeZone: (OFNumber *)timeZone { if (timeZone == nil) _timeZone = 0x7F; else _timeZone = -timeZone.floatValue * 4; } - (void)makeImmutable { object_setClass(self, [OFZooArchiveEntry class]); } @end |
Modified src/OFZooArchiveEntry+Private.h from [b4293f9798] to [4d0560d4d7].
︙ | ︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 | */ #import "OFZooArchive.h" OF_ASSUME_NONNULL_BEGIN @interface OFZooArchiveEntry () - (nullable instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream encoding: (OFStringEncoding)encoding OF_METHOD_FAMILY(init) OF_DIRECT; @end OF_ASSUME_NONNULL_END | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | */ #import "OFZooArchive.h" OF_ASSUME_NONNULL_BEGIN @interface OFZooArchiveEntry () - (instancetype)of_init OF_METHOD_FAMILY(init); - (nullable instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream encoding: (OFStringEncoding)encoding OF_METHOD_FAMILY(init) OF_DIRECT; @end OF_ASSUME_NONNULL_END |
Modified src/OFZooArchiveEntry.h from [884a79e4f1] to [77fe38967f].
︙ | ︙ | |||
21 22 23 24 25 26 27 | @class OFDate; @class OFNumber; @class OFString; /** * @class OFZooArchiveEntry OFZooArchiveEntry.h ObjFW/OFZooArchiveEntry.h * | | | > > < | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | @class OFDate; @class OFNumber; @class OFString; /** * @class OFZooArchiveEntry OFZooArchiveEntry.h ObjFW/OFZooArchiveEntry.h * * @brief A class which represents an entry in a Zoo archive. */ @interface OFZooArchiveEntry: OFObject <OFArchiveEntry, OFCopying, OFMutableCopying> { uint8_t _headerType, _compressionMethod; #ifdef OF_ZOO_ARCHIVE_M @public #endif unsigned long long _nextHeaderOffset, _dataOffset; @protected uint16_t _lastModifiedFileDate, _lastModifiedFileTime; uint16_t _CRC16; unsigned long long _uncompressedSize, _compressedSize; uint16_t _minVersionNeeded; bool _deleted; OFString *_Nullable _fileComment; OFString *_fileName, *_Nullable _directoryName; uint16_t _operatingSystemIdentifier; OFNumber *_Nullable _POSIXPermissions; int8_t _timeZone; OF_RESERVE_IVARS(OFZooArchiveEntry, 4) } /** * @brief The header type of the entry. */ @property (readonly, nonatomic) uint8_t headerType; |
︙ | ︙ | |||
81 82 83 84 85 86 87 | */ @property (readonly, nonatomic) uint16_t operatingSystemIdentifier; /** * @brief The time zone in which the file was stored, as an offset in hours * from UTC (as a float). */ | | > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | */ @property (readonly, nonatomic) uint16_t operatingSystemIdentifier; /** * @brief The time zone in which the file was stored, as an offset in hours * from UTC (as a float). */ @property OF_NULLABLE_PROPERTY (readonly, retain, nonatomic) OFNumber *timeZone; - (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END #import "OFMutableZooArchiveEntry.h" |
Modified src/OFZooArchiveEntry.m from [68f5329f4b] to [ce552a79a7].
︙ | ︙ | |||
23 24 25 26 27 28 29 | #import "OFStream.h" #import "OFString.h" #import "OFInvalidFormatException.h" #import "OFUnsupportedVersionException.h" @implementation OFZooArchiveEntry | < < < < < < < < > > > > > > > > > > > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #import "OFStream.h" #import "OFString.h" #import "OFInvalidFormatException.h" #import "OFUnsupportedVersionException.h" @implementation OFZooArchiveEntry - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_init { self = [super init]; @try { _headerType = 2; _minVersionNeeded = 0x100; } @catch (id e) { [self release]; @throw e; } return self; } - (instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream encoding: (OFStringEncoding)encoding { self = [super init]; @try { |
︙ | ︙ | |||
183 184 185 186 187 188 189 | } - (id)copy { return [self retain]; } | > > > | | > > > > > > > > > > > > > | > > > > > > > > | | | > > > > > > > > | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | } - (id)copy { return [self retain]; } - (id)mutableCopy { OFZooArchiveEntry *copy = [[OFMutableZooArchiveEntry alloc] initWithFileName: _fileName]; @try { copy->_headerType = _headerType; copy->_compressionMethod = _compressionMethod; copy->_nextHeaderOffset = _nextHeaderOffset; copy->_dataOffset = _dataOffset; copy->_lastModifiedFileDate = _lastModifiedFileDate; copy->_lastModifiedFileTime = _lastModifiedFileTime; copy->_CRC16 = _CRC16; copy->_uncompressedSize = _uncompressedSize; copy->_compressedSize = _compressedSize; copy->_minVersionNeeded = _minVersionNeeded; copy->_deleted = _deleted; copy->_fileComment = [_fileComment copy]; copy->_directoryName = [_directoryName copy]; copy->_operatingSystemIdentifier = _operatingSystemIdentifier; copy->_POSIXPermissions = [_POSIXPermissions retain]; copy->_timeZone = _timeZone; } @catch (id e) { [self release]; @throw e; } return self; } - (uint8_t)headerType { return _headerType; } - (uint8_t)compressionMethod { return _compressionMethod; } - (OFDate *)modificationDate { void *pool = objc_autoreleasePoolPush(); uint16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980; uint8_t month = (_lastModifiedFileDate & 0x1E0) >> 5; |
︙ | ︙ | |||
222 223 224 225 226 227 228 229 230 231 232 233 234 235 | (OFTimeInterval)_timeZone * 900] retain]; } objc_autoreleasePoolPop(pool); return [date autorelease]; } - (OFNumber *)timeZone { if (_timeZone == 0x7F) return nil; return [OFNumber numberWithFloat: -(float)_timeZone / 4]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | (OFTimeInterval)_timeZone * 900] retain]; } objc_autoreleasePoolPop(pool); return [date autorelease]; } - (uint16_t)CRC16 { return _CRC16; } - (unsigned long long)uncompressedSize { return _uncompressedSize; } - (unsigned long long)compressedSize { return _compressedSize; } - (uint16_t)minVersionNeeded { return _minVersionNeeded; } - (bool)isDeleted { return _deleted; } - (OFString *)fileComment { return _fileComment; } - (OFString *)fileName { if (_directoryName == nil) return _fileName; return [OFString stringWithFormat: @"%@/%@", _directoryName, _fileName]; } - (uint16_t)operatingSystemIdentifier { return _operatingSystemIdentifier; } - (OFNumber *)POSIXPermissions { return _POSIXPermissions; } - (OFNumber *)timeZone { if (_timeZone == 0x7F) return nil; return [OFNumber numberWithFloat: -(float)_timeZone / 4]; |
︙ | ︙ |