ObjFW  Diff

Differences From Artifact [bb52ca9d4f]:

To Artifact [47a649e523]:


32
33
34
35
36
37
38

39
40
41
42
43
44
45
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46







+








#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFFile.h"
#import "OFURL.h"
#import "OFHTTPRequest.h"
#import "OFXMLElement.h"
#import "OFAutoreleasePool.h"

#import "OFHTTPRequestFailedException.h"
#import "OFInitializationFailedException.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidEncodingException.h"
#import "OFInvalidFormatException.h"
1051
1052
1053
1054
1055
1056
1057
1058

1059
1060
1061
1062
1063
1064





1065
1066
1067
1068
1069


1070

1071
1072
1073



1074
1075
1076


1077

1078

1079
1080
1081
1082
1083
1084

1085
1086
1087
1088
1089
1090
1091
1052
1053
1054
1055
1056
1057
1058

1059
1060





1061
1062
1063
1064
1065





1066
1067

1068
1069


1070
1071
1072
1073


1074
1075
1076
1077

1078






1079
1080
1081
1082
1083
1084
1085
1086







-
+

-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
+
+
-
+

-
-
+
+
+

-
-
+
+

+
-
+
-
-
-
-
-
-
+







}

- (OFString*)description
{
	return [[self copy] autorelease];
}

- (OFString*)stringBySerializing
- (OFXMLElement*)XMLElementBySerializing
{
	OFMutableString *serialization = [[self mutableCopy] autorelease];
	[serialization replaceOccurrencesOfString: @"\\"
				       withString: @"\\\\"];
	[serialization replaceOccurrencesOfString: @"\""
				       withString: @"\\\""];
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"
				      namespace: OF_SERIALIZATION_NS
	[serialization replaceOccurrencesOfString: @"\n"
				       withString: @"\\n\"\n    \""];
	[serialization replaceOccurrencesOfString: @"\r"
				       withString: @"\\r"];
	[serialization replaceOccurrencesOfString: @"\t"
				    stringValue: self];

				       withString: @"\\t"];
	pool = [[OFAutoreleasePool alloc] init];

	if ([self isKindOfClass: [OFMutableString class]])
		[serialization prependString: @"(mutable)\""];
	if ([self isKindOfClass: [OFConstantString class]])
		[element addAttributeWithName: @"class"
				  stringValue: @"OFString"];
	else
		[serialization prependString: @"\""];
	[serialization appendString: @"\""];
		[element addAttributeWithName: @"class"
				  stringValue: [self className]];

	[pool release];
	/*

	 * Class swizzle the string to be immutable. We declared the return type
	 * to be OFString*, so it can't be modified anyway. But not swizzling it
	 * would create a real copy each time -[copy] is called.
	 */
	serialization->isa = [OFString class];
	return serialization;
	return element;
}

- (of_unichar_t)characterAtIndex: (size_t)index
{
	of_unichar_t c;

	if (![self isUTF8]) {