ObjFW  Diff

Differences From Artifact [8deaa7a6b1]:

To Artifact [037aaf69fa]:


36
37
38
39
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
36
37
38
39
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







+
-
+



-
-
-
-
+
+
-
-



-
+
-
-

+

-
+
+

-
+







}

- initWithSerialization: (OFXMLElement*)element
{
	self = [self init];

	@try {
		OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
		OFAutoreleasePool *pool, *pool2;
		OFAutoreleasePool *pool2;
		OFEnumerator *enumerator;
		OFXMLElement *child;

		pool = [[OFAutoreleasePool alloc] init];

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

		enumerator = [[element
		enumerator = [[element children] objectEnumerator];
		    elementsForName: @"object"
			  namespace: OF_SERIALIZATION_NS] objectEnumerator];
		pool2 = [[OFAutoreleasePool alloc] init];

		while ((child = [enumerator nextObject]) != nil) {
			id object = [child objectByDeserializing];
			if (![[child namespace] isEqual: OF_SERIALIZATION_NS])
				continue;

			[self appendObject: object];
			[self appendObject: [child objectByDeserializing]];

			[pool2 releaseObjects];
		}

		[pool release];
	} @catch (id e) {
		[self release];
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
360
361
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
394
395







+
-
+



-
+


-
+
-
-



+
-
+


+
+
-
+
+
+
+







	 */
	ret->isa = [OFString class];
	return ret;
}

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

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

	pool = [[OFAutoreleasePool alloc] init];
	pool2 = [[OFAutoreleasePool alloc] init];
	[element addAttributeWithName: @"class"
			  stringValue: [self className]];

	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		[element addChild: [iter->object XMLElementBySerializing]];

		[pool releaseObjects];
		[pool2 releaseObjects];
	}

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

	return element;
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count_