Class: NSMapTable

Inherits:
NSObject show all

Overview

NSMapTable is a mutable collection modeled after NSDictionary but provides different options.

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) mapTableWithKeyOptions(keyOptions, valueOptions:valueOptions)

Returns a new map table, initialized with the given options

Parameters:

  • keys (NSPointerFunctionsOptions)

    A bit field that specifies the options for the keys in the map table. For possible values, see “NSMapTableOptions”.

  • values (NSPointerFunctionsOptions)

    A bit field that specifies the options for the values in the map table. For possible values, see “NSMapTableOptions”.

Returns:

  • (Object)

    A new map table, initialized with the given options.

+ (Object) strongToStrongObjectsMapTable

Returns a new map table object which has strong references to the keys and values.

Returns:

  • (Object)

    A new map table object which has strong references to the keys and values.

+ (Object) strongToWeakObjectsMapTable

Returns a new map table object which has strong references to the keys and weak references to the values.

Returns:

  • (Object)

    A new map table object which has strong references to the keys and weak references to the values.

+ (Object) weakToStrongObjectsMapTable

Returns a new map table object which has weak references to the keys and strong references to the values.

Returns:

  • (Object)

    A new map table object which has weak references to the keys and strong references to the values.

+ (Object) weakToWeakObjectsMapTable

Returns a new map table object which has weak references to the keys and values.

Returns:

  • (Object)

    A new map table object which has weak references to the keys and values.

Instance Method Details

- (Integer) count

Returns the number of key-value pairs in the map table.

Returns:

  • (Integer)

    The number of key-value pairs in the map table.

- (Hash) dictionaryRepresentation

Returns a dictionary representation of the map table. The map table’s contents must be objects.

Returns:

  • (Hash)

    A dictionary representation of the map table.

- (Object) initWithKeyOptions(keys, valueOptions:values, capacity:capacity)

Returns a map table, initialized with the given options. values must contain entries at all the indexes specified in keys.

Parameters:

  • keys (NSPointerFunctionsOptions)

    A bit field that specifies the options for the keys in the map table. For possible values, see “NSMapTableOptions”.

  • values (NSPointerFunctionsOptions)

    A bit field that specifies the options for the values in the map table. For possible values, see “NSMapTableOptions”.

  • capacity (Integer)

    The initial capacity of the map table. This is just a hint; the map table may subsequently grow and shrink as required.

Returns:

  • (Object)

    A map table initialized using the given options.

- (Object) initWithKeyPointerFunctions(keyFunctions, valuePointerFunctions:valueFunctions, capacity:initialCapacity)

Returns a map table, initialized with the given functions.

Parameters:

  • keyFunctions (NSPointerFunctions)

    The functions the map table uses to manage keys.

  • valueFunctions (NSPointerFunctions)

    The functions the map table uses to manage values.

  • initialCapacity (Integer)

    The initial capacity of the map table. This is just a hint; the map table may subsequently grow and shrink as required.

Returns:

  • (Object)

    A map table, initialized with the given functions.

- (NSEnumerator) keyEnumerator

Returns an enumerator object that lets you access each key in the map table. The following code fragment illustrates how you might use the method.

Returns:

  • (NSEnumerator)

    An enumerator object that lets you access each key in the map table.

- (NSPointerFunctions) keyPointerFunctions

Returns the pointer functions the map table uses to manage keys.

Returns:

- (NSEnumerator) objectEnumerator

Returns an enumerator object that lets you access each value in the map table. The following code fragment illustrates how you might use the method.

Returns:

  • (NSEnumerator)

    An enumerator object that lets you access each value in the map table.

- (Object) objectForKey(aKey)

Returns a the value associated with a given key.

Parameters:

  • aKey (Object)

    The key for which to return the corresponding value.

Returns:

  • (Object)

    The value associated with aKey, or nil if no value is associated with aKey.

- (Object) removeAllObjects

Empties the map table of its entries.

Returns:

- (Object) removeObjectForKey(aKey)

Removes a given key and its associated value from the map table. Does nothing if aKey does not exist.

Parameters:

  • aKey (Object)

    The key to remove.

Returns:

- (Object) setObject(anObject, forKey:aKey)

Adds a given key-value pair to the map table.

Parameters:

  • anObject (Object)

    The value for aKey. This value must not be nil.

  • aKey (Object)

    The key for anObject. This value must not be nil.

Returns:

- (NSPointerFunctions) valuePointerFunctions

Returns the pointer functions the map table uses to manage values.

Returns: