Re: [Pyobjc-dev] In and out of NSData
Brought to you by:
ronaldoussoren
From: Ronald O. <ous...@ci...> - 2003-01-08 06:25:42
|
On Wednesday, Jan 8, 2003, at 00:49 Europe/Amsterdam, Bob Ippolito wrote: > > Is there currently any way to do (pyobjc) NS* <-> (Carbon.CF) CF* for > the toll-free bridged types? I don't see anything obvious from a > quick look. Not yet, but adding these mappings would be quite easy. Proposed interface: Foundation.pyobjc_NSToCF(NSObject) -> CFObject Foundation.pyobjc_CFToNS(CFObject) -> NSObject Both raise ValueError if the argument cannot be mapped to the other representation. These are uncontroversion, except maybe the location of the functions. When I first looked at doing this I intended to implement pyobjc_CFToNS as part of the generic bridge; that is, if the Objective-C code expects to receive an NSObject and the user passed in a CFObject automaticly translate between the two. I'm currently not sure whether that would be a good idea, stuffing a CFObject in a NS<Datastructure> and retrieving it again would effectivly change its type. This might be pretty confusing (especially because the translation from NSObject to CFObject won't be automatic). I'm therefore inclined to making all mappings from CF to NS and back manual operations. Opinions? Ronald |