| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/Foundation.framework |
| Declared in | NSPointerArray.h |
| Companion guides | |
| Availability | Available in Mac OS X v10.5 and later. |
NSPointerArray is a mutable collection modeled after NSArray but it can also hold NULL values, which can be inserted or extracted (and which contribute to the object’s count). Moreover, unlike traditional arrays, you can set the count of the array directly. In a garbage collected environment, if you specify a zeroing weak memory configuration, if an element is collected it is replaced by a NULL value.
The copying and archiving protocols are applicable only when a pointer array is configured for object uses.
The fast fast enumeration protocol (that is, use a pointer array in the for...in language construct—see Fast Enumeration in The Objective-C 2.0 Programming Language) will yield NULL values that are present in the array. It is defined for all types of pointers although the language syntax doesn’t directly support this.
– initWithOptions:
– initWithPointerFunctions:
+ pointerArrayWithOptions:
+ pointerArrayWithPointerFunctions:
+ pointerArrayWithStrongObjects
+ pointerArrayWithWeakObjects
– count
– setCount:
– allObjects
– pointerAtIndex:
– addPointer:
– removePointerAtIndex:
– insertPointer:atIndex:
– replacePointerAtIndex:withPointer:
– compact
Returns a new pointer array initialized to use the given options.
+ (id)pointerArrayWithOptions:(NSPointerFunctionsOptions)options
The pointer functions options for the new instance.
A new pointer array initialized to use the given options.
NSPointerArray.hA new pointer array initialized to use the given functions.
+ (id)pointerArrayWithPointerFunctions:(NSPointerFunctions *)functions
The pointer functions for the new instance.
A new pointer array initialized to use the given pointer functions.
NSPointerArray.hReturns a new pointer array that maintains strong references to its elements.
+ (id)pointerArrayWithStrongObjects
A new pointer array that maintains strong references to its elements.
NSPointerArray.hReturns a new pointer array that maintains weak references to its elements.
+ (id)pointerArrayWithWeakObjects
A new pointer array that maintains weak references to its elements.
NSPointerArray.hAdds a given pointer to the receiver.
- (void)addPointer:(void *)pointer
The pointer to add. This value may be NULL.
pointer is added at index count.
NSPointerArray.hReturns an array containing all the objects in the receiver.
- (NSArray *)allObjects
An array containing all the object in the receiver.
NSPointerArray.hRemoves NULL values from the receiver.
- (void)compact
NSPointerArray.hReturns the number of elements in the receiver.
- (NSUInteger)count
The number of elements in the receiver.
NSPointerArray.hInitializes the receiver to use the given options.
- (id)initWithOptions:(NSPointerFunctionsOptions)options
The pointer functions options for the new instance.
The receiver, initialized to use the given options.
NSPointerArray.hInitializes the receiver to use the given functions.
- (id)initWithPointerFunctions:(NSPointerFunctions *)functions
The pointer functions for the new instance.
The receiver, initialized to use the given functions.
NSPointerArray.hInserts a pointer at a given index.
- (void)insertPointer:(void *)item atIndex:(NSUInteger)index
The pointer to add.
The index of an element in the receiver. This value must be less than the count of the receiver.
Elements at and above index, including NULL values, slide higher.
NSPointerArray.hReturns the pointer at a given index.
- (void *)pointerAtIndex:(NSUInteger)index
The index of an element in the receiver. This value must be less than the count of the receiver.
The pointer at index.
The returned value may be NULL.
NSPointerArray.hReturns a new NSPointerFunctions object reflecting the functions in use by the receiver.
- (NSPointerFunctions *)pointerFunctions
A new NSPointerFunctions object reflecting the functions in use by the receiver.
The returned object is a new NSPointerFunctions object that you can modify and/or use directly to create other pointer collections.
NSPointerArray.hRemoves the pointer at a given index.
- (void)removePointerAtIndex:(NSUInteger)index
The index of an element in the receiver. This value must be less than the count of the receiver.
Elements above index, including NULL values, slide lower.
NSPointerArray.hReplaces the pointer at a given index.
- (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item
The index of an element in the receiver. This value must be less than the count of the receiver.
The item with which to replace the element at index. This value may be NULL.
NSPointerArray.hSets the count for the receiver.
- (void)setCount:(NSUInteger)count
The count for the receiver.
If count is greater than the count of the receiver, NULL values are added; if count is less than the count of the receiver, then elements at indexes count and greater are removed from the receiver.
NSPointerArray.h
© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-03-04)