Re: CFStringRef == NSString* ?
Re: CFStringRef == NSString* ?
- Subject: Re: CFStringRef == NSString* ?
- From: Chris Pavicich <email@hidden>
- Date: Wed, 21 Apr 2004 17:29:37 -0400
Mark:
Most of the CF classes have a toll free bridged NS equivalent.
Your example of CFStringRef is a good one. You can safely treat a
CFStringRef as an NString *. Anywhere that you see an NSString *, you can
safely pass a CFStringRef. The reverse is also true.
To quote chapter and verse:
NSString is toll-free bridged with its Core Foundation counterpart, CFString. What this fact means is that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. This means that in an API where you see an NSString * parameter, you can pass in a CFStringRef, and in an API where you see a CFStringRef parameter, you can pass in an NSString instance. This fact also applies to your concrete subclasses of NSString. See Integrating Carbon and Cocoa in Your Application for more information on toll-free bridging.
The above is taken from:
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSString.html
HTH,
CMP
On Wednesday, April 21, 2004, at 04:22PM, Mark Alldritt <email@hidden> wrote:
>
Hello,
>
>
I have a bunch of C++ code that interacts with CodeFoundation (CFString,
>
etc.). I would like to reused this code in a Cocoa project. The question
>
is this: are the CoreFoundation types (CFStringRef, CFArrayRef, etc.) equal
>
to corresponding FoundationKit types (NSString*, NSArray*, etc.)?
>
>
If this is true, then I can safely cast my CFStringRef to a NSString* and
>
pass it along to the Objective-C/Cocoa portions of my application.
>
>
Cheers
>
-Mark
>
>
---------------------------------------------------------------------
>
Mark Alldritt Late Night Software Ltd.
>
Phone: 250-380-1725 333 Moss Street
>
FAX: 250-383-3204 Victoria, B.C.
>
WEB: http://www.latenightsw.com/ CANADA V8V-4M9
>
AIM: markalldritt
>
_______________________________________________
>
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.
_______________________________________________
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.