Differences From Artifact [167e60e6d6]:
- File src/OFDictionary.m — part of check-in [17d18368bb] at 2011-05-08 22:36:34 on branch trunk — Change serialization format. (user: js, size: 18163) [annotate] [blame] [check-ins using]
To Artifact [5f45c17283]:
- File
src/OFDictionary.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: 18060) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <string.h> #import "OFDictionary.h" #import "OFEnumerator.h" #import "OFArray.h" #import "OFString.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #import "macros.h" | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #include <string.h> #import "OFDictionary.h" #import "OFEnumerator.h" #import "OFArray.h" #import "OFString.h" #import "OFXMLElement.h" #import "OFAutoreleasePool.h" #import "OFEnumerationMutationException.h" #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #import "macros.h" |
︙ | ︙ | |||
753 754 755 756 757 758 759 | * 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; } | | < > | < | < < < < > | < < < < < < > > > < < | > | > > | > > > | > > > > > > | | < < < < < < < < < | | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 | * 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, *pool2; OFXMLElement *element; OFEnumerator *keyEnumerator, *objectEnumerator; id <OFSerialization> key, object; element = [OFXMLElement elementWithName: @"object" namespace: OF_SERIALIZATION_NS]; pool = [[OFAutoreleasePool alloc] init]; [element addAttributeWithName: @"class" stringValue: [self className]]; keyEnumerator = [self keyEnumerator]; objectEnumerator = [self objectEnumerator]; pool2 = [[OFAutoreleasePool alloc] init]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { OFXMLElement *pair, *keyElement, *valueElement; pair = [OFXMLElement elementWithName: @"pair" namespace: OF_SERIALIZATION_NS]; keyElement = [OFXMLElement elementWithName: @"key" namespace: OF_SERIALIZATION_NS]; [keyElement addChild: [key XMLElementBySerializing]]; [pair addChild: keyElement]; valueElement = [OFXMLElement elementWithName: @"value" namespace: OF_SERIALIZATION_NS]; [valueElement addChild: [object XMLElementBySerializing]]; [pair addChild: valueElement]; [element addChild: pair]; [pool2 releaseObjects]; } [pool release]; return element; } @end @implementation OFDictionaryEnumerator - initWithDictionary: (OFDictionary*)dictionary_ data: (struct of_dictionary_bucket**)data_ size: (uint32_t)size_ |
︙ | ︙ |