Differences From Artifact [75df3d0578]:
- File src/OFList.m — part of check-in [17d18368bb] at 2011-05-08 22:36:34 on branch trunk — Change serialization format. (user: js, size: 8863) [annotate] [blame] [check-ins using]
To Artifact [60c8cd9af5]:
- File
src/OFList.m
— part of check-in
[494dca4ae4]
at
2011-05-14 12:26:39
on branch trunk
— Use XML for serialization.
This way, we don't need a new parser and don't use a new format. (user: js, size: 8575) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include "config.h" #include "assert.h" #import "OFList.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "macros.h" @implementation OFList | > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | #include "config.h" #include "assert.h" #import "OFList.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "macros.h" @implementation OFList |
︙ | ︙ | |||
319 320 321 322 323 324 325 | * to be OFString*, so it can't be modified anyway. But not swizzling it * would create a real copy each time -[copy] is called. */ ret->isa = [OFString class]; return ret; } | | < > | | < > > < | < < < < < < < < < < < < | | | | | | | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 | * to be OFString*, so it can't be modified anyway. But not swizzling it * would create a real copy each time -[copy] is called. */ 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_ { of_list_object_t **listObject = (of_list_object_t**)state->extra; state->itemsPtr = objects; state->mutationsPtr = &mutations; if (state->state == 0) { *listObject = firstListObject; state->state = 1; } if (*listObject == NULL) return 0; objects[0] = (*listObject)->object; *listObject = (*listObject)->next; return 1; } - (OFEnumerator*)objectEnumerator { return [[[OFListEnumerator alloc] initWithList: self |
︙ | ︙ |