ObjFW
OFLHAArchive.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFLHAArchiveEntry.h"
18 #import "OFString.h"
19 
20 OF_ASSUME_NONNULL_BEGIN
21 
22 @class OFIRI;
23 @class OFStream;
24 
30 OF_SUBCLASSING_RESTRICTED
32 {
33  OFStream *_stream;
34  uint_least8_t _mode;
35  OFStringEncoding _encoding;
36  OFLHAArchiveEntry *_Nullable _currentEntry;
37 #ifdef OF_LHA_ARCHIVE_M
38 @public
39 #endif
40  OFStream *_Nullable _lastReturnedStream;
41 @protected
42  bool _hasWritten;
43 }
44 
48 @property (nonatomic) OFStringEncoding encoding;
49 
60 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
61 
71 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
72 
82 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
83 
84 - (instancetype)init OF_UNAVAILABLE;
85 
97 - (instancetype)initWithStream: (OFStream *)stream
98  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
99 
110 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
111 
131 - (nullable OFLHAArchiveEntry *)nextEntry;
132 
143 - (OFStream *)streamForReadingCurrentEntry;
144 
165 - (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry;
166 
172 - (void)close;
173 @end
174 
175 OF_ASSUME_NONNULL_END
OFStringEncoding
The encoding of a string.
Definition: OFString.h:61
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
A base class for different types of streams.
Definition: OFStream.h:186
A class for handling strings.
Definition: OFString.h:134
A class which represents an entry in an LHA archive.
Definition: OFLHAArchiveEntry.h:33
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:35
A class for accessing and manipulating LHA files.
Definition: OFLHAArchive.h:31