On 5 Dec 2008, at 8:08 pm, Mark Thomas wrote:

Hi All,
 Does anybody have any thoughts on how you could subclass or hook into
NSDictionary/NSMutableDictionary classes, so that I could provide my own file format instead of the default file format which are used today (i.e. Text or binary plist format). As I still want the flexibility of dictionary
but I don't want the default file formats.


You could just implement a category on NSDictionary that iterated over its contents and built whatever format you wanted.

If you wanted this to happen during archiving/unarchiving you'd have to subclass and implement the NSCoding protocol yourself, but you'd still have very limited scope for writing any arbitrary file format.

I'd love to know what you think is wrong with the file format that keyed archiving creates that your own would improve on....?



 Ideally it would be good if I could create
NSDictionary/NSMutableDictionary with a NSData object, but there doesn't
seem to be a way to pass in the info this way.


You could add one using a category. But naturally it wouldn't be magic - you'd have to parse the NSData content in an appropriate manner, since NSData is just a block of bytes.

--Graham



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to