ObjFW  Diff

Differences From Artifact [809bee699f]:

To Artifact [af7a34fc33]:


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 * Initializes an already allocated OFException.
 *
 * \param obj The object which caused the exception
 * \return An initialized OFException
 */
- initWithObject: (id)obj;

/**
 * Frees an OFException and the memory it allocated.
 */
- free;

/**
 * Raises an OFException and aborts execution if the exception is not caught.
 */

- raise;







<
<
<







35
36
37
38
39
40
41



42
43
44
45
46
47
48
 * Initializes an already allocated OFException.
 *
 * \param obj The object which caused the exception
 * \return An initialized OFException
 */
- initWithObject: (id)obj;




- free;

/**
 * Raises an OFException and aborts execution if the exception is not caught.
 */

- raise;
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
104








105
106




107




108
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








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
162



163



164
165
166



167



168
169
	andSize: (size_t)size;

/**
 * Initializes an already allocated no memory exception.
 *
 * \param obj The object which caused the exception
 * \param size The size of the memory that couldn't be allocated
 * \return An initialized new no memory exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/**
 * \return The size of the memoory that couldn't be allocated
 */
- (size_t)requestedSize;
@end




@interface OFNotImplementedException: OFException
{
	SEL selector;
}








+ newWithObject: (id)obj
    andSelector: (SEL)sel;








- initWithObject: (id)obj
     andSelector: (SEL)sel;




- (char*)cString;




- (SEL)selector;
@end




@interface OFMemNotPartOfObjException: OFException
{
	void *pointer;
}








+ newWithObject: (id)obj
     andPointer: (void*)ptr;








- initWithObject: (id)obj
      andPointer: (void*)ptr;




- (char*)cString;




- (void*)pointer;
@end




@interface OFOutOfRangeException: OFException






+ newWithObject: (id)obj;







- initWithObject: (id)obj;
@end




@interface OFOpenFileFailedException: OFException
{
	char *path;
	char *mode;
}









+ newWithObject: (id)obj
	andPath: (const char*)p
	andMode: (const char*)m;









- initWithObject: (id)obj
	 andPath: (const char*)p
	 andMode: (const char*)m;

- free;




- (char*)cString;




- (char*)path;




- (char*)mode;
@end




@interface OFReadOrWriteFailedException: OFException
{
	size_t req_size;
	size_t req_items;
}









+ newWithObject: (id)obj
	andSize: (size_t)size
      andNItems: (size_t)nitems;









- initWithObject: (id)obj
	 andSize: (size_t)size
       andNItems: (size_t)nitems;




- (size_t)requestedSize;




- (size_t)requestedItems;
@end




@interface OFReadFailedException: OFReadOrWriteFailedException



- (char*)cString;
@end




@interface OFWriteFailedException: OFReadOrWriteFailedException



- (char*)cString;
@end







|















>
>
>





>
>
>
>
>
>
>


>
>
>
>
>
>
>
>


>
>
>
>

>
>
>
>



>
>
>





>
>
>
>
>
>
>


>
>
>
>
>
>
>
>


>
>
>
>

>
>
>
>



>
>
>

>
>
>
>
>
>

>
>
>
>
>
>
>



>
>
>






>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>



>

>
>
>
>

>
>
>
>

>
>
>
>



>
>
>






>
>
>
>
>
>
>
>



>
>
>
>
>
>
>
>
>



>
>
>
>

>
>
>
>



>
>
>

>
>
>



>
>
>

>
>
>


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
104
105
106
107
108
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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
	andSize: (size_t)size;

/**
 * Initializes an already allocated no memory exception.
 *
 * \param obj The object which caused the exception
 * \param size The size of the memory that couldn't be allocated
 * \return An initialized no memory exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/**
 * \return The size of the memoory that couldn't be allocated
 */
- (size_t)requestedSize;
@end

/**
 * An OFException indicating the requested selector is not implemented.
 */
@interface OFNotImplementedException: OFException
{
	SEL selector;
}

/**
 * Creates a new not impemented exception.
 *
 * \param obj The object which caused the exception
 * \param sel A selector for the function not implemented
 * \return A new not implemented exception
 */
+ newWithObject: (id)obj
    andSelector: (SEL)sel;

/**
 * Initializes an already allocated not implemented exception.
 *
 * \param obj The object which caused the exception
 * \param sel A selector for the function not implemented
 * \return An initialized not implemented exception
 */
- initWithObject: (id)obj
     andSelector: (SEL)sel;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/**
 * \return The requested selector that is not implemented
 */
- (SEL)selector;
@end

/**
 * An OFException indicating the given memory is not part of the object.
 */
@interface OFMemNotPartOfObjException: OFException
{
	void *pointer;
}

/**
 * Creates a new memory not part of object exception.
 *
 * \param obj The object which caused the exception
 * \param ptr A pointer to the memory that is not part of the object
 * \return A new memory not part of object exception
 */
+ newWithObject: (id)obj
     andPointer: (void*)ptr;

/**
 * Initializes an already allocated memory not part of object exception.
 *
 * \param obj The object which caused the exception
 * \param ptr A pointer to the memory that is not part of the object
 * \return An initialized memory not part of object exception
 */
- initWithObject: (id)obj
      andPointer: (void*)ptr;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/***
 * \return A pointer to the memory which is not part of the object
 */
- (void*)pointer;
@end

/**
 * An OFException indicating the given value is out of range. 
 */
@interface OFOutOfRangeException: OFException
/**
 * Creates a new out of range exception.
 *
 * \param obj The object which caused the exception
 * \return A new out of range exception
 */
+ newWithObject: (id)obj;

/**
 * Initializes an already allocated out of range exception.
 *
 * \param obj The object which caused the exception
 * \return An initialized out of range exception
 */
- initWithObject: (id)obj;
@end

/**
 * An OFException indicating the file couldn't be opened.
 */
@interface OFOpenFileFailedException: OFException
{
	char *path;
	char *mode;
}

/**
 * Creates a new open file failed exception.
 *
 * \param obj The object which caused the exception
 * \param p A C string of the path to the file tried to open
 * \param m A C string of the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithObject: (id)obj
	andPath: (const char*)p
	andMode: (const char*)m;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param obj The object which caused the exception
 * \param p A C string of the path to the file which couldn't be opened
 * \param m A C string of the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- initWithObject: (id)obj
	 andPath: (const char*)p
	 andMode: (const char*)m;

- free;

/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;

/**
 * \return A C string of the path to the file which couldn't be opened
 */
- (char*)path;

/**
 * \return A C string of the mode in which the file should have been opened
 */
- (char*)mode;
@end

/**
 * An OFException indicating a read or write to the file failed.
 */
@interface OFReadOrWriteFailedException: OFException
{
	size_t req_size;
	size_t req_items;
}

/**
 * Creates a new read or write failed exception.
 *
 * \param obj The object which caused the exception
 * \param size The requested size of the data that couldn't be read / written
 * \param nitems The requested number of items that couldn't be read / written
 * \return A new open file failed exception
 */
+ newWithObject: (id)obj
	andSize: (size_t)size
      andNItems: (size_t)nitems;

/**
 * Initializes an already allocated read or write failed exception.
 *
 * \param obj The object which caused the exception
 * \param size The requested size of the data that couldn't be read / written
 * \param nitems The requested number of items that couldn't be read / written
 * \return A new open file failed exception
 */
- initWithObject: (id)obj
	 andSize: (size_t)size
       andNItems: (size_t)nitems;

/**
 * \return The requested size of the data that couldn't be read / written
 */
- (size_t)requestedSize;

/**
 * \return The requested number of items that coudln't be read / written
 */
- (size_t)requestedItems;
@end

/**
 * An OFException indicating a read to the file failed.
 */
@interface OFReadFailedException: OFReadOrWriteFailedException
/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;
@end

/**
 * An OFException indicating a write to the file failed.
 */
@interface OFWriteFailedException: OFReadOrWriteFailedException
/**
 * \return An error message for the exception as a C String
 */
- (char*)cString;
@end