ObjFW
Loading...
Searching...
No Matches
OFZooArchive.h
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 "OFSeekableStream.h"
22#import "OFString.h"
23#import "OFZooArchiveEntry.h"
24
25OF_ASSUME_NONNULL_BEGIN
26
32OF_SUBCLASSING_RESTRICTED
34{
35 OF_KINDOF(OFStream *) _stream;
36 uint_least8_t _mode;
37 OFStringEncoding _encoding;
38 uint16_t _minVersionNeeded;
39 uint8_t _headerType;
40 OFString *_Nullable _archiveComment;
41 OFZooArchiveEntry *_Nullable _currentEntry;
42#ifdef OF_ZOO_ARCHIVE_M
43@public
44#endif
45 OFStream *_Nullable _lastReturnedStream;
46@protected
47 OFStreamOffset _lastHeaderOffset;
48 size_t _lastHeaderLength;
49}
50
54@property (nonatomic) OFStringEncoding encoding;
55
59@property OF_NULLABLE_PROPERTY (copy, nonatomic) OFString *archiveComment;
60
71+ (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
72
81+ (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
82
92+ (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
93
94- (instancetype)init OF_UNAVAILABLE;
95
107- (instancetype)initWithStream: (OFStream *)stream
108 mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
109
119- (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
120
140- (nullable OFZooArchiveEntry *)nextEntry;
141
153- (OFStream *)streamForReadingCurrentEntry;
154
178- (OFStream *)streamForWritingEntry: (OFZooArchiveEntry *)entry;
179
185- (void)close;
186@end
187
188OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition OFString.h:65
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition OFIRI.h:41
The root class for all other classes inside ObjFW.
Definition OFObject.h:692
A base class for different types of streams.
Definition OFStream.h:192
A class for handling strings.
Definition OFString.h:139
A class which represents an entry in a Zoo archive.
Definition OFZooArchiveEntry.h:37
A class for accessing and manipulating Zoo files.
Definition OFZooArchive.h:34
OFString * archiveComment
The archive comment.
Definition OFZooArchive.h:59