Re: Newbie (to Cocoa) questions
Re: Newbie (to Cocoa) questions
- Subject: Re: Newbie (to Cocoa) questions
- From: "Erik M. Buck" <email@hidden>
- Date: Thu, 7 Mar 2002 14:04:30 -0600
One toll free bridged object is NSString. Core Foundation defines a data
structure called CFStringRef and a set of C functions for manipulating
CFStringRefs. In fact, CFStringRef and a pointer to NSString are the same
thing and can be safely cast from one to the other. In the following
example, a CFStringRef is created and initialized. Then it is further
manipulated using Objective-C messages. Finally the NSString pointer is cast
back to CFStringRef.
CFStringRef authorNames = CFSTR("Scott Anguish, Erik Buck, Don Yactman");
CFStringRef credits;
credits = (CFStringRef)[@"Authors: " stringByAppendingString:(NSString
*)authorNames];
Not all Core Foundation data types that may seem to be toll free bridged to
a Foundation object actually are. CFArray, CFCharacterSet, CFData, CFDate,
CFDictionary, CFRunLoopTimer, CFSet, CFString, and CFURL are toll free
bridged to NSArray, NSCharacterSet, NSData, NSDate, NSDictionary, NSTimer,
NSSet, NSString and NSURL respectively. Other Core Foundation types may be
used in the implementation of Foundation objects or may be completely
unrelated. In either case, they can not be used interchangeably with the
Foundation framework objects that have similar names.
_______________________________________________
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.