Re: Leopard on PPC
Re: Leopard on PPC
- Subject: Re: Leopard on PPC
- From: glenn andreas <email@hidden>
- Date: Thu, 27 Mar 2008 11:22:18 -0500
On Mar 27, 2008, at 10:59 AM, Sherm Pendley wrote:
CFBoolean *is* toll free bridged to NSNumber.
OK, so where is that documented then? As I said, the CFBoolean
reference
says not a word about it:
It's more subtle than that.
CFNumber is toll-free bridged with NSNumber.
"toll-free bridged" things need to work both ways - where you can use
one, you can use the other.
If CFBoolean were toll-free bridged with NSNumber then you can use an
NSNumber where you can use a CFBoolean. But since you can also use a
CFNumber where you can use an NSNumber, this would mean that you can
use a CFNumber where there is a CFBoolean, which you can't.
CFBoolean is instead just "partially bridged". You can use
kCFBooleanTrue wherever you can use [NSNumber numberWithBool: YES] and
kCFBooleanFalse wherever you can use [NSNumber numberWithBool: NO] (in
that CFBoolean has enough scaffolding to support NSNumber routines,
and CFBooleanGetValue understands NSNumber).
This does not imply that [NSNumber numberWithBool: YES] ==
kCFBooleanTrue (it may be, but that's not documented as such), just
that they are interchangeable.
For example, from <http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Articles/AboutPropertyLists.html#//apple_ref/doc/uid/20001010-BBCBDBJE
>
Cocoa property lists organize data into named values and lists of
values using these classes:
•NSArray
•NSDictionary
•NSData
•NSString (java.lang.String in Java)
•NSNumber (subclasses of java.lang.Number in Java)
•NSDate
The Core Foundation property list API, defined in <CoreServices/
CoreServices.h>, supports the following Core Foundation types:
•CFArray
•CFDictionary
•CFData
•CFString
•CFDate
•CFNumber
•CFBoolean
Because all these types can be automatically cast to and from their
corresponding Cocoa types, you can use the Core Foundation property
list API with Cocoa objects. In most cases, however, methods
provided by theNSPropertyListSerialization class should provide
enough flexibility.
So it is documented that they can be automatically cast to and from
their corresponding Cocoa types (assuming you're willing to grant that
NSNumber is the corresponding type for CFBoolean, but they do say
_all_ of the types, and if it's not NSNumber, there's no clear other
candidate).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next
generation of fractal art
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden