Encapsulate C struct/toll-free bridging?
Encapsulate C struct/toll-free bridging?
- Subject: Encapsulate C struct/toll-free bridging?
- From: David Bainbridge <email@hidden>
- Date: Mon, 8 Mar 2004 21:52:52 -0600
I am passing a C data structure back and forth between Cocoa framework
and carbon CFM code. Is there an elegant way to encapsulate structs
such that I can integrate it better with Objective-C/Cocoa? Example
struct:
struct C_CList {
SInt32
numItems;
SInt32 slots;
SInt32
blockSize;
Handle hItems;
SInt32
elementSize;
UInt8
lockChanges;
UInt8
usingTemporary;
};
I would like this to actually be data members to an objective-c class
and access the data with methods like -(SInt32)numItems, etc.. I don't
wish to allocate an object and copy each data member over to it and
then turn around and copy it back to the struct when it needs to be
sent back to the CFM code. Currently I am using class methods and
passing the entire C struct to modify/access the data. It sounds like
I am looking for something similar to the toll-free bridging that goes
on between some CF structures and Cocoa objects.. Any suggestions?
Thanks,
D. Bainbridge
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.