Samond Classes Library 1.2.1-RELEASE build 181
List of all members
SCDictionary Class Reference

Dictionary class. More...

#import <SCDictionary.h>

Inheritance diagram for SCDictionary:
SCCollection SCObject <SCMutableCollection> <SCCollection>

Creating Dictionaries

(instancetype) + dictionaryWithCoder:
 
(instancetype) + dictionaryWithContentsOfSerializedFile:
 
(instancetype) + dictionaryWithDataDictionary:
 
(instancetype) + dictionaryWithDataDictionaryFromFile:
 
(instancetype) + dictionaryWithStream:
 
(instancetype) + dictionaryWithFileStream:
 
(instancetype) + dictionaryWithName:
 
(instancetype) + dictionaryWithObject:forKey:
 
(instancetype) + dictionaryWithObject:
 
(instancetype) + dictionaryWithObjects:forKeys:
 
(instancetype) + dictionaryWithObjects:
 
(instancetype) + dictionaryWithObjectsAndKeys:
 
(instancetype) + dictionaryWithCollection:
 
(instancetype) + dictionaryWithDictionary:
 
(instancetype) + dictionary
 

Initializing Dictionaries

(instancetype) - initWithName:
 
(instancetype) - initWithObject:forKey:
 
(instancetype) - initWithObject:
 
(instancetype) - initWithObjects:forKeys:
 
(instancetype) - initWithObjects:
 
(instancetype) - initWithObjectsAndKeys:
 
(instancetype) - initWithCollection:
 
(instancetype) - initWithDictionary:
 
(instancetype) - init
 

Copying Dictionaries

(void) - setDictionary:
 

Comparing Dictionaries

(BOOL) - isEqualToDictionary:
 
(BOOL) - isEqualToContentsOfDictionary:
 

Adding and Changing Objects

(void) - setObject:forKey:
 
(void) - setObjects:forKeys:
 
(void) - setObjectsAndKeys:
 
(void) - setValue:forKey:
 
(void) - setValues:forKeys:
 
(void) - setValuesAndKeys:
 

Removing Objects

(void) - removeObjectForKey:
 
(void) - removeObjectsForKeys:
 

Querying a Dictionary

SCArrayallKeys
 
SCArrayallValues
 
(SCArray *) - allKeysForObject:
 
(id) - objectForKey:
 
(id) - valueForKey:
 

Finding Objects in a Dictionary

(BOOL) - containsObjectForKey:
 
(BOOL) - containsStringForKey:
 
(BOOL) - containsNumberForKey:
 
(BOOL) - containsAnyObjectForKeys:
 
(BOOL) - containsAllObjectsForKeys:
 

Objects Enumerators

NSEnumerator * keyEnumerator
 

Additional Inherited Members

- Instance Methods inherited from SCCollection
(void) - setCollection:
 
(void) - setObject:
 
(void) - setObjects:
 
(BOOL) - isEqualToCollection:
 
(BOOL) - isEqual:
 
(void) - enumerateWithDelegate:
 
(void) - enumerate
 
(void) - reverseEnumerateWithDelegate:
 
(void) - reverseEnumerate
 
(void) - addObjects:
 
(void) - addCollection:
 
(void) - removeObjectsWithClassName:
 
(void) - removeCollection:
 
(void) - removeObjects:
 
(BOOL) - containsObjects:
 
(BOOL) - containsCollection:
 
(BOOL) - containsAnyObject:
 
(BOOL) - containsAnyObjectFromCollection:
 
(BOOL) - isCollection
 
(BOOL) - isLibraryCollection
 
(BOOL) - isFoundationCollection
 
(BOOL) - isArray
 
(BOOL) - isLibraryArray
 
(BOOL) - isFoundationArray
 
(BOOL) - isSet
 
(BOOL) - isLibrarySet
 
(BOOL) - isFoundationSet
 
(BOOL) - isOrderedSet
 
(BOOL) - isLibraryOrderedSet
 
(BOOL) - isFoundationOrderedSet
 
(BOOL) - isFoundationDictionary
 
(BOOL) - isStack
 
(BOOL) - isQueue
 
(BOOL) - isList
 
(BOOL) - isSortable
 
- Instance Methods inherited from SCObject
(instancetype) - initWithContentsOfSerializedFile:
 
(BOOL) - writeContentsToSerializedFile:
 
(instancetype) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(instancetype) - initWithFileStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
- Instance Methods inherited from <SCMutableCollection>
- Instance Methods inherited from <SCCollection>
- Class Methods inherited from SCCollection
(BOOL) + isCollectionClass:
 
(BOOL) + isLibraryCollectionClass:
 
(BOOL) + isFoundationCollectionClass:
 
(BOOL) + isArrayClass:
 
(BOOL) + isLibraryArrayClass:
 
(BOOL) + isFoundationArrayClass:
 
(BOOL) + isSetClass:
 
(BOOL) + isLibrarySetClass:
 
(BOOL) + isFoundationSetClass:
 
(BOOL) + isOrderedSetClass:
 
(BOOL) + isLibraryOrderedSetClass:
 
(BOOL) + isFoundationOrderedSetClass:
 
(BOOL) + isDictionaryClass:
 
(BOOL) + isLibraryDictionaryClass:
 
(BOOL) + isFoundationDictionaryClass:
 
(BOOL) + isStackClass:
 
(BOOL) + isQueueClass:
 
(BOOL) + isListClass:
 
(BOOL) + isSortableClass:
 
(BOOL) + isCollection:
 
(BOOL) + isLibraryCollection:
 
(BOOL) + isFoundationCollection:
 
(BOOL) + isArray:
 
(BOOL) + isLibraryArray:
 
(BOOL) + isFoundationArray:
 
(BOOL) + isSet:
 
(BOOL) + isLibrarySet:
 
(BOOL) + isFoundationSet:
 
(BOOL) + isOrderedSet:
 
(BOOL) + isLibraryOrderedSet:
 
(BOOL) + isFoundationOrderedSet:
 
(BOOL) + isDictionary:
 
(BOOL) + isLibraryDictionary:
 
(BOOL) + isFoundationDictionary:
 
(BOOL) + isStack:
 
(BOOL) + isQueue:
 
(BOOL) + isList:
 
(BOOL) + isSortable:
 
- Properties inherited from SCCollection
NSString * name
 
BOOL readOnly
 
id< SCCollectionDelegatedelegate
 
SCIndex count
 
BOOL empty
 
NSString * typeName
 
NSString * description
 
NSEnumerator * objectEnumerator
 
NSEnumerator * reverseObjectEnumerator
 
- Properties inherited from <SCCollection>
NSString * name
 
SCIndex count
 
BOOL empty
 
NSString * description
 
SCArrayarray
 
SCSetset
 
SCOrderedSetorderedSet
 
SCDictionarydictionary
 
SCStackstack
 
SCQueuequeue
 
SCUnidirectionalListunidirectionalList
 
SCBidirectionalListbidirectionalList
 
NSArray * foundationArray
 
NSSet * foundationSet
 
NSOrderedSet * foundationOrderedSet
 
NSDictionary * foundationDictionary
 
NSEnumerator * objectEnumerator
 

Detailed Description

Dictionary class.

SDK
macOS 10.6+, iOS 7.0+, GNUstep
Since
version 1.1.3

Implements the collection which uses the keys for access to the objects. Class also supports the data trees.
Class instances can thrown the following exceptions:

Method Documentation

- (SCArray *) allKeysForObject: (id<SCCollectioning>)  object

Returns a new array containing the keys corresponding to all occurrences of a given object in the dictionary.

Parameters
object- the object to look for in the dictionary
Returns
A new array containing the keys corresponding to all occurrences of the specified object in the dictionary
- (BOOL) containsAllObjectsForKeys: (id<SCCollection>)  keys

Returns a boolean value that indicates whether an objects for all keys from the specified collection of any supported type are present in the receiving dictionary.

Parameters
keys- the collection with keys
Returns
YES if all objects are present in the dictionary, otherwise NO
- (BOOL) containsAnyObjectForKeys: (id<SCCollection>)  keys

Returns a boolean value that indicates whether an object for at least one key from the specified collection of any supported type is present in the receiving dictionary.

Parameters
keys- the collection with keys
Returns
YES if at least one object is present in the dictionary, otherwise NO
- (BOOL) containsNumberForKey: (NSString *)  key

Returns a boolean value that indicates whether a number for the given key is present in the receiving dictionary.

Parameters
key- the key for the desired number
Returns
YES if a number for the given key is present in the dictionary, otherwise NO
- (BOOL) containsObjectForKey: (NSString *)  key

Returns a boolean value that indicates whether an object for the given key is present in the receiving dictionary.

Parameters
key- the key for the desired object
Returns
YES if an object for the given key is present in the dictionary, otherwise NO
- (BOOL) containsStringForKey: (NSString *)  key

Returns a boolean value that indicates whether a string for the given key is present in the receiving dictionary.

Parameters
key- the key for the desired string
Returns
YES if a string for the given key is present in the dictionary, otherwise NO
+ (instancetype) dictionary

Creates and returns an unnamed empty dictionary.

Returns
A created dictionary

Reimplemented from SCCollection.

+ (instancetype) dictionaryWithCoder: (NSCoder *)  coder

Returns a dictionary created by using the specified coder.

Parameters
coder- the source coder
Returns
A created dictionary
+ (instancetype) dictionaryWithCollection: (id<SCCollection>)  collection

Returns a dictionary created by using the objects from the specified collection of any supported type.

Parameters
collection- the existing source collection
Returns
A created dictionary
Exceptions
SCCollectionException- collection error detected
+ (instancetype) dictionaryWithContentsOfSerializedFile: (NSString *)  path

Returns a dictionary created by using the content of the serialized file with the specified path.

Parameters
path- the path to the source serialized file
Returns
A created dictionary
+ (instancetype) dictionaryWithDataDictionary: (NSDictionary *)  dictionary

Returns a dictionary created by using the specified data dictionary.

Parameters
dictionary- the source data dictionary
Returns
A created dictionary
+ (instancetype) dictionaryWithDataDictionaryFromFile: (NSString *)  path

Returns a dictionary created by using the data dictionary from the specified file.

Parameters
path- the path to the source data dictionary file
Returns
A created dictionary
+ (instancetype) dictionaryWithDictionary: (SCDictionary *)  dictionary

Creates and returns a dictionary containing keys and objects from another given dictionary.

Parameters
dictionary- a dictionary containing the keys and values with which to initialize the new dictionary
Returns
A new dictionary containing the keys and values found in the specified dictionary
Exceptions
SCCollectionException- collection error detected
+ (instancetype) dictionaryWithFileStream: (NSString *)  path

Returns a dictionary created by using the data from the file stream with the specified path.

Parameters
path- the path of the source file stream
Returns
A created dictionary
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (instancetype) dictionaryWithName: (NSString *)  name

Returns an empty dictionary created by using the specified dictionary name.

Parameters
name- the dictionary name
Returns
A created dictionary
+ (instancetype) dictionaryWithObject: (id<SCCollectioning>)  object

Creates and returns a dictionary containing a given object with the automatic generated key.

Parameters
object- the object to adding into the dictionary
Returns
A new dictionary containing a single object
+ (instancetype) dictionaryWithObject: (id<SCCollectioning>)  object
forKey: (NSString *)  key 

Creates and returns a dictionary containing a given key and object.

Parameters
object- the object corresponding to the specified key
key- the key for the specified object
Returns
A new dictionary containing a single object for a single key
+ (SCDictionary *) dictionaryWithObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Creates and returns a dictionary containing objects from the specified nil terminated list and automatic generated keys.

Parameters
object- the first object to add to the new dictionary
...- other objects to add to the new dictionary
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
A new dictionary containing the specified objects
+ (instancetype) dictionaryWithObjects: (id<SCCollection>)  objects
forKeys: (id<SCCollection>)  keys 

Creates and returns a dictionary containing entries constructed from the contents of a collection of keys and a collection of objects.

Parameters
objects- a collection containing the objects for the new dictionary
keys- a collection containing the keys for the new dictionary
Returns
A new dictionary containing entries constructed from the contents of the specified collections
+ (instancetype) dictionaryWithObjectsAndKeys: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Creates and returns a dictionary containing entries constructed from the specified set of objects and keys.

Parameters
object- the first object to add to the new dictionary
...- first the key for the first object, then a null-terminated list of alternating objects and keys
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
A new dictionary
+ (instancetype) dictionaryWithStream: (SCStream *)  stream

Returns a dictionary created by using the data from the specified stream.

Parameters
stream- the source stream
Returns
A created dictionary
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (instancetype) init

Initializes an empty unnamed dictionary.

Returns
A newly initialized dictionary
- (instancetype) initWithCollection: (id<SCCollection>)  collection

Initializes a newly allocated dictionary with objects from the specified collection with automatic generated keys.

Parameters
collection- a collection with objects to add to the new dictionary
Returns
An initialized dictionary with the objects from a given collection
Exceptions
SCCollectionException- collection error detected

Reimplemented from SCCollection.

- (instancetype) initWithDictionary: (SCDictionary *)  dictionary

Initializes a newly allocated dictionary by placing in it the keys and objects contained in another given dictionary.

Attention
Designed initializer
Parameters
dictionary- a dictionary containing the keys and objects with which to initialize the new dictionary
Returns
An initialized dictionary containing the keys and objects found in the specified source dictionary
Exceptions
SCCollectionException- collection error detected
- (instancetype) initWithName: (NSString *)  name

Initializes an empty dictionary using the specified dictionary name.

Attention
Designed initializer
Parameters
name- the dictionary name
Returns
A newly initialized dictionary
- (instancetype) initWithObject: (id<SCCollectioning>)  object

Initializes a newly allocated dictionary containing a given object with the automatic generated key.

Parameters
object- the object to adding into the dictionary
Returns
An initialized dictionary containing a single object
- (instancetype) initWithObject: (id<SCCollectioning>)  object
forKey: (NSString *)  key 

Initializes a newly allocated dictionary containing a given key and object.

Parameters
object- the object corresponding to the specified key
key- the key for the specified object
Returns
An initialized dictionary containing a single object for a single key
- (instancetype) initWithObjects: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Initializes a newly allocated dictionary containing objects from the specified nil terminated list and automatic generated keys.

Parameters
object- the first object to add to the new dictionary
...- other objects to add to the new dictionary
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
An initialized dictionary containing the specified objects
- (instancetype) initWithObjects: (id<SCCollection>)  objects
forKeys: (id<SCCollection>)  keys 

Initializes a newly allocated dictionary containing entries constructed from the contents of a collection of keys and a collection of objects.

Parameters
objects- a collection containing the objects for the new dictionary
keys- a collection containing the keys for the new dictionary
Returns
An initialized dictionary containing entries constructed from the contents of the specified collections
- (instancetype) initWithObjectsAndKeys: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Initializes a newly allocated dictionary with entries constructed from the specified set of objects and keys.

Parameters
object- the first object to add to the new dictionary
...- first key for the first object, then a null-terminated list of alternating objects and keys
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Returns
An initialized dictionary
- (BOOL) isEqualToContentsOfDictionary: (SCDictionary *)  dictionary

Returns a boolean value that indicates whether the contents of the receiving dictionary are equal to the contents of another given dictionary.

Parameters
dictionary- the dictionary with which to compare the receiving dictionary
Returns
YES if the contents of the specified dictionary are equal to the contents of the receiving dictionary, otherwise NO
- (BOOL) isEqualToDictionary: (SCDictionary *)  dictionary

Returns a boolean value that indicates whether the settings and contents of the receiving dictionary are equal to the settings and content of another given dictionary.

Parameters
dictionary- the dictionary with which to compare the receiving dictionary
Returns
YES if the settings and contents of the specified dictionary are equal to the settings and contents of the receiving dictionary, otherwise NO
- (id) objectForKey: (NSString *)  key

Returns the object associated with a given key.

Parameters
key- the key for which to return the corresponding object
Returns
The object associated with the specified key or nil if no object is associated with the key
See also
- valueForKey:
- (void) removeObjectForKey: (NSString *)  key

Removes a given key and its associated object from the receiving dictionary.

Parameters
key- the key to remove
Exceptions
SCCollectionException- collection error detected
- (void) removeObjectsForKeys: (SCArray *)  keys

Removes from the receiving dictionary entries specified specified by elements in a given array.

Parameters
keys- an array of objects specifying the keys to remove
Exceptions
SCCollectionException- collection error detected
- (void) setDictionary: (SCDictionary *)  dictionary

Sets the settings and contents of the receiving dictionary to settings and entries in a given dictionary.

Parameters
dictionary- the source dictionary
Exceptions
SCCollectionException- collection error detected
- (void) setObject: (id<SCCollectioning>)  object
forKey: (NSString *)  key 

Adds a given key-object pair to the dictionary.

Parameters
object- the object for the specified key
key- the key for the specified object
Exceptions
SCCollectionException- collection error detected
See also
- setValue:forKey:
- (void) setObjects: (id<SCCollection>)  objects
forKeys: (id<SCCollection>)  keys 

Adds a key-object pairs from the specified collection of the objects and a given collection of the keys.

Parameters
objects- the collection of the objects
keys- the collection of the keys
Exceptions
SCCollectionException- collection error detected
- (void) setObjectsAndKeys: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Adds into the receiving dictionary entries cotsructed from the specified set of objects and keys.

Parameters
object- the first object to add to the dictionary
...- first the key for the first object, then a null-terminated list of alternating objects and keys
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Exceptions
SCCollectionException- collection error detected
- (void) setValue: (id<SCCollectioning>)  value
forKey: (NSString *)  key 

Adds a given key-value pair to the dictionary.

Parameters
value- the value for the specified key
key- the key for the specified value
Exceptions
SCCollectionException- collection error detected
See also
- setObject:forKey:
- (void) setValues: (id<SCCollection>)  values
forKeys: (id<SCCollection>)  keys 

Adds a key-value pairs from the specified collection of the values and a given collection of the keys.

Parameters
values- the collection of the values
keys- the collection of the keys
Exceptions
SCCollectionException- collection error detected
- (void) setValuesAndKeys: (id<SCCollectioning>)  object
,   NS_REQUIRES_NIL_TERMINATION 

Adds into the receiving dictionary entries cotsructed from the specified set of values and keys.

Parameters
object- the first value to add to the dictionary
...- first the key for the first value, then a null-terminated list of alternating values and keys
NS_REQUIRES_NIL_TERMINATION- the mandatory nil pointer
Exceptions
SCCollectionException- collection error detected
- (id) valueForKey: (NSString *)  key

Returns the value associated with a given key.

Parameters
key- the key for which to return the corresponding value
Returns
The value associated with a given key or nil if no value is associated with the key
See also
- objectForKey:

Property Documentation

- (SCArray *) allKeys
readnonatomicretain

An array containing the all keys in the dictionary, or an empty array if the dictionary has no entries

- (SCArray *) allValues
readnonatomicretain

An array containing the all values in the dictionary, or an empty array if the dictionary has no entries

- (NSEnumerator *) keyEnumerator
readnonatomicretain

An enumerator object that lets you access each key in the dictionary


The documentation for this class was generated from the following files: