ObjFW
Toggle main menu visibility
Loading...
Searching...
No Matches
OFFile.h
1
/*
2
* Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3
*
4
* All rights reserved.
5
*
6
* This program is free software: you can redistribute it and/or modify it
7
* under the terms of the GNU Lesser General Public License version 3.0 only,
8
* as published by the Free Software Foundation.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT
11
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13
* version 3.0 for more details.
14
*
15
* You should have received a copy of the GNU Lesser General Public License
16
* version 3.0 along with this program. If not, see
17
* <https://www.gnu.org/licenses/>.
18
*/
19
20
#import "
OFSeekableStream.h
"
21
#import "OFKernelEventObserver.h"
22
23
#ifndef OF_AMIGAOS
24
# define OF_FILE_HANDLE_IS_FD
25
typedef
int
OFFileHandle;
26
static
const
OFFileHandle OFInvalidFileHandle = -1;
27
#else
28
typedef
struct
_OFFileHandle *OFFileHandle;
29
static
const
OFFileHandle OFInvalidFileHandle = NULL;
30
#endif
31
32
OF_ASSUME_NONNULL_BEGIN
33
39
OF_SUBCLASSING_RESTRICTED
40
@interface
OFFile
:
OFSeekableStream
41
#ifdef OF_FILE_HANDLE_IS_FD
42
<
OFReadyForReadingObserving
,
OFReadyForWritingObserving
>
43
#endif
44
{
45
OFFileHandle _handle;
46
bool
_initialized, _atEndOfStream;
47
}
48
69
+ (instancetype)fileWithPath: (
OFString
*)path mode: (
OFString
*)mode;
70
79
+ (instancetype)fileWithHandle: (OFFileHandle)handle;
80
104
- (instancetype)initWithPath: (
OFString
*)path mode: (
OFString
*)mode;
105
114
- (instancetype)initWithHandle: (OFFileHandle)handle OF_DESIGNATED_INITIALIZER;
115
116
- (instancetype)init OF_UNAVAILABLE;
117
@end
118
119
OF_ASSUME_NONNULL_END
OFSeekableStream.h
OFFile
A class which provides methods to read and write files.
Definition
OFFile.h:41
OFSeekableStream
A stream that supports seeking.
Definition
OFSeekableStream.h:75
OFString
A class for handling strings.
Definition
OFString.h:144
OFReadyForReadingObserving-p
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition
OFKernelEventObserver.h:84
OFReadyForWritingObserving-p
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition
OFKernelEventObserver.h:98
src
OFFile.h
Generated by
1.17.0