ObjFW
OFLHAArchive.h
1 /*
2  * Copyright (c) 2008-2023 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 "OFKernelEventObserver.h"
18 #import "OFLHAArchiveEntry.h"
19 #import "OFString.h"
20 
21 OF_ASSUME_NONNULL_BEGIN
22 
23 @class OFIRI;
24 @class OFStream;
25 
31 OF_SUBCLASSING_RESTRICTED
33 {
34  OFStream *_stream;
35  uint_least8_t _mode;
36  OFStringEncoding _encoding;
37  OFLHAArchiveEntry *_Nullable _currentEntry;
38 #ifdef OF_LHA_ARCHIVE_M
39 @public
40 #endif
41  OFStream *_Nullable _lastReturnedStream;
42 }
43 
47 @property (nonatomic) OFStringEncoding encoding;
48 
59 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
60 
70 + (instancetype)archiveWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
71 
81 + (OFIRI *)IRIForFilePath: (OFString *)path inArchiveWithIRI: (OFIRI *)IRI;
82 
83 - (instancetype)init OF_UNAVAILABLE;
84 
96 - (instancetype)initWithStream: (OFStream *)stream
97  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
98 
109 - (instancetype)initWithIRI: (OFIRI *)IRI mode: (OFString *)mode;
110 
130 - (nullable OFLHAArchiveEntry *)nextEntry;
131 
142 - (OFStream *)streamForReadingCurrentEntry;
143 
164 - (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry;
165 
171 - (void)close;
172 @end
173 
174 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:32