Overview
Comment: | Improve methods using blocks in OFDictionary.
Mutations during enumerations using blocks are now always detected, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6214a3be25ee7692d661996f59b32610 |
User & Date: | js on 2011-07-22 17:03:22 |
Other Links: | manifest | tags |
Context
2011-07-22
| ||
18:59 | Rename object1 and object2 to left and right in -[reduceWithBlock:]. check-in: 030cc6df0e user: js tags: trunk | |
17:09 | Rename -[reduceUsingBlock:] to -[foldUsingBlock:]. check-in: d6faaf68b9 user: js tags: trunk | |
17:03 | Improve methods using blocks in OFDictionary. check-in: 6214a3be25 user: js tags: trunk | |
Changes
Modified src/OFDictionary.m from [b5e17c6561] to [95bb1cf3d0].
︙ | ︙ | |||
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]; |
︙ | ︙ |