ObjFW
OFFile.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 "OFSeekableStream.h"
17 #import "OFKernelEventObserver.h"
18 
19 #ifndef OF_AMIGAOS
20 # define OF_FILE_HANDLE_IS_FD
21 typedef int OFFileHandle;
22 static const OFFileHandle OFInvalidFileHandle = -1;
23 #else
24 typedef struct _OFFileHandle *OFFileHandle;
25 static const OFFileHandle OFInvalidFileHandle = NULL;
26 #endif
27 
28 OF_ASSUME_NONNULL_BEGIN
29 
35 OF_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 
115 OF_ASSUME_NONNULL_END
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
A class for handling strings.
Definition: OFString.h:134
A class which provides methods to read and write files.
Definition: OFFile.h:36
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
A stream that supports seeking.
Definition: OFSeekableStream.h:70