Class: NSPointerArray

Inherits:
NSObject show all

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)

Instance Method Summary (collapse)

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.

Parameters:

  • options (NSPointerFunctionsOptions)

    The pointer functions options for the new instance.

Returns:

  • (Object)

    A new pointer array initialized to use the given options.

+ (Object) pointerArrayWithPointerFunctions(functions)

A new pointer array initialized to use the given functions.

Parameters:

Returns:

  • (Object)

    A new pointer array initialized to use the given pointer functions.

+ (Object) strongObjectsPointerArray

Returns a new pointer array that maintains strong references to its elements.

Returns:

  • (Object)

    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.

Returns:

  • (Object)

    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.

Parameters:

  • pointer (Object)

    The pointer to add. This value may be NULL.

Returns:

- (Array) allObjects

Returns an array containing all the objects in the receiver.

Returns:

  • (Array)

    An array containing all the objects in the receiver.

- (Object) compact

Removes NULL values from the receiver.

Returns:

- (Integer) count

Returns the number of elements in the receiver.

Returns:

  • (Integer)

    The number of elements in the receiver.

- (Object) initWithOptions(options)

Initializes the receiver to use the given options.

Parameters:

  • options (NSPointerFunctionsOptions)

    The pointer functions options for the new instance.

Returns:

  • (Object)

    The receiver, initialized to use the given options.

- (Object) initWithPointerFunctions(functions)

Initializes the receiver to use the given functions.

Parameters:

Returns:

  • (Object)

    The receiver, initialized 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.

Parameters:

  • item (Object)

    The pointer to add.

  • index (Integer)

    The index of an element in the receiver. This value must be less than the count of the receiver.

Returns:

- (Object) pointerAtIndex(index)

Returns the pointer at a given index. The returned value may be NULL.

Parameters:

  • index (Integer)

    The index of an element in the receiver. This value must be less than the count of the receiver.

Returns:

  • (Object)

    The pointer at index.

- (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.

Returns:

- (Object) removePointerAtIndex(index)

Removes the pointer at a given index. Elements above index, including NULL values, slide lower.

Parameters:

  • index (Integer)

    The index of an element in the receiver. This value must be less than the count of the receiver.

Returns:

- (Object) replacePointerAtIndex(index, withPointer:item)

Replaces the pointer at a given index.

Parameters:

  • index (Integer)

    The index of an element in the receiver. This value must be less than the count of the receiver.

  • item (Object)

    The item with which to replace the element at index. This value may be NULL.

Returns:

- (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.

Parameters:

  • count (Integer)

    The count for the receiver.

Returns: