[NSDictionary writeToFile:atomically:] wierd access
[NSDictionary writeToFile:atomically:] wierd access
- Subject: [NSDictionary writeToFile:atomically:] wierd access
- From: email@hidden
- Date: Fri, 26 Jul 2002 01:14:18 -0400
I have implemented an ordered dictionary like this:
@interface OrderedDictionary : NSDictionary
{
id keysOrdered;
id dictionary;
}
- (unsigned) count;
- (NSEnumerator*) keyEnumerator;
- (id) objectForKey: (id)aKey;
@end
@implementation OrderedDictionary
- (unsigned) count { return [keysOrdered count]; }
- (NSEnumerator*) keyEnumerator {return [keysOrdered objectEnumerator]; }
- (id) objectForKey: (id)aKey {return [dictionary objectForKey: aKey]; }
@end
And so, with the primitive methods implemented, the derived method
writeToFile:atomically: should work perfectly, but the ordered
dictionary is still being written as an unordered dictionary. Why is
this?
I have found that the writeToFile:atomically: method does indeed make
use of the two primitive methods: keyEnumerator and objectForKey:, in
that first keyEnumerator is called (presumably to go through the keys)
and then objectForKey: is called for each entry (presumably in a loop
involving the NSEnumerator for the keys).
Why would it still randomly write the entries (is it just darn stubborn)?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.