Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can one extend CoreFoundation using Obj-C?



On Sunday, July 29, 2001, at 01:20 PM, Brian Cave wrote:

I want to have a unique CFTypeID that my class exports that would be unique in the same manner as these already are in the CoreFoundation world, no better. And I want my class to be retainable / releaseable using the CoreFoundation retain / release APIs. I do not desire any more compatability than this.

I looked into this a while back, and even downloaded the portion of the CF source in Darwin so I could see how it's done. Right now, it can't, per se.

There are several limitations to the CF itself (a fairly restrictive limit on the global number of CF types allowed in a single process -- 255 -- for example), and the internal API that you'd need to use (which you could dig out of Darwin) is very likely to change. In fact, I'd almost put money on it having changed in 10.1.

However, someone on this list (I forget who, sorry) had the excellent suggestion of wrapping my class around a CFData. Create some accessors to store the class' private instance data (ie., a struct) in the CFData.

What I ended up doing in the end was to just create a separate set of CF functions for my own class' use that paralleled the standard CF ones (ie., CFXRetain instead of CFRetain). I also created my own set of collection-handling functions for CFDictionaries and CFArrays that did the right thing with both my own CF-like types and standard CF types.

Brian


email@hidden http://personalpages.tds.net/~brian_hill

"Why? I came into this game for adventure - go anywhere, travel
light, get in, get out, wherever there's trouble, a man alone.
Now they've got the whole country sectioned off and you can't
move without a form. I'm the last of a breed."
-- Archibald "Harry" Tuttle, Rogue HVAC Repairman



References: 
 >Can one extend CoreFoundation using Obj-C? (From: Brian Cave <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.