Up
Authors
- Richard Frith-Macdonald (
rfm@gnu.org
)
-
Copyright: (C) 2009 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSPointerArray.h
- Conforms to:
- NSCopying
- NSCoding
Availability: MacOS-X 10.5.0
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).
Method summary
+ (id)
pointerArrayWithOptions: (
NSPointerFunctionsOptions)options;
Availability: MacOS-X 10.5.0
Allocate an instance, initialise using
initWithOptions: and return it
autoreleased.
+ (id)
pointerArrayWithPointerFunctions: (
NSPointerFunctions*)functions;
Availability: MacOS-X 10.5.0
Allocate an instance, initialise using
initWithPointerFunctions: and
return it autoreleased.
+ (id)
strongObjectsPointerArray;
Availability: MacOS-X 10.5.0
Returns a new pointer array for storing strong
(retained) references to objects.
+ (id)
weakObjectsPointerArray;
Availability: MacOS-X 10.5.0
Returns a new pointer array for storing zeroing
weak references to objects.
- (void)
addPointer: (void*)pointer;
Availability: MacOS-X 10.5.0
Adds an item at the end of the array.
- (void)
compact;
Availability: MacOS-X 10.5.0
Removes all nil/zero items from the array.
- (
NSUInteger)
count;
Availability: MacOS-X 10.5.0
Returns the number of items in the array.
- (id)
initWithOptions: (
NSPointerFunctionsOptions)options;
Availability: MacOS-X 10.5.0
Initialises the receiver with the specified
options.
- (id)
initWithPointerFunctions: (
NSPointerFunctions*)functions;
Availability: MacOS-X 10.5.0
Initialises the receiver using the supplied
object.
- (void)
insertPointer: (void*)pointer
atIndex: (
NSUInteger)index;
Availability: MacOS-X 10.5.0
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.
- (void*)
pointerAtIndex: (
NSUInteger)index;
Availability: MacOS-X 10.5.0
Returns the item at the given index or
raises an exception if index is out of
range.
- (
NSPointerFunctions*)
pointerFunctions;
Availability: MacOS-X 10.5.0
Returns an autorelease NSPointerFunctions instance
giving the functions in use by the receiver.
- (void)
removePointerAtIndex: (
NSUInteger)index;
Availability: MacOS-X 10.5.0
Removes the item at the specified index,
adjusting the positions of all higher indexed
items.
- (void)
replacePointerAtIndex: (
NSUInteger)index
withPointer: (void*)item;
Availability: MacOS-X 10.5.0
Description forthcoming.
- (void)
setCount: (
NSUInteger)count;
Availability: MacOS-X 10.5.0
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.
- Declared in:
- Foundation/NSPointerArray.h
Availability: MacOS-X 10.5.0
Description forthcoming.
Method summary
+ (id)
pointerArrayWithStrongObjects;
Availability: MacOS-X 10.5.0
Creates an instance configured to hold objects and
prevent them from being garbage collected.
+ (id)
pointerArrayWithWeakObjects;
Availability: MacOS-X 10.5.0
Creates an instance configured to hold objects,
allowing them to be garbage collected and replaced
by nil
if/when they are collected.
- (
NSArray*)
allObjects;
Availability: MacOS-X 10.5.0
Returns an array containing all the non-nil objects
from the receiver.
Up