ObjFW  Diff

Differences From Artifact [2b898edd58]:

To Artifact [ba9ff74cd7]:


40
41
42
43
44
45
46
47

48
49
50
51
52
53
54

55
56
57

58
59
60
61
62

63
64
65

66
67
68
69
70
71
72
40
41
42
43
44
45
46

47
48
49
50
51
52
53

54
55
56

57
58
59
60
61

62
63
64

65
66
67
68
69
70
71
72







-
+






-
+


-
+




-
+


-
+







/**
 * The OFException class is the base class for all exceptions in ObjFW.
 *
 * IMPORTANT: Exceptions do NOT use OFAutoreleasePools!!
 */
@interface OFException: OFObject
{
	Class	 class;
	Class	 class_;
	OFString *string;
}

/**
 * Creates a new exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \return A new exception
 */
+ newWithClass: (Class)class;
+ newWithClass: (Class)class_;

/**
 * Initializes an already allocated OFException.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \return An initialized OFException
 */
- initWithClass: (Class)class;
- initWithClass: (Class)class_;

/**
 * \return The class of the object in which the exception happened
 */
- (Class)inClass;

/**
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
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







-
+



-
+





-
+



-
+

















-
+



-
+





-
+



-
+

















-
+



-
+





-
+



-
+


















-
+



-
+





-
+



-
+







 */
@interface OFOutOfMemoryException: OFException
{
	size_t req_size;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param size The size of the memory that couldn't be allocated
 * \return A new no memory exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  size: (size_t)size;

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

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

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

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of 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
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
       pointer: (void*)ptr;

/**
 * Initializes an already allocated memory not part of object exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of 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
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	pointer: (void*)ptr;

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

/**
 * An OFException indicating that a method or part of it is not implemented.
 */
@interface OFNotImplementedException: OFException
{
	SEL selector;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param selector The selector which is not or not fully implemented
 * \return A new not implemented exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
      selector: (SEL)selector;

/**
 * Initializes an already allocated not implemented exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param selector The selector which is not or not fully implemented
 * \return An initialized not implemented exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
       selector: (SEL)selector;
@end

/**
 * An OFException indicating the given value is out of range.
 */
@interface OFOutOfRangeException: OFException {}
@end

/**
 * An OFException indicating that the argument is invalid for this method.
 */
@interface OFInvalidArgumentException: OFException
{
	SEL selector;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param selector The selector which doesn't accept the argument
 * \return A new invalid argument exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
      selector: (SEL)selector;

/**
 * Initializes an already allocated invalid argument exception
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param selector The selector which doesn't accept the argument
 * \return An initialized invalid argument exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
       selector: (SEL)selector;
@end

/**
 * An OFException indicating that the encoding is invalid for this object.
 */
@interface OFInvalidEncodingException: OFException {}
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
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







-
+




-
+






-
+




-
+







{
	OFString *path;
	OFString *mode;
	int  err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param path A string of the path to the file tried to open
 * \param mode A string of the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  path: (OFString*)path
	  mode: (OFString*)mode;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param path A string of the path to the file which couldn't be opened
 * \param mode A string of the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	   path: (OFString*)path
	   mode: (OFString*)mode;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
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
308
309
310
311

312
313
314
315
316
317
318

319
320
321
322

323
324
325
326
327
328
329
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
308
309
310

311
312
313
314
315
316
317

318
319
320
321

322
323
324
325
326
327
328
329







-
+




-
+




-
+



-
+





-
+




-
+






-
+



-
+







	size_t req_size;
	size_t req_items;
	BOOL   has_items;
	int    err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param size The requested size of the data that couldn't be read / written
 * \param items The requested number of items that couldn't be read / written
 * \return A new open file failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  size: (size_t)size
	 items: (size_t)items;

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  size: (size_t)size;

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

/**
 * Initializes an already allocated read or write failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param size The requested size of the data that couldn't be read / written
 * \return A new open file failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	   size: (size_t)size;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

362
363
364
365
366
367
368
369

370
371
372
373
374

375
376
377
378
379
380
381

382
383
384
385
386

387
388
389
390
391
392
393
362
363
364
365
366
367
368

369
370
371
372
373

374
375
376
377
378
379
380

381
382
383
384
385

386
387
388
389
390
391
392
393







-
+




-
+






-
+




-
+







{
	OFString *src;
	OFString *dest;
	int err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param source The source for the link
 * \param destination The destination for the link
 * \return A new link failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	source: (OFString*)src
   destination: (OFString*)dest;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param source The source for the link
 * \param destination The destination for the link
 * \return An initialized link failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	 source: (OFString*)src
    destination: (OFString*)dest;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
410
411
412
413
414
415
416
417

418
419
420
421
422

423
424
425
426
427
428
429

430
431
432
433
434

435
436
437
438
439
440
441
410
411
412
413
414
415
416

417
418
419
420
421

422
423
424
425
426
427
428

429
430
431
432
433

434
435
436
437
438
439
440
441







-
+




-
+






-
+




-
+







{
	OFString *src;
	OFString *dest;
	int err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param source The source for the symlink
 * \param destination The destination for the symlink
 * \return A new symlink failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	source: (OFString*)src
   destination: (OFString*)dest;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param source The source for the symlink
 * \param destination The destination for the symlink
 * \return An initialized symlink failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	 source: (OFString*)src
    destination: (OFString*)dest;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
477
478
479
480
481
482
483
484

485
486
487
488
489

490
491
492
493
494
495
496

497
498
499
500
501

502
503
504
505
506
507
508
477
478
479
480
481
482
483

484
485
486
487
488

489
490
491
492
493
494
495

496
497
498
499
500

501
502
503
504
505
506
507
508







-
+




-
+






-
+




-
+







{
	OFString *node;
	OFString *service;
	int	 err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node for which translation was requested
 * \param service The service of the node for which translation was requested
 * \return A new address translation failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  node: (OFString*)node
       service: (OFString*)service;

/**
 * Initializes an already allocated address translation failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node for which translation was requested
 * \param service The service of the node for which translation was requested
 * \return An initialized address translation failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	   node: (OFString*)node
	service: (OFString*)service;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
525
526
527
528
529
530
531
532

533
534
535
536
537

538
539
540
541
542
543
544

545
546
547
548
549

550
551
552
553
554
555
556
525
526
527
528
529
530
531

532
533
534
535
536

537
538
539
540
541
542
543

544
545
546
547
548

549
550
551
552
553
554
555
556







-
+




-
+






-
+




-
+







{
	OFString *node;
	OFString *service;
	int	 err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node to which the connection failed
 * \param service The service on the node to which the connection failed
 * \return A new connection failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  node: (OFString*)node
       service: (OFString*)service;

/**
 * Initializes an already allocated connection failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node to which the connection failed
 * \param service The service on the node to which the connection failed
 * \return An initialized connection failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	   node: (OFString*)node
	service: (OFString*)service;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
574
575
576
577
578
579
580
581

582
583
584
585
586
587

588
589
590
591
592
593
594
595

596
597
598
599
600
601

602
603
604
605
606
607
608
574
575
576
577
578
579
580

581
582
583
584
585
586

587
588
589
590
591
592
593
594

595
596
597
598
599
600

601
602
603
604
605
606
607
608







-
+





-
+







-
+





-
+







	OFString *node;
	OFString *service;
	int	 family;
	int	 err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node on which binding failed
 * \param service The service on which binding failed
 * \param family The family for which binnding failed
 * \return A new bind failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
	  node: (OFString*)node
       service: (OFString*)service
	family: (int)family;

/**
 * Initializes an already allocated bind failed exception.
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param node The node on which binding failed
 * \param service The service on which binding failed
 * \param family The family for which binnding failed
 * \return An initialized bind failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	   node: (OFString*)node
	service: (OFString*)service
	 family: (int)family;

/**
 * \return The errno from when the exception was created
 */
630
631
632
633
634
635
636
637

638
639
640
641

642
643
644
645
646
647

648
649
650
651

652
653
654
655
656
657
658
630
631
632
633
634
635
636

637
638
639
640

641
642
643
644
645
646

647
648
649
650

651
652
653
654
655
656
657
658







-
+



-
+





-
+



-
+







@interface OFListenFailedException: OFException
{
	int backlog;
	int err;
}

/**
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param backlog The requested size of the back log
 * \return A new listen failed exception
 */
+ newWithClass: (Class)class
+ newWithClass: (Class)class_
       backLog: (int)backlog;

/**
 * Initializes an already allocated listen failed exception
 *
 * \param class The class of the object which caused the exception
 * \param class_ The class of the object which caused the exception
 * \param backlog The requested size of the back log
 * \return An initialized listen failed exception
 */
- initWithClass: (Class)class
- initWithClass: (Class)class_
	backLog: (int)backlog;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;