Re: How to archive structs like NSRect
Re: How to archive structs like NSRect
- Subject: Re: How to archive structs like NSRect
- From: Gordon Apple <email@hidden>
- Date: Mon, 12 Nov 2007 16:50:44 -0600
It's good to know this exists. I had never seen this. However, it
still doesn't help in encoding an NSDictionary. You have to put these
things into an NSValue just to get them into the dictionary. Then if you
want to encode the dictionary, you have to iterate through the dictionary
and test every entry for every particular type of NSValue to encode it.
Then, I'm still not sure how to decode it unless you encode Type info with
it.
In my case, I have more than one NSDictionary, each of which hasn't an a
priori clue as to what it contains. The keys and objects/values are filled
in from elsewhere. Everything contained conforms to NSCoding. What I would
like is to be able to just tell it to archive/unarchive the dictionary and
be done with it.
> How about NSGeometryKeyedCoding (see NSKeyedArchiver.h) :
>
>
> @interface NSCoder (NSGeometryKeyedCoding)
>
> - (void)encodePoint:(NSPoint)point forKey:(NSString *)key;
> - (void)encodeSize:(NSSize)size forKey:(NSString *)key;
> - (void)encodeRect:(NSRect)rect forKey:(NSString *)key;
>
> - (NSPoint)decodePointForKey:(NSString *)key;
> - (NSSize)decodeSizeForKey:(NSString *)key;
> - (NSRect)decodeRectForKey:(NSString *)key;
>
> @end
>
>
> Guy Meyer
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden