QuickTime for .NET and COM Developers

CFObject and Its Uses

The CFObject is a data container object that is used throughout the QuickTime Object Model, especially for complex data sets. It can contain data in a variety of formats from primitive types such as simple numbers or strings to more complex structures such as an array or dictionary, or even just raw bytes. Table 5.7 provides a summary.

Table 5.7: The CFObject Data Types as Listed in CFObjectTypesEnum

CFObject Type

Contains

CFObjectTypeBoolean

True or False

CFObjectTypeNumber

Integer or floating-point number

CFObjectTypeString

String

CFObjectTypeArray

Array of CFObject

CFObjectTypeDictionary

Dictionary of key-value pairs. Key may be integer or string. Value may be any CFObject.

CFObjectTypeData

Raw data (i.e., bytes)

CFObjectTypeInvalid

Nothing

If you have a CFObject, you can find out what type it is (or, more precisely, what type of data it contains) by examining its Type property. This will return one of the types listed in CFObjectTypesEnum, as shown in Table 5.7.

If the CFObject is a Boolean, Number, or String, you can get its value using the (default) Value property, which simply returns the value as a System.Object in .NET or Variant in VB6.

The CFObject is not just a read-only object. It is also possible to create a CFObject and put data into it. The following code snippet shows how to create a CFObject and use it with the primitive CFObject types:

Dim cf...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Data Loggers and Data Recorders
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.