ObjFW
Public Member Functions | Static Public Member Functions
OFDictionary Class Reference

An abstract class for storing objects in a dictionary. More...

#import <OFDictionary.h>

Inheritance diagram for OFDictionary:
OFObject <OFCopying> <OFMutableCopying> <OFCollection> <OFSerialization> <OFJSON> <OFObject> <OFEnumerating> <OFFastEnumeration> OFMutableDictionary

List of all members.

Public Member Functions

(id) - init
 Initializes an already allocated OFDictionary.
(id) - initWithDictionary:
 Initializes an already allocated OFDictionary with the specified OFDictionary.
(id) - initWithObject:forKey:
 Initializes an already allocated OFDictionary with the specified key and object.
(id) - initWithObjects:forKeys:
 Initializes an already allocated OFDictionary with the specified keys and objects.
(id) - initWithKeysAndObjects:
 Initializes an already allocated OFDictionary with the specified keys and objects.
(id) - initWithKey:arguments:
 Initializes an already allocated OFDictionary with the specified key and va_list.
(id) - objectForKey:
 Returns the object for the given key or nil if the key was not found.
(BOOL) - containsObjectIdenticalTo:
 Checks whether the dictionary contains an object with the specified address.
(OFArray *) - allKeys
 Returns an array of all keys.
(OFArray *) - allObjects
 Returns an array of all objects.
(OFEnumerator *) - keyEnumerator
 Returns an OFEnumerator to enumerate through the dictionary's keys.
(void) - enumerateKeysAndObjectsUsingBlock:
 Executes a block for each key / object pair.
(OFDictionary *) - mappedDictionaryUsingBlock:
 Creates a new dictionary, mapping each object using the specified block.
(OFDictionary *) - filteredDictionaryUsingBlock:
 Creates a new dictionary, only containing the objects for which the block returns YES.

Static Public Member Functions

(id) + dictionary
 Creates a new OFDictionary.
(id) + dictionaryWithDictionary:
 Creates a new OFDictionary with the specified dictionary.
(id) + dictionaryWithObject:forKey:
 Creates a new OFDictionary with the specified key and object.
(id) + dictionaryWithObjects:forKeys:
 Creates a new OFDictionary with the specified keys and objects.
(id) + dictionaryWithKeysAndObjects:
 Creates a new OFDictionary with the specified keys objects.

Detailed Description

An abstract class for storing objects in a dictionary.

Keys are copied and thus must conform to the OFCopying protocol.

Note: Fast enumeration on a dictionary enumerates through the keys of the dictionary.


Member Function Documentation

- (OFArray *) allKeys

Returns an array of all keys.

Returns:
An array of all keys
- (OFArray *) allObjects

Returns an array of all objects.

Returns:
An array of all objects
- (BOOL) containsObjectIdenticalTo: (id)  object

Checks whether the dictionary contains an object with the specified address.

Parameters:
objectThe object which is checked for being in the dictionary
Returns:
A boolean whether the dictionary contains an object with the specified address.
+ (id) dictionary

Creates a new OFDictionary.

Returns:
A new autoreleased OFDictionary
+ (id) dictionaryWithDictionary: (OFDictionary*)  dictionary

Creates a new OFDictionary with the specified dictionary.

Parameters:
dictionaryAn OFDictionary
Returns:
A new autoreleased OFDictionary
+ (id) dictionaryWithKeysAndObjects: (id)  firstKey
,   ... 

Creates a new OFDictionary with the specified keys objects.

Parameters:
firstKeyThe first key
Returns:
A new autoreleased OFDictionary
+ (id) dictionaryWithObject: (id)  object
forKey: (id)  key 

Creates a new OFDictionary with the specified key and object.

Parameters:
keyThe key
objectThe object
Returns:
A new autoreleased OFDictionary
+ (id) dictionaryWithObjects: (OFArray*)  objects
forKeys: (OFArray*)  keys 

Creates a new OFDictionary with the specified keys and objects.

Parameters:
keysAn array of keys
objectsAn array of objects
Returns:
A new autoreleased OFDictionary
- (void) enumerateKeysAndObjectsUsingBlock: (of_dictionary_enumeration_block_t)  block

Executes a block for each key / object pair.

Parameters:
blockThe block to execute for each key / object pair.
- (OFDictionary *) filteredDictionaryUsingBlock: (of_dictionary_filter_block_t)  block

Creates a new dictionary, only containing the objects for which the block returns YES.

Parameters:
blockA block which determines if the object should be in the new dictionary
Returns:
A new, autoreleased OFDictionary
- (id) init

Initializes an already allocated OFDictionary.

Returns:
An initialized OFDictionary

Reimplemented from OFObject.

- (id) initWithDictionary: (OFDictionary*)  dictionary

Initializes an already allocated OFDictionary with the specified OFDictionary.

Parameters:
dictionaryAn OFDictionary
Returns:
An initialized OFDictionary
- (id) initWithKey: (id)  firstKey
arguments: (va_list)  arguments 

Initializes an already allocated OFDictionary with the specified key and va_list.

Parameters:
firstKeyThe first key
argumentsA va_list of the other arguments
Returns:
A new initialized OFDictionary
- (id) initWithKeysAndObjects: (id)  firstKey
,   ... 

Initializes an already allocated OFDictionary with the specified keys and objects.

Parameters:
firstKeyThe first key
Returns:
A new initialized OFDictionary
- (id) initWithObject: (id)  object
forKey: (id)  key 

Initializes an already allocated OFDictionary with the specified key and object.

Parameters:
keyThe key
objectThe object
Returns:
A new initialized OFDictionary
- (id) initWithObjects: (OFArray*)  objects
forKeys: (OFArray*)  keys 

Initializes an already allocated OFDictionary with the specified keys and objects.

Parameters:
keysAn array of keys
objectsAn array of objects
Returns:
A new initialized OFDictionary
- (OFEnumerator *) keyEnumerator

Returns an OFEnumerator to enumerate through the dictionary's keys.

Returns:
An OFEnumerator to enumerate through the dictionary's keys
- (OFDictionary *) mappedDictionaryUsingBlock: (of_dictionary_map_block_t)  block

Creates a new dictionary, mapping each object using the specified block.

Parameters:
blockA block which maps an object for each object
Returns:
A new, autorelease OFDictionary
- (id) objectForKey: (id)  key

Returns the object for the given key or nil if the key was not found.

The returned object is not retained and autoreleased for performance reasons!

Parameters:
keyThe key whose object should be returned
Returns:
The object for the given key or nil if the key was not found

The documentation for this class was generated from the following files:
 All Classes Functions Variables Properties