Am 13.06.2010 um 18:50 schrieb ici...@mail.cg.tuwien.ac.at:
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
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev