Differences From Artifact [7be975c2e8]:
- File src/OFFile.h — part of check-in [374e1a1bfa] at 2021-01-02 22:04:26 on branch trunk — Update copyright (user: js, size: 5795) [annotate] [blame] [check-ins using] [more...]
To Artifact [bac13481b9]:
- File
src/OFFile.h
— part of check-in
[2fcf5a3052]
at
2021-04-29 23:24:22
on branch trunk
— Clean up struct and enum typedefs
With TYPEDEF_HIDES_STRUCT set, Doxygen properly handles anonymous
structs and enums that are typedef'd. (user: js, size: 5778) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
14 15 16 17 18 19 20 | */ #import "OFSeekableStream.h" #import "OFKernelEventObserver.h" #ifndef OF_AMIGAOS # define OF_FILE_HANDLE_IS_FD | < | > < | > | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | */ #import "OFSeekableStream.h" #import "OFKernelEventObserver.h" #ifndef OF_AMIGAOS # define OF_FILE_HANDLE_IS_FD typedef int OFFileHandle; static const OFFileHandle OFInvalidFileHandle = -1; #else typedef struct _OFFileHandle *OFFileHandle; static const OFFileHandle OFInvalidFileHandle = NULL; #endif OF_ASSUME_NONNULL_BEGIN @class OFURL; /** * @class OFFile OFFile.h ObjFW/OFFile.h * * @brief A class which provides methods to read and write files. */ OF_SUBCLASSING_RESTRICTED @interface OFFile: OFSeekableStream #ifdef OF_FILE_HANDLE_IS_FD <OFReadyForReadingObserving, OFReadyForWritingObserving> #endif { OFFileHandle _handle; bool _atEndOfStream; } /** * @brief Creates a new OFFile with the specified path and mode. * * @param path The path to the file to open as a string |
︙ | ︙ | |||
59 60 61 62 63 64 65 | * `wx` | Write-only, create or fail, exclusive * `w+` | Read-write, create or truncate * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ | | < | < | | 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | * `wx` | Write-only, create or fail, exclusive * `w+` | Read-write, create or truncate * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ + (instancetype)fileWithPath: (OFString *)path mode: (OFString *)mode; /** * @brief Creates a new OFFile with the specified URL and mode. * * @param URL The URL to the file to open * @param mode The mode in which the file should be opened.@n * Possible modes are: * Mode | Description * ---------------|------------------------------------- * `r` | Read-only * `r+` | Read-write * `w` | Write-only, create or truncate * `wx` | Write-only, create or fail, exclusive * `w+` | Read-write, create or truncate * `w+x` | Read-write, create or fail, exclusive * `a` | Write-only, create or append * `a+` | Read-write, create or append * @return A new autoreleased OFFile */ + (instancetype)fileWithURL: (OFURL *)URL mode: (OFString *)mode; /** * @brief Creates a new OFFile with the specified native file handle. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return A new autoreleased OFFile */ + (instancetype)fileWithHandle: (OFFileHandle)handle; - (instancetype)init OF_UNAVAILABLE; /** * @brief Initializes an already allocated OFFile. * * @param path The path to the file to open as a string |
︙ | ︙ | |||
117 118 119 120 121 122 123 | * `wb+` or `w+b` | read-write, create, truncate, binary * `a` | write-only, create, append * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ | | < | 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | * `wb+` or `w+b` | read-write, create, truncate, binary * `a` | write-only, create, append * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ - (instancetype)initWithPath: (OFString *)path mode: (OFString *)mode; /** * @brief Initializes an already allocated OFFile. * * @param URL The URL to the file to open * @param mode The mode in which the file should be opened.@n * Possible modes are: |
︙ | ︙ | |||
142 143 144 145 146 147 148 | * `wb+` or `w+b` | read-write, create, truncate, binary * `a` | write-only, create, append * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ | | < | < | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | * `wb+` or `w+b` | read-write, create, truncate, binary * `a` | write-only, create, append * `ab` | write-only, create, append, binary * `a+` | read-write, create, append * `ab+` or `a+b` | read-write, create, append, binary * @return An initialized OFFile */ - (instancetype)initWithURL: (OFURL *)URL mode: (OFString *)mode; /** * @brief Initializes an already allocated OFFile. * * @param handle A native file handle. If OF_FILE_HANDLE_IS_FD is defined, this * is a file descriptor. The handle is closed when the OFFile * object is deallocated! * @return An initialized OFFile */ - (instancetype)initWithHandle: (OFFileHandle)handle OF_DESIGNATED_INITIALIZER; @end OF_ASSUME_NONNULL_END |