Re: struct into a pasteboard
Re: struct into a pasteboard
- Subject: Re: struct into a pasteboard
- From: William Turner <email@hidden>
- Date: Sat, 22 Dec 2007 12:13:50 -0800
I'm not aware of any way of keeping a dictionary automatically
synchronized with a struct. If you think the struct is likely to be
modified after put it on the pasteboard but before it is retrieved
from the pasteboard, you might want to use the "Lazy Writing" pattern,
described in http://developer.apple.com/documentation/Cocoa/Conceptual/CopyandPaste/Articles/pbImplementing.html
.
This doesn't solve the problem of serializing your struct into an
NSData, but it might address your modification problem.
So, I'm burning to know - why not just use a mutable dictionary
instead of a struct? (Not telling you how to write your app, just
curious)
Wil
On Dec 22, 2007, at 11:46 AM, Lorenzo wrote:
Hi,
I have to put this struct into a pasteboard.
Since it contains an NSString it seems that I cannot convert it to an
NSValue nor NSData in one shot only. Of course I know that I can put
any
value manually into an NSDictionary. The problem is that if I modify
the
struct I wouldn't like to go and modify the dictionary. I would like
to get
this done automatically. Is a way to do that?
typedef struct
{
NSString *mapPath;
BOOL mapOn;
int mapFillMode;
NSRect mapRect;
NSSize mapTile;
float mapTileGap;
BOOL mapTileGapExternal;
float mapAngle;
NSSize mapScale;
/////////// 30 values more....
} PKTex;
Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
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
_______________________________________________
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