Differences From Artifact [b5e17c6561]:
- File src/OFDictionary.m — part of check-in [cc87fcff36] at 2011-07-21 19:03:06 on branch trunk — Add -[allKeys] and -[allObjects] to OFDictionary. (user: js, size: 20716) [annotate] [blame] [check-ins using]
To Artifact [95bb1cf3d0]:
- File
src/OFDictionary.m
— part of check-in
[6214a3be25]
at
2011-07-22 17:03:22
on branch trunk
— Improve methods using blocks in OFDictionary.
Mutations during enumerations using blocks are now always detected,
even for methods such as -[filteredDictionaryUsingBlock:]. (user: js, size: 20656) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
747 748 749 750 751 752 753 | [pool release]; } - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block { OFMutableDictionary *new = [OFMutableDictionary dictionary]; | < > | < | | > < > | < | | | > | 747 748 749 750 751 752 753 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 | [pool release]; } - (OFDictionary*)mappedDictionaryUsingBlock: (of_dictionary_map_block_t)block { OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, BOOL *stop) { [new setObject: block(key, object) forKey: key]; }]; /* * Class swizzle the dictionary to be immutable. We declared the return * type to be OFDictionary*, so it can't be modified anyway. But not * swizzling it would create a real copy each time -[copy] is called. */ new->isa = [OFDictionary class]; return new; } - (OFDictionary*)filteredDictionaryUsingBlock: (of_dictionary_filter_block_t)block { OFMutableDictionary *new = [OFMutableDictionary dictionary]; [self enumerateKeysAndObjectsUsingBlock: ^ (id key, id object, BOOL *stop) { if (block(key, object)) [new setObject: object forKey: key]; }]; /* * Class swizzle the dictionary to be immutable. We declared the return * type to be OFDictionary*, so it can't be modified anyway. But not * swizzling it would create a real copy each time -[copy] is called. */ new->isa = [OFDictionary class]; |
︙ | ︙ |