ObjFW  Diff

Differences From Artifact [1fb9cda36b]:

To Artifact [0b74319ed1]:


32
33
34
35
36
37
38




39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
typedef struct __stat64 of_stat_t;
#elif defined(OF_HAVE_OFF64_T)
typedef struct stat64 of_stat_t;
#else
typedef struct stat of_stat_t;
#endif





/*!
 * @class OFFile OFFile.h ObjFW/OFFile.h
 *
 * @brief A class which provides methods to read and write files.
 */
@interface OFFile: OFSeekableStream
{
#if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
	int _fd;
#else
	long _fd;
	bool _append;
#endif
	bool _atEndOfStream;
}

/*!
 * @brief Creates a new OFFile with the specified path and mode.







>
>
>
>










|







32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
typedef struct __stat64 of_stat_t;
#elif defined(OF_HAVE_OFF64_T)
typedef struct stat64 of_stat_t;
#else
typedef struct stat of_stat_t;
#endif

#if defined(OF_MORPHOS) && !defined(OF_IXEMUL)
typedef long BPTR;
#endif

/*!
 * @class OFFile OFFile.h ObjFW/OFFile.h
 *
 * @brief A class which provides methods to read and write files.
 */
@interface OFFile: OFSeekableStream
{
#if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
	int _fd;
#else
	BPTR _handle;
	bool _append;
#endif
	bool _atEndOfStream;
}

/*!
 * @brief Creates a new OFFile with the specified path and mode.
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87










88
89
90
91
92
93
94
 *	       `a+`           | read-write, create, append
 *	       `ab+` or `a+b` | read-write, create, append, binary
 * @return A new autoreleased OFFile
 */
+ (instancetype)fileWithPath: (OFString *)path
			mode: (OFString *)mode;


/*!
 * @brief Creates a new OFFile with the specified file descriptor.
 *
 * @param fd A file descriptor, returned from for example open().
 *	     It is not closed when the OFFile object is deallocated!
 * @return A new autoreleased OFFile
 */
+ (instancetype)fileWithFileDescriptor: (int)fd;











- init OF_UNAVAILABLE;

/*!
 * @brief Initializes an already allocated OFFile.
 *
 * @param path The path to the file to open as a string







>




|



>
>
>
>
>
>
>
>
>
>







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
104
105
106
107
108
109
 *	       `a+`           | read-write, create, append
 *	       `ab+` or `a+b` | read-write, create, append, binary
 * @return A new autoreleased OFFile
 */
+ (instancetype)fileWithPath: (OFString *)path
			mode: (OFString *)mode;

#if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
/*!
 * @brief Creates a new OFFile with the specified file descriptor.
 *
 * @param fd A file descriptor, returned from for example open().
 *	     It is closed when the OFFile object is deallocated!
 * @return A new autoreleased OFFile
 */
+ (instancetype)fileWithFileDescriptor: (int)fd;
#else
/*!
 * @brief Creates a new OFFile with the specified handle.
 *
 * @param handle A handle, returned from for example Open().
 *		 It is closed when the OFFile object is deallocated!
 * @return A new autoreleased OFFile
 */
+ (instancetype)fileWithHandle: (BPTR)handle;
#endif

- init OF_UNAVAILABLE;

/*!
 * @brief Initializes an already allocated OFFile.
 *
 * @param path The path to the file to open as a string
109
110
111
112
113
114
115

116
117
118
119
120

121
122










123
124
125
126
127
128
129
130
131
132
133
134
 *	       `a+`           | read-write, create, append
 *	       `ab+` or `a+b` | read-write, create, append, binary
 * @return An initialized OFFile
 */
- initWithPath: (OFString *)path
	  mode: (OFString *)mode;


/*!
 * @brief Initializes an already allocated OFFile.
 *
 * @param fd A file descriptor, returned from for example open().
 *	     It is not closed when the OFFile object is deallocated!

 */
- initWithFileDescriptor: (int)fd;










@end

#ifdef __cplusplus
extern "C" {
#endif
extern int of_stat(OFString *path, of_stat_t *buffer);
extern int of_lstat(OFString *path, of_stat_t *buffer);
#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END







>




|
>


>
>
>
>
>
>
>
>
>
>












124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
 *	       `a+`           | read-write, create, append
 *	       `ab+` or `a+b` | read-write, create, append, binary
 * @return An initialized OFFile
 */
- initWithPath: (OFString *)path
	  mode: (OFString *)mode;

#if !defined(OF_MORPHOS) || defined(OF_IXEMUL)
/*!
 * @brief Initializes an already allocated OFFile.
 *
 * @param fd A file descriptor, returned from for example open().
 *	     It is closed when the OFFile object is deallocated!
 * @return An initialized OFFile
 */
- initWithFileDescriptor: (int)fd;
#else
/*!
 * @brief Initializes an already allocated OFFile.
 *
 * @param handle A handle, returned from for example Open().
 *		 It is closed when the OFFile object is deallocated!
 * @return An initialized OFFile
 */
- initWithHandle: (BPTR)handle;
#endif
@end

#ifdef __cplusplus
extern "C" {
#endif
extern int of_stat(OFString *path, of_stat_t *buffer);
extern int of_lstat(OFString *path, of_stat_t *buffer);
#ifdef __cplusplus
}
#endif

OF_ASSUME_NONNULL_END