Class: NSPointerArray
Overview
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.
Class Method Summary (collapse)
-
+ pointerArrayWithOptions:
Returns a new pointer array initialized to use the given options.
-
+ pointerArrayWithPointerFunctions:
A new pointer array initialized to use the given functions.
-
+ strongObjectsPointerArray
Returns a new pointer array that maintains strong references to its elements.
-
+ weakObjectsPointerArray
Returns a new pointer array that maintains weak references to its elements.
Instance Method Summary (collapse)
-
- addPointer:
Adds a given pointer to the receiver.
-
- allObjects
Returns an array containing all the objects in the receiver.
-
- compact
Removes NULL values from the receiver.
-
- count
Returns the number of elements in the receiver.
-
- initWithOptions:
Initializes the receiver to use the given options.
-
- initWithPointerFunctions:
Initializes the receiver to use the given functions.
-
- insertPointer:atIndex:
Inserts a pointer at a given index.
-
- pointerAtIndex:
Returns the pointer at a given index.
-
- pointerFunctions
Returns a new NSPointerFunctions object reflecting the functions in use by the receiver.
-
- removePointerAtIndex:
Removes the pointer at a given index.
-
- replacePointerAtIndex:withPointer:
Replaces the pointer at a given index.
-
- setCount:
Sets the count for the receiver.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (Object) pointerArrayWithOptions(options)
Returns a new pointer array initialized to use the given options.
+ (Object) pointerArrayWithPointerFunctions(functions)
A new pointer array initialized to use the given functions.
+ (Object) strongObjectsPointerArray
Returns a new pointer array that maintains strong references to its elements.
+ (Object) weakObjectsPointerArray
Returns a new pointer array that maintains weak references to its elements.
Instance Method Details
- (Object) addPointer(pointer)
Adds a given pointer to the receiver. pointer is added at index count.
- (Array) allObjects
Returns an array containing all the objects in the receiver.
- (Object) compact
Removes NULL values from the receiver.
- (Integer) count
Returns the number of elements in the receiver.
- (Object) initWithOptions(options)
Initializes the receiver to use the given options.
- (Object) initWithPointerFunctions(functions)
Initializes the receiver to use the given functions.
- (Object) insertPointer(item, atIndex:index)
Inserts a pointer at a given index. Elements at and above index, including NULL values, slide higher.
- (Object) pointerAtIndex(index)
Returns the pointer at a given index. The returned value may be NULL.
- (NSPointerFunctions) pointerFunctions
Returns 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.
- (Object) removePointerAtIndex(index)
Removes the pointer at a given index. Elements above index, including NULL values, slide lower.
- (Object) replacePointerAtIndex(index, withPointer:item)
Replaces the pointer at a given index.
- (Object) setCount(count)
Sets 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.