Creating and Using Ranges
Many Core Foundation take ranges—a structure of type CFRange
—as parameters. A range is a measure of a linear segment; it has a beginning location and a length. To create and initialize this structure you can use the convenience function CFRangeMake
.
The following code fragment gets the number of subsequent elements in an array that match the first element:
CFRange aRange = CFRangeMake(1, CFArrayGetCount(array) - 1); |
// Since start is 1, length of remainder of range is count-1 |
const void *aValue = CFArrayGetValueAtIndex(array, 0); |
CFIndex numVals = CFArrayGetCountOfValue(array, aRange, aValue); |
Copyright © 2003, 2014 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2014-02-11