ObjFW  Diff

Differences From Artifact [9b74d0387e]:

To Artifact [5f30990c6d]:


328
329
330
331
332
333
334
335
336
337





338
339
340
341
342
343
344
328
329
330
331
332
333
334



335
336
337
338
339
340
341
342
343
344
345
346







-
-
-
+
+
+
+
+








- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */
	[self doesNotRecognizeSelector: _cmd];
	abort();

	/* Get rid of a stupid warning */
	[super dealloc];
}
@end

@implementation OFString
+ (void)initialize
{
	if (self == [OFString class])
505
506
507
508
509
510
511

512
513
514





515

516
517
518
519
520
521
522
507
508
509
510
511
512
513
514



515
516
517
518
519

520
521
522
523
524
525
526
527







+
-
-
-
+
+
+
+
+
-
+







	return [[[self alloc] initWithContentsOfURL: URL
					   encoding: encoding] autorelease];
}

- init
{
	if (object_getClass(self) == [OFString class]) {
		@try {
		Class c = [self class];
		[self release];
		@throw [OFNotImplementedException exceptionWithClass: c
			[self doesNotRecognizeSelector: _cmd];
			abort();
		} @catch (id e) {
			[self release];
			@throw e;
							    selector: _cmd];
		}
	}

	return [super init];
}

- initWithUTF8String: (const char*)UTF8String
{
547
548
549
550
551
552
553

554
555
556





557

558
559
560
561

562
563
564





565

566
567
568
569
570
571
572
552
553
554
555
556
557
558
559



560
561
562
563
564

565
566
567
568
569
570



571
572
573
574
575

576
577
578
579
580
581
582
583







+
-
-
-
+
+
+
+
+
-
+




+
-
-
-
+
+
+
+
+
-
+







			      length: strlen(cString)];
}

- initWithCString: (const char*)cString
	 encoding: (of_string_encoding_t)encoding
	   length: (size_t)cStringLength
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithString: (OFString*)string
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithUnicodeString: (const of_unichar_t*)string
{
	return [self initWithUnicodeString: string
				 byteOrder: OF_BYTE_ORDER_NATIVE
				    length: of_unicode_string_length(string)];
588
589
590
591
592
593
594

595
596
597





598

599
600
601
602
603
604
605
599
600
601
602
603
604
605
606



607
608
609
610
611

612
613
614
615
616
617
618
619







+
-
-
-
+
+
+
+
+
-
+







				    length: length];
}

- initWithUnicodeString: (const of_unichar_t*)string
	      byteOrder: (of_byte_order_t)byteOrder
		 length: (size_t)length
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithUTF16String: (const uint16_t*)string
{
	return [self initWithUTF16String: string
			       byteOrder: OF_BYTE_ORDER_BIG_ENDIAN
				  length: of_utf16_string_length(string)];
621
622
623
624
625
626
627

628
629
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
659
660
661
662
663
664
665
666
667
668
669
670
671

672
673
674





675

676
677
678
679
680
681
682
635
636
637
638
639
640
641
642



643
644
645
646
647

648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667



668
669
670
671
672

673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692



693
694
695
696
697

698
699
700
701
702
703
704
705







+
-
-
-
+
+
+
+
+
-
+


















+
-
-
-
+
+
+
+
+
-
+


















+
-
-
-
+
+
+
+
+
-
+







				  length: length];
}

- initWithUTF16String: (const uint16_t*)string
	    byteOrder: (of_byte_order_t)byteOrder
	       length: (size_t)length
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithFormat: (OFConstantString*)format, ...
{
	id ret;
	va_list arguments;

	va_start(arguments, format);
	ret = [self initWithFormat: format
			 arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithFormat: (OFConstantString*)format
       arguments: (va_list)arguments
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithPath: (OFString*)firstComponent, ...
{
	id ret;
	va_list arguments;

	va_start(arguments, firstComponent);
	ret = [self initWithPath: firstComponent
		       arguments: arguments];
	va_end(arguments);

	return ret;
}

- initWithPath: (OFString*)firstComponent
     arguments: (va_list)arguments
{
	@try {
	Class c = [self class];
	[self release];
	@throw [OFNotImplementedException exceptionWithClass: c
		[self doesNotRecognizeSelector: _cmd];
		abort();
	} @catch (id e) {
		[self release];
		@throw e;
						    selector: _cmd];
	}
}

- initWithContentsOfFile: (OFString*)path
{
	return [self initWithContentsOfFile: path
				   encoding: OF_STRING_ENCODING_UTF_8];
}
924
925
926
927
928
929
930
931
932


933
934
935
936
937
938
939
947
948
949
950
951
952
953


954
955
956
957
958
959
960
961
962







-
-
+
+







- (const char*)UTF8String
{
	return [self cStringUsingEncoding: OF_STRING_ENCODING_UTF_8];
}

- (size_t)length
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (size_t)lengthOfBytesUsingEncoding: (of_string_encoding_t)encoding
{
	switch (encoding) {
	case OF_STRING_ENCODING_UTF_8:;
		const of_unichar_t *unicodeString;
968
969
970
971
972
973
974
975
976


977
978
979
980
981
982
983
991
992
993
994
995
996
997


998
999
1000
1001
1002
1003
1004
1005
1006







-
-
+
+







- (size_t)UTF8StringLength
{
	return [self lengthOfBytesUsingEncoding: OF_STRING_ENCODING_UTF_8];
}

- (of_unichar_t)characterAtIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)getCharacters: (of_unichar_t*)buffer
	      inRange: (of_range_t)range
{
	size_t i;