ObjFW  Diff

Differences From Artifact [77e5ffdd0d]:

To Artifact [b96cf194ca]:


133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Could not allocate %zu bytes in class %s!", req_size,
	    [class name]];

	return string;
}

- (size_t)requestedSize
{
	return req_size;







|







133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Could not allocate %zu bytes in class %s!", req_size,
	    [class className]];

	return string;
}

- (size_t)requestedSize
{
	return req_size;
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Memory at %p was not allocated as part of object of class %s, "
	    @"thus the memory allocation was not changed! It is also possible "
	    @"that there was an attempt to free the same memory twice.",
	    pointer, [class name]];

	return string;
}

- (void*)pointer
{
	return pointer;







|







177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Memory at %p was not allocated as part of object of class %s, "
	    @"thus the memory allocation was not changed! It is also possible "
	    @"that there was an attempt to free the same memory twice.",
	    pointer, [class className]];

	return string;
}

- (void*)pointer
{
	return pointer;
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
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The method %s of class %s is not or not fully implemented!",
	    SEL_NAME(selector), [class name]];

	return string;
}
@end

@implementation OFOutOfRangeException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Value out of range in class %s!", [class name]];

	return string;
}
@end

@implementation OFInvalidArgumentException
+ newWithClass: (Class)class_







|












|







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
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The method %s of class %s is not or not fully implemented!",
	    SEL_NAME(selector), [class className]];

	return string;
}
@end

@implementation OFOutOfRangeException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Value out of range in class %s!", [class className]];

	return string;
}
@end

@implementation OFInvalidArgumentException
+ newWithClass: (Class)class_
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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The argument for method %s of class %s is invalid!",
	    SEL_NAME(selector), [class name]];

	return string;
}
@end

@implementation OFInvalidEncodingException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The encoding is invalid for class %s!", [class name]];

	return string;
}
@end

@implementation OFInvalidFormatException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The format is invalid for class %s!", [class name]];

	return string;
}
@end

@implementation OFMalformedXMLException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The parser in class %s encountered malformed or invalid XML!",
	    [class name]];

	return string;
}
@end

@implementation OFInitializationFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Initialization failed for class %s!", [class name]];

	return string;
}
@end

@implementation OFOpenFileFailedException
+ newWithClass: (Class)class_







|












|












|













|












|







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
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The argument for method %s of class %s is invalid!",
	    SEL_NAME(selector), [class className]];

	return string;
}
@end

@implementation OFInvalidEncodingException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The encoding is invalid for class %s!", [class className]];

	return string;
}
@end

@implementation OFInvalidFormatException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The format is invalid for class %s!", [class className]];

	return string;
}
@end

@implementation OFMalformedXMLException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The parser in class %s encountered malformed or invalid XML!",
	    [class className]];

	return string;
}
@end

@implementation OFInitializationFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Initialization failed for class %s!", [class className]];

	return string;
}
@end

@implementation OFOpenFileFailedException
+ newWithClass: (Class)class_
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to open file %s with mode %s in class %s! " ERRFMT,
	    [path cString], [mode cString], [self name], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to open file %s with mode %s in class %s! " ERRFMT,
	    [path cString], [mode cString], [self className], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
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
557
558
{
	if (string != nil)
		return string;;

	if (has_items)
		string = [[OFString alloc] initWithFormat:
		    @"Failed to read %zu items of size %zu in class %s! "
		    ERRFMT, req_items, req_size, [class name], ERRPARAM];
	else
		string = [[OFString alloc] initWithFormat:
		    @"Failed to read %zu bytes in class %s! " ERRFMT, req_size,
		    [class name], ERRPARAM];

	return string;
}
@end

@implementation OFWriteFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	if (has_items)
		string = [[OFString alloc] initWithFormat:
		    @"Failed to write %zu items of size %zu in class %s! "
		    ERRFMT, req_items, req_size, [class name], ERRPARAM];
	else
		string = [[OFString alloc] initWithFormat:
		    @"Failed to write %zu bytes in class %s! " ERRFMT, req_size,
		    [class name], ERRPARAM];

	return string;
}
@end

@implementation OFSetOptionFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Setting an option in class %s failed!", [class name]];

	return string;
}
@end

@implementation OFNotConnectedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The socket of type %s is not connected or bound!", [class name]];


	return string;
}
@end

@implementation OFAlreadyConnectedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The socket of type %s is already connected or bound and thus "
	    @"can't be connected or bound again!", [class name]];

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithClass: (Class)class_







|



|














|



|












|












|
>













|







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
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
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
557
558
559
{
	if (string != nil)
		return string;;

	if (has_items)
		string = [[OFString alloc] initWithFormat:
		    @"Failed to read %zu items of size %zu in class %s! "
		    ERRFMT, req_items, req_size, [class className], ERRPARAM];
	else
		string = [[OFString alloc] initWithFormat:
		    @"Failed to read %zu bytes in class %s! " ERRFMT, req_size,
		    [class className], ERRPARAM];

	return string;
}
@end

@implementation OFWriteFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	if (has_items)
		string = [[OFString alloc] initWithFormat:
		    @"Failed to write %zu items of size %zu in class %s! "
		    ERRFMT, req_items, req_size, [class className], ERRPARAM];
	else
		string = [[OFString alloc] initWithFormat:
		    @"Failed to write %zu bytes in class %s! " ERRFMT, req_size,
		    [class className], ERRPARAM];

	return string;
}
@end

@implementation OFSetOptionFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Setting an option in class %s failed!", [class className]];

	return string;
}
@end

@implementation OFNotConnectedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The socket of type %s is not connected or bound!",
	    [class className]];

	return string;
}
@end

@implementation OFAlreadyConnectedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The socket of type %s is already connected or bound and thus "
	    @"can't be connected or bound again!", [class className]];

	return string;
}
@end

@implementation OFAddressTranslationFailedException
+ newWithClass: (Class)class_
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612

	string = [[OFString alloc] initWithFormat:
	    @"The service %s on %s could not be translated to an address in "
	    @"class %s. This means that either the node was not found, there "
	    @"is no such service on the node, there was a problem with the "
	    @"name server, there was a problem with your network connection "
	    @"or you specified an invalid node or service. " ERRFMT,
	    [service cString], [node cString], [class name], AT_ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







599
600
601
602
603
604
605
606
607
608
609
610
611
612
613

	string = [[OFString alloc] initWithFormat:
	    @"The service %s on %s could not be translated to an address in "
	    @"class %s. This means that either the node was not found, there "
	    @"is no such service on the node, there was a problem with the "
	    @"name server, there was a problem with your network connection "
	    @"or you specified an invalid node or service. " ERRFMT,
	    [service cString], [node cString], [class className], AT_ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"A connection to service %s on node %s could not be established "
	    @"in class %s! " ERRFMT, [node cString], [service cString],
	    [class name], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"A connection to service %s on node %s could not be established "
	    @"in class %s! " ERRFMT, [node cString], [service cString],
	    [class className], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Binding service %s on node %s using family %d failed in class "
	    @"%s! " ERRFMT, [service cString], [node cString], family,
	    [class name], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Binding service %s on node %s using family %d failed in class "
	    @"%s! " ERRFMT, [service cString], [node cString], family,
	    [class className], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to listen in socket of type %s with a back log of %d! "
	    ERRFMT, [class name], backlog, ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;







|







793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to listen in socket of type %s with a back log of %d! "
	    ERRFMT, [class className], backlog, ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to accept connection in socket of type %s! " ERRFMT,
	    [class name], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
}
@end

@implementation OFThreadJoinFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Joining a thread of class %s failed! Most likely, another thread "
	    @"already waits for the thread to join.", [class name]];

	return string;
}
@end

@implementation OFThreadCanceledException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The requested action cannot be performed because the thread of "
	    @"class %s was canceled!", [class name]];

	return string;
}
@end







|


















|













|




826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to accept connection in socket of type %s! " ERRFMT,
	    [class className], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
}
@end

@implementation OFThreadJoinFailedException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Joining a thread of class %s failed! Most likely, another thread "
	    @"already waits for the thread to join.", [class className]];

	return string;
}
@end

@implementation OFThreadCanceledException
- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"The requested action cannot be performed because the thread of "
	    @"class %s was canceled!", [class className]];

	return string;
}
@end