setObject(unsigned int, const OSMetaClassBase *)
Inserts or appends an object into the array at a particular index.
Declaration
virtual bool setObject(
unsigned intindex,
const OSMetaClassBase *anObject);Parameters
- index:
The index in the array at which to insert the object. Must be less than or equal to the array's count.
- anObject:
The object to add to the array.
Return Value
true if the addition of anObject was successful, false if not.
Overview
This function moves existing objects from index on, in order to accommodate the new object; it does not replace an existing object at index. See replaceObject. If successfully added, the object is retained.
The array adds storage to accomodate the new object, if necessary. Note, however, that this function does not allow for arbirtrary growth of an array by specifying an index larger than the current count. If you need to immediately grow an array by an arbitrary amount, use ensureCapacity.
See Also
Miscellaneous
copyCollectionensureCapacityflushCollectionfreegetCapacitygetCapacityIncrementgetCountgetLastObjectgetNextIndexOfObjectgetObjectinitWithArrayinitWithCapacityinitWithObjectsisEqualTo(const OSArray *)isEqualTo(const OSMetaClassBase *)mergeremoveObjectreplaceObjectserializesetCapacityIncrementsetObject(const OSMetaClassBase *)withArraywithCapacitywithObjects