CFMutableBitVector Reference
| Derived from | |
| Framework | CoreFoundation/CoreFoundation.h |
| Companion guide | |
| Declared in | CFBitVector.h |
Overview
CFMutableBitVector objects manage dynamic bit vectors. The basic interface for managing bit vectors is provided by CFBitVector Reference. CFMutableBitVector adds functions to modify the contents of a bit vector.
You create a mutable bit vector object using either the CFBitVectorCreateMutable or CFBitVectorCreateMutableCopy function. You add to and remove from a bit vector by altering the size of the bit vector with the CFBitVectorSetCount function
Functions by Task
Creating a CFMutableBitVector Object
Modifying a Bit Vector
Functions
CFBitVectorCreateMutable
Creates a mutable bit vector.
CFMutableBitVectorRef CFBitVectorCreateMutable ( CFAllocatorRef allocator, CFIndex capacity );
Parameters
- allocator
The allocator to use to allocate memory for the new object. Pass
NULLorkCFAllocatorDefaultto use the current default allocator.- capacity
The maximum number of values that can be contained by the new bit vector. The bit vector starts empty and can grow to this number of values (and it can have less).
Pass
0to specify that the maximum capacity is not limited. The value must not be negative.
Return Value
A new bit vector. Ownership follows the Create Rule.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hCFBitVectorCreateMutableCopy
Creates a new mutable bit vector from a pre-existing bit vector.
CFMutableBitVectorRef CFBitVectorCreateMutableCopy ( CFAllocatorRef allocator, CFIndex capacity, CFBitVectorRef bv );
Parameters
- allocator
The allocator to use to allocate memory for the new object. Pass
NULLorkCFAllocatorDefaultto use the current default allocator.- capacity
The maximum number of values that can be contained by the new bit vector. The bit vector starts with the same number of values as bv and can grow to this number of values (it can have less).
Pass
0to specify that the maximum capacity is not limited. If non-0, capacity must be large enough to hold all bit values from bv.- 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.
See Also
Declared In
CFBitVector.hCFBitVectorFlipBitAtIndex
Flips a bit value in a bit vector.
void CFBitVectorFlipBitAtIndex ( CFMutableBitVectorRef bv, CFIndex idx );
Parameters
- bv
The bit vector to modify.
- idx
The index of the bit value to flip. The index must be in the range
0…N-1, whereNis the count of the vector.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hCFBitVectorFlipBits
Flips a range of bit values in a bit vector.
void CFBitVectorFlipBits ( CFMutableBitVectorRef bv, CFRange range );
Parameters
- bv
The bit vector to modify.
- range
The range of bit values in bv to flip. The range must not exceed
0…N-1, whereNis the count of the vector.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hCFBitVectorSetAllBits
Sets all bits in a bit vector to a particular value.
void CFBitVectorSetAllBits ( CFMutableBitVectorRef bv, CFBit value );
Parameters
- bv
The bit vector to modify.
- value
The bit value to which to set all bits in bv.
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.hCFBitVectorSetBitAtIndex
Sets the value of a particular bit in a bit vector.
void CFBitVectorSetBitAtIndex ( CFMutableBitVectorRef bv, CFIndex idx, CFBit value );
Parameters
- bv
The bit vector to modify.
- idx
The index of the bit value to set. The index must be in the range
0…N-1, whereNis the count of the vector.- value
The bit value to which to set the bit at index idx.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hCFBitVectorSetBits
Sets a range of bits in a bit vector to a particular value.
void CFBitVectorSetBits ( CFMutableBitVectorRef bv, CFRange range, CFBit value );
Parameters
- bv
The bit vector to modify.
- range
The range of bits to set. The range must not exceed
0…N-1, whereNis the count of the vector.- value
The bit value to which to set the range of bits.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hCFBitVectorSetCount
Changes the size of a mutable bit vector.
void CFBitVectorSetCount ( CFMutableBitVectorRef bv, CFIndex count );
Parameters
- bv
The bit vector to modify.
- count
The new size for bv. If count is greater than the current size of bv, the additional bit values are set to
0.
Discussion
If bv was created with a fixed capacity, you cannot increase its size beyond that capacity.
Availability
- Available in iOS 2.0 and later.
See Also
Declared In
CFBitVector.hData Types
CFMutableBitVectorRef
A reference to a mutable bit vector object.
typedef struct __CFBitVector *CFMutableBitVectorRef;
Availability
- Available in iOS 2.0 and later.
Declared In
CFBitVector.h© 2003, 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-11-17)