ObjFW  Diff

Differences From Artifact [a47eecf9ee]:

To Artifact [a3610e7d0e]:


712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFString *typeString;

		if (![[element name] isEqual: @"object"] ||
		    ![[element namespace] isEqual: OF_SERIALIZATION_NS] ||
		    ![[[element attributeForName: @"class"] stringValue]
		    isEqual: [self className]])
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		typeString = [[element attributeForName: @"type"] stringValue];

		if ([typeString isEqual: @"boolean"]) {
			type = OF_NUMBER_BOOL;







|
|
<
<







712
713
714
715
716
717
718
719
720


721
722
723
724
725
726
727
{
	self = [super init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFString *typeString;

		if (![[element name] isEqual: [self className]] ||
		    ![[element namespace] isEqual: OF_SERIALIZATION_NS])


			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		typeString = [[element attributeForName: @"type"] stringValue];

		if ([typeString isEqual: @"boolean"]) {
			type = OF_NUMBER_BOOL;
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}
}

- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool;
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: @"object"
				      namespace: OF_SERIALIZATION_NS];

	pool = [[OFAutoreleasePool alloc] init];

	[element addAttributeWithName: @"class"
			  stringValue: [self className]];
	[element setStringValue: [self description]];

	switch (type) {
	case OF_NUMBER_BOOL:
		[element addAttributeWithName: @"type"
				  stringValue: @"boolean"];
		break;
	case OF_NUMBER_UCHAR:







|


|
|
<
<
<
<
|
<







1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182




1183

1184
1185
1186
1187
1188
1189
1190
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}
}

- (OFXMLElement*)XMLElementBySerializing
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFXMLElement *element;

	element = [OFXMLElement elementWithName: [self className]
				      namespace: OF_SERIALIZATION_NS




				    stringValue: [self description]];


	switch (type) {
	case OF_NUMBER_BOOL:
		[element addAttributeWithName: @"type"
				  stringValue: @"boolean"];
		break;
	case OF_NUMBER_UCHAR:
1251
1252
1253
1254
1255
1256
1257


1258



1259
1260
1261
1262
		    [OFString stringWithFormat: @"%" PRIX64, d.i]];

		break;
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}



	[pool release];




	return element;
}
@end







>
>
|
>
>
>




1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
		    [OFString stringWithFormat: @"%" PRIX64, d.i]];

		break;
	default:
		@throw [OFInvalidFormatException newWithClass: isa];
	}

	[element retain];
	@try {
		[pool release];
	} @finally {
		[element autorelease];
	}

	return element;
}
@end