ObjFW
OFLHAArchive.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 "OFLHAArchiveEntry.h"
22 #import "OFString.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
26 @class OFIRI;
27 @class OFStream;
28 
34 OF_SUBCLASSING_RESTRICTED
36 {
37  OFStream *_stream;
38  uint_least8_t _mode;
39  OFStringEncoding _encoding;
40  OFLHAArchiveEntry *_Nullable _currentEntry;
41 #ifdef OF_LHA_ARCHIVE_M
42 @public
43 #endif
44  OFStream *_Nullable _lastReturnedStream;
45 @protected
46  bool _hasWritten;
47 }
48 
52 @property (nonatomic) OFStringEncoding encoding;
53 
64 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
65 
75 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
76 
86 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
87 
88 - (instancetype)init OF_UNAVAILABLE;
89 
101 - (instancetype)initWithStream: (OFStream *)stream
102  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
103 
114 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
115 
135 - (nullable OFLHAArchiveEntry *)nextEntry;
136 
147 - (OFStream *)streamForReadingCurrentEntry;
148 
169 - (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry;
170 
176 - (void)close;
177 @end
178 
179 OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition: OFString.h:65
The root class for all other classes inside ObjFW.
Definition: OFObject.h:690
A base class for different types of streams.
Definition: OFStream.h:278
A class for handling strings.
Definition: OFString.h:142
A class which represents an entry in an LHA archive.
Definition: OFLHAArchiveEntry.h:37
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:39
A class for accessing and manipulating LHA files.
Definition: OFLHAArchive.h:35