Re: Key-Value Coding Limitations
Re: Key-Value Coding Limitations
- Subject: Re: Key-Value Coding Limitations
- From: Graham J Lee <email@hidden>
- Date: Fri, 12 May 2006 12:18:52 +0100
On 12 May 2006, at 11:47, Jonathon Mah wrote:
On 2006-05-12, at 20:08, Graham J Lee wrote:
this could be a job for @defs:
that is, AFAICR, the first and only time I have ever written that.
#import <Foundation/Foundation.h>
@interface GLWibble:NSObject
{
int x;
double y;
}
@end
@implementation GLWibble [...] @end
typedef struct { @defs(GLWibble) } *CGLWibbleRef;
int main (int argc, const char * argv[]) {
GLWibble *myWibble=[GLWibble new];
CGLWibbleRef coreWibble=(CGLWibbleRef) myWibble;
printf("x:\t%d\ny:\t%g\n\n",coreWibble->x,coreWibble->y);
return 0;
}
This still has the problem I'm trying to avoid; I want to access
ivars by name so that the plugin will still work when the ivar
layout of the host app changes. I hadn't heard about @defs() though
-- thanks for bringing it to my attention.
Thinking and typing without testing: can you add accessors via a
category? I think that whatever you do though, you're still going to
end up with code which depends on the in-memory layout of the object
(i.e. needs a recompile every time the upstream people change their
code).
--
Graham J Lee
"Oxford University's UNIX Expert"
As seen in MacWorld UK
http://iamleeg.blogspot.com
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden