Skip navigation.
 
mlRe: Leopard on PPC
FROM : glenn andreas
DATE : Thu Mar 27 17:22:18 2008

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_removed>
  <http://www.gandreas.com/> wicked fun!
quadrium | prime : build, mutate, evolve, animate : the next 
generation of fractal art

Related mailsAuthorDate
mlLeopard on PPC Lorenzo Mar 26, 17:51
mlRe: Leopard on PPC Laurent Cerveau Mar 26, 18:02
mlRe: Leopard on PPC Jean-Daniel Dupas Mar 26, 18:07
mlRe: Leopard on PPC Lorenzo Mar 26, 21:02
mlRe: Leopard on PPC Nick Zitzmann Mar 26, 21:17
mlRe: Leopard on PPC Laurent Cerveau Mar 26, 21:29
mlRe: Leopard on PPC Jonathan Hess Mar 26, 21:41
mlRe: Leopard on PPC Lorenzo Mar 27, 00:04
mlRe: Leopard on PPC Sherm Pendley Mar 27, 00:48
mlRe: Leopard on PPC Clark Cox Mar 27, 16:25
mlRe: Leopard on PPC Clark Cox Mar 27, 16:29
mlRe: Leopard on PPC Sherm Pendley Mar 27, 16:59
mlRe: Leopard on PPC Matt Gough Mar 27, 17:18
mlRe: Leopard on PPC Jean-Daniel Dupas Mar 27, 17:19
mlRe: Leopard on PPC glenn andreas Mar 27, 17:22
mlRe: Leopard on PPC Sherm Pendley Mar 27, 17:33
mlRe: Leopard on PPC Scott Thompson Mar 27, 21:39
mlRe: Leopard on PPC Lorenzo Apr 28, 09:31
mlRe: Leopard on PPC Nick Zitzmann Apr 28, 09:34
mlRe: Leopard on PPC Lorenzo Apr 28, 09:48
mlRe: Leopard on PPC Jean-Daniel Dupas Apr 28, 09:58
mlRe: Leopard on PPC Jean-Daniel Dupas Apr 28, 10:58
mlRe: Leopard on PPC Michael Vannorsdel Apr 28, 18:58