gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GSObjCFindVariable


From: Dr. H. Nikolaus Schaller
Subject: Re: GSObjCFindVariable
Date: Sun, 13 Jun 2010 19:10:10 +0200


Am 13.06.2010 um 18:50 schrieb address@hidden:

Hi!

typedef struct Foo
{
int x;
double y;
}
Foo;

@interface Brak : NSObject
{
Foo mFoo;
}
@end

I would like to know if it is to possibe to get the correct offset to the "x" or "y" field in the "mFoo" member of "Brak" using GSObjCFindVariable or some similar function. It would be pretty cool if I could set selected struct fields inside an instance by using GSObjCSetVariable. AFAIK the struct types are encoded, so the information should be there.

Well, you can get the address/offset of the mFoo struct. And then use standard-C to access components within the struct Foo.

I.e. something like

void *addr=/* get address of mFoo through GSObjCFindVariable */
((struct Foo *) addr)->y = 3.1415;

But AFAIK there is no KVC approach for struct type iVars (i.e. [obj valueForKey:@"mFoo.y"] ).

Nikolaus






reply via email to

[Prev in Thread] Current Thread [Next in Thread]