CFBitVector Reference
| Derived from | |
| Framework | CoreFoundation/CoreFoundation.h |
| Companion guide | |
| Declared in | CFBitVector.h |
Overview
CFBitVector and its derived mutable type, CFMutableBitVector, manage ordered collections of bit values, which are either 0 or 1. CFBitVector creates static bit vectors and CFMutableBitVector creates dynamic bit vectors.
Functions by Task
Creating a Bit Vector
Getting Information About a Bit Vector
-
CFBitVectorContainsBit -
CFBitVectorGetBitAtIndex -
CFBitVectorGetBits -
CFBitVectorGetCount -
CFBitVectorGetCountOfBit -
CFBitVectorGetFirstIndexOfBit -
CFBitVectorGetLastIndexOfBit
Getting the CFBitVector Type ID
Functions
CFBitVectorContainsBit
Returns whether a bit vector contains a particular bit value.
Boolean CFBitVectorContainsBit ( CFBitVectorRef bv, CFRange range, CFBit value );
Parameters
- bv
The bit vector to search.
- range
The range of bits in bv to search.
- value
The bit value for which to search.
Return Value
true if the specified range of bits in bv contains value, otherwise false.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorCreate
Creates an immutable bit vector from a block of memory.
CFBitVectorRef CFBitVectorCreate ( CFAllocatorRef allocator, const UInt8 *bytes, CFIndex numBits );
Parameters
- allocator
The allocator to use to allocate memory for the new bit vector. Pass
NULLorkCFAllocatorDefaultto use the current default allocator.- bytes
A pointer to the bit values to store in the new bit vector. The values are copied into the bit vector’s own memory. The bit indices are numbered left-to-right with
0being the left-most, or most-significant, bit in the byte stream.- numBits
The number of bits in the bit vector.
Return Value
A new bit vector. Ownership follows the Create Rule.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorCreateCopy
Creates an immutable bit vector that is a copy of another bit vector.
CFBitVectorRef CFBitVectorCreateCopy ( CFAllocatorRef allocator, CFBitVectorRef bv );
Parameters
- allocator
The allocator to use to allocate memory for the new bit vector. Pass
NULLorkCFAllocatorDefaultto use the current default allocator.- bv
The bit vector to copy.
Return Value
A new bit vector holding the same bit values as bv. Ownership follows the Create Rule.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetBitAtIndex
Returns the bit value at a given index in a bit vector.
CFBit CFBitVectorGetBitAtIndex ( CFBitVectorRef bv, CFIndex idx );
Parameters
- bv
The bit vector to examine.
- idx
The index of the bit value in bv to return.
Return Value
The bit value at index idx in bv.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetBits
Returns the bit values in a range of indices in a bit vector.
void CFBitVectorGetBits ( CFBitVectorRef bv, CFRange range, UInt8 *bytes );
Parameters
- bv
The bit vector to examine.
- range
The range of bit values to return.
- bytes
On return, contains the requested bit values from bv. This argument must point to enough memory to hold the number of bits requested. The requested bits are left-aligned with the first requested bit stored in the left-most, or most-significant, bit of the byte stream.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetCount
Returns the number of bit values in a bit vector.
CFIndex CFBitVectorGetCount ( CFBitVectorRef bv );
Parameters
- bv
The bit vector to examine.
Return Value
The current size of bv.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetCountOfBit
Counts the number of times a certain bit value occurs within a range of bits in a bit vector.
CFIndex CFBitVectorGetCountOfBit ( CFBitVectorRef bv, CFRange range, CFBit value );
Parameters
- bv
The bit vector to examine.
- range
The range of bits in bv to search.
- value
The bit value to count.
Return Value
The number of occurrences of value in the specified range of bv.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetFirstIndexOfBit
Locates the first occurrence of a certain bit value within a range of bits in a bit vector.
CFIndex CFBitVectorGetFirstIndexOfBit ( CFBitVectorRef bv, CFRange range, CFBit value );
Parameters
- bv
The bit vector to examine.
- range
The range of bits in bv to search.
- value
The bit value for which to search.
Return Value
The index of the first occurrence of value in the specified range of bv, or kCFNotFound if value is not present.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetLastIndexOfBit
Locates the last occurrence of a certain bit value within a range of bits in a bit vector.
CFIndex CFBitVectorGetLastIndexOfBit ( CFBitVectorRef bv, CFRange range, CFBit value );
Parameters
- bv
The bit vector to examine.
- range
The range of bits in bv to search.
- value
The bit value for which to search.
Return Value
The index of the last occurrence of value in the specified range of bv, or kCFNotFound if value is not present.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorGetTypeID
Returns the type identifier for the CFBitVector opaque type.
CFTypeID CFBitVectorGetTypeID ( void );
Return Value
The type identifier for the CFBitVector opaque type.
Discussion
CFMutableBitVector objects have the same type identifier as CFBitVector objects.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hData Types
CFBit
A binary value of either 0 or 1.
typedef UInt32 CFBit;
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorRef
A reference to an immutable bit vector object.
typedef const struct __CFBitVector *CFBitVectorRef;
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.h© 2003, 2005 Apple Computer, Inc. All Rights Reserved. (Last updated: 2005-12-06)