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: CFPropertyList and NSDictionary/CFDictionary



On Nov 28, 2003, at 02:26 PM, Christopher Corbell wrote:

Is there any toll-free way to get from a CFPropertyListRef to an NSDictionary
(or CFDictionary) and back? I think I can probably use intermediate
NSData/CFDataRef to pass the raw XML data to and from a CFPropertyList and
a corresponding NSData object, but this seems inelegant to me - it's
a non-toll-free bridge between two redundant implementations of roughly
the same functionality. It seems like everything that CFPropertyList does
could have been added as a small extension to NSDictionary / CFDictionary.

CFPropertyListRef isn't any single data type, it's a representative for CFStringRef, CFNumberRef, CFDataRef, CFDateRef, CFDictionaryRef and CFArrayRef (I think that's all of them...). So if you know that a particular CFPropertyListRef is a dictionary, you can freely cast it to CF/NSDictionaryRef. Similarly if you know if follows the other supported types, you can cast freely between them as well. If you need to know what type it is, you can use CFGetTypeID() compared with CFxGetTypeID() (where x is the data type) to figure out what class you are dealing with, but this is rarely needed in practice.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.

David Duncan
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >CFPropertyList and NSDictionary/CFDictionary (From: Christopher Corbell <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.