ObjFW
Loading...
Searching...
No Matches
OFFile.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 "OFSeekableStream.h"
17#import "OFKernelEventObserver.h"
18
19#ifndef OF_AMIGAOS
20# define OF_FILE_HANDLE_IS_FD
21typedef int OFFileHandle;
22static const OFFileHandle OFInvalidFileHandle = -1;
23#else
24typedef struct _OFFileHandle *OFFileHandle;
25static const OFFileHandle OFInvalidFileHandle = NULL;
26#endif
27
28OF_ASSUME_NONNULL_BEGIN
29
35OF_SUBCLASSING_RESTRICTED
37#ifdef OF_FILE_HANDLE_IS_FD
39#endif
40{
41 OFFileHandle _handle;
42 bool _initialized, _atEndOfStream;
43}
44
65+ (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode;
66
75+ (instancetype)fileWithHandle: (OFFileHandle)handle;
76
100- (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode;
101
110- (instancetype)initWithHandle: (OFFileHandle)handle OF_DESIGNATED_INITIALIZER;
111
112- (instancetype)init OF_UNAVAILABLE;
113@end
114
115OF_ASSUME_NONNULL_END
A class which provides methods to read and write files.
Definition OFFile.h:37
A stream that supports seeking.
Definition OFSeekableStream.h:71
A class for handling strings.
Definition OFString.h:135
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition OFKernelEventObserver.h:84
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition OFKernelEventObserver.h:99