ObjFW
OFLHAArchive.h
1 /*
2  * Copyright (c) 2008-2021 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 OFStream;
24 
30 OF_SUBCLASSING_RESTRICTED
32 {
33  OFStream *_stream;
34  enum {
35  OF_LHA_ARCHIVE_MODE_READ,
36  OF_LHA_ARCHIVE_MODE_WRITE,
37  OF_LHA_ARCHIVE_MODE_APPEND
38  } _mode;
39  of_string_encoding_t _encoding;
40  OFStream *_Nullable _lastReturnedStream;
41 }
42 
46 @property (nonatomic) of_string_encoding_t encoding;
47 
56 @property (readonly, nonatomic) OFStream *streamForReadingCurrentEntry;
57 
68 + (instancetype)archiveWithStream: (OFStream *)stream mode: (OFString *)mode;
69 
70 #ifdef OF_HAVE_FILES
80 + (instancetype)archiveWithPath: (OFString *)path mode: (OFString *)mode;
81 #endif
82 
83 - (instancetype)init OF_UNAVAILABLE;
84 
96 - (instancetype)initWithStream: (OFStream *)stream
97  mode: (OFString *)mode OF_DESIGNATED_INITIALIZER;
98 
99 #ifdef OF_HAVE_FILES
110 - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode;
111 #endif
112 
128 - (nullable OFLHAArchiveEntry *)nextEntry;
129 
150 - (OFStream *)streamForWritingEntry: (OFLHAArchiveEntry *)entry;
151 
155 - (void)close;
156 @end
157 
158 OF_ASSUME_NONNULL_END
of_string_encoding_t
The encoding of a string.
Definition: OFString.h:68
A class which represents an entry in an LHA archive.
Definition: OFLHAArchiveEntry.h:34
A class for accessing and manipulating LHA files.
Definition: OFLHAArchive.h:32
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
A base class for different types of streams.
Definition: OFStream.h:191
A class for handling strings.
Definition: OFString.h:132