CFMutableArray

Overview

CFMutableArray manages dynamic arrays. The basic interface for managing arrays is provided by CFArray. CFMutableArray adds functions to modify the contents of an array.

You create a mutable array object using either the CFArrayCreateMutable or CFArrayCreateMutableCopy function.

CFMutableArray provides several functions for changing the contents of an array, for example the CFArrayAppendValue and CFArrayInsertValueAtIndex functions add values to an array and CFArrayRemoveValueAtIndex removes values from an array. You can also reorder the contents of an array using CFArrayExchangeValuesAtIndices and CFArraySortValues.

CFMutableArray is “toll-free bridged” with its Cocoa Foundation counterpart, NSMutableArray. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an NSMutableArray * parameter, you can pass in a CFMutableArrayRef, and in a function where you see a CFMutableArrayRef parameter, you can pass in an NSMutableArray instance. This fact also applies to concrete subclasses of NSMutableArray. See Toll-Free Bridged Types for more information on toll-free bridging.

Topics

CFMutableArray Miscellaneous Functions

CFArrayAppendArray

Adds the values from one array to another array.

CFArrayAppendValue

Adds a value to an array giving it the new largest index.

CFArrayCreateMutable

Creates a new empty mutable array.

CFArrayCreateMutableCopy

Creates a new mutable array with the values from another array.

CFArrayExchangeValuesAtIndices

Exchanges the values at two indices of an array.

CFArrayInsertValueAtIndex

Inserts a value into an array at a given index.

CFArrayRemoveAllValues

Removes all the values from an array, making it empty.

CFArrayRemoveValueAtIndex

Removes the value at a given index from an array.

CFArrayReplaceValues

Replaces a range of values in an array.

CFArraySetValueAtIndex

Changes the value at a given index in an array.

CFArraySortValues

Sorts the values in an array using a given comparison function.

Data Types

CFMutableArrayRef

A reference to a mutable array object.

See Also

Opaque Types

CFFileDescriptor

The CFFileDescriptor provides an opaque type to monitor file descriptors for read and write activity via CFRunLoop.

CFStringTokenizer

CFStringTokenizer allows you to tokenize strings into words, sentences or paragraphs in a language-neutral way. It supports languages such as Japanese and Chinese that do not delimit words by spaces, as well as de-compounding German compounds. You can obtain Latin transcription for tokens. It also provides language identification API.