• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: (more) [NSDictionary writeToFile:atomically:]wierd access
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (more) [NSDictionary writeToFile:atomically:]wierd access


  • Subject: Re: (more) [NSDictionary writeToFile:atomically:]wierd access
  • From: email@hidden
  • Date: Fri, 26 Jul 2002 01:28:12 -0400

The same goes for the description method.

On Friday, July 26, 2002, at 01:14 AM, email@hidden wrote:

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.

References: 
 >[NSDictionary writeToFile:atomically:] wierd access (From: email@hidden)

  • Prev by Date: [NSDictionary writeToFile:atomically:] wierd access
  • Next by Date: Re: NSBeginAlertSheet and contextInfo
  • Previous by thread: [NSDictionary writeToFile:atomically:] wierd access
  • Next by thread: about double click position on NSTableView
  • Index(es):
    • Date
    • Thread