Property List Structure and Contents

Property lists are constructed from the basic Core Foundation types CFString, CFNumber, CFBoolean, CFDate, and CFData. To build a complex data structure out of these basic types, you put them inside a CFDictionary or CFArray. To simplify programming with property lists, any of the property list types can also be referred to using a reference of type CFPropertyListRef.

CFPropertyList provides an abstraction for all the property list types—you can think of CFPropertyList in object-oriented terms as being the superclass of CFString, CFNumber, CFDictionary, and so on. When a Core Foundation function returns a CFPropertyListRef, it means that the value may be any of the property list types. For example, CFPreferencesCopyAppValue returns a CFPropertyListRef. This means that the value returned can be a CFString object, a CFNumber object, a CFDictionary object, and so on again. You can use CFGetTypeID to determine what type of object a property list value is.

In a CFDictionary object, data is structured as key-value pairs, where each key is a string and the key’s value can be a CFString, a CFNumber, a CFBoolean, a CFDate, a CFData, a CFArray, or another CFDictionary object. If you use a CFDictionary object as a property list, all its keys must be CFString objects.

In a CFArray object, data is structured as an ordered collection of objects that can be accessed by index. In a property list, a CFArray object can contain any of the basic property list types, as well as CFDictionary objects and other CFArray objects.

Although CFDictionary and CFArray objects can contain data types other than the property list types, if they do, you can’t use the Core Foundation property list programming interface to work with them.