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
|
}
- initWithSerialization: (OFXMLElement*)element
{
self = [self init];
@try {
OFAutoreleasePool *pool, *pool2;
OFEnumerator *enumerator;
OFXMLElement *child;
pool = [[OFAutoreleasePool alloc] init];
if (![[element name] isEqual: @"object"] ||
![[element namespace] isEqual: OF_SERIALIZATION_NS] ||
![[[element attributeForName: @"class"] stringValue]
isEqual: [self className]])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
enumerator = [[element
elementsForName: @"object"
namespace: OF_SERIALIZATION_NS] objectEnumerator];
pool2 = [[OFAutoreleasePool alloc] init];
while ((child = [enumerator nextObject]) != nil) {
id object = [child objectByDeserializing];
[self appendObject: object];
[pool2 releaseObjects];
}
[pool release];
} @catch (id e) {
[self release];
|
>
|
<
<
|
|
<
<
|
<
<
>
|
>
|
|
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 *pool2;
OFEnumerator *enumerator;
OFXMLElement *child;
if (![[element name] isEqual: [self className]] ||
![[element namespace] isEqual: OF_SERIALIZATION_NS])
@throw [OFInvalidArgumentException newWithClass: isa
selector: _cmd];
enumerator = [[element children] objectEnumerator];
pool2 = [[OFAutoreleasePool alloc] init];
while ((child = [enumerator nextObject]) != nil) {
if (![[child namespace] isEqual: OF_SERIALIZATION_NS])
continue;
[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
|
*/
ret->isa = [OFString class];
return ret;
}
- (OFXMLElement*)XMLElementBySerializing
{
OFAutoreleasePool *pool;
OFXMLElement *element;
of_list_object_t *iter;
element = [OFXMLElement elementWithName: @"object"
namespace: OF_SERIALIZATION_NS];
pool = [[OFAutoreleasePool alloc] init];
[element addAttributeWithName: @"class"
stringValue: [self className]];
for (iter = firstListObject; iter != NULL; iter = iter->next) {
[element addChild: [iter->object XMLElementBySerializing]];
[pool releaseObjects];
}
[pool release];
return element;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count_
|
>
|
|
|
<
<
>
|
>
>
|
>
>
>
|
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 *pool2;
OFXMLElement *element;
of_list_object_t *iter;
element = [OFXMLElement elementWithName: [self className]
namespace: OF_SERIALIZATION_NS];
pool2 = [[OFAutoreleasePool alloc] init];
for (iter = firstListObject; iter != NULL; iter = iter->next) {
[element addChild: [iter->object XMLElementBySerializing]];
[pool2 releaseObjects];
}
[element retain];
@try {
[pool release];
} @finally {
[element autorelease];
}
return element;
}
- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
objects: (id*)objects
count: (int)count_
|