# NSPointerArray class documentation

rfm@gnu.org
2009 Free Software Foundation, Inc.
Software documentation for the NSPointerArray class
Foundation/NSPointerArray.h
NSCopying
NSCoding
An NSPointerArray acts like a standard mutable array except that it can contain `nil` and even non-object values.
The count can also be set causing the array to shrink (discarding items) or grow (adding nil/zero items).
pointerArrayWithOptions:
options
Allocate an instance, initialise using initWithOptions: and return it autoreleased.
pointerArrayWithPointerFunctions:
functions
Allocate an instance, initialise using initWithPointerFunctions: and return it autoreleased.
addPointer:
pointer
Adds an item at the end of the array.
compact
Removes all nil/zero items from the array.
count
Returns the number of items in the array.
initWithOptions:
options
Initialises the receiver with the specified options.
initWithPointerFunctions:
functions
Initialises the receiver using the supplied object.
insertPointer:
pointer
atIndex:
index
Inserts an item at the specified index causing all higher indexed items to be adjusted upwards.
WARNING... the Apple documented (and implemented in MacOS-X 10.5) behavior is to raise an exception if index is the same as the count of items in the array. This is insane... for arrays, data and strings you can insert at the end of an object to append to it, so the behavior of this class in MacOS is inconsistent and must be considered buggy.
pointerAtIndex:
index
Returns the item at the given index or raises an exception if index is out of range.
pointerFunctions
Returns an autorelease NSPointerFunctions instance giving the functions in use by the receiver.
removePointerAtIndex:
index
Removes the item at the specified index, adjusting the positions of all higher indexed items.
replacePointerAtIndex:
index
withPointer:
item
Description forthcoming.
setCount:
count
Sets the number of items in the receiver. Adds nil/zero items to pad the end of the array, or removes extraneous items from the end.
Software documentation for the NSPointerArray(NSArrayConveniences) category
Foundation/NSPointerArray.h
Description forthcoming.
pointerArrayWithStrongObjects
Creates an instance configured to hold objects and prevent them from being garbage collected.
pointerArrayWithWeakObjects
Creates an instance configured to hold objects, allowing them to be garbage collected and replaced by `nil` if/when they are collected.
allObjects
Returns an array containing all the non-nil objects from the receiver.