[Previous] [Up] [Next]

NSDictionary

Authors

Richard Frith-Macdonald
Pierre-Yves Rivaille

Version: $Revision$

Date: $Date$

NSDictionary

NSDictionary

Declared in: Foundation/NSDictionary.h

Inherits from: NSObject

Conforms to: NSCoding, NSCopying, NSMutableCopying


Instance Variables

Methods


Class Methods

allocWithZone:

+ (id) allocWithZone: (NSZone*)zone;

dictionary

+ (id) dictionary;
Returns an empty dictionary.

dictionaryWithContentsOfFile:

+ (id) dictionaryWithContentsOfFile: (NSString*)path;
Returns a dictionary using the file located at path. The file must be a property list containing a dictionary as its root object.

dictionaryWithDictionary:

+ (id) dictionaryWithDictionary: (NSDictionary*)otherDictionary;
Returns a newly created dictionary with the keys and objects of otherDictionary. (The keys and objects are not copied.)

dictionaryWithObject:forKey:

+ (id) dictionaryWithObject: (id)anObject forKey: (id)aKey;
Returns a dictionary containing only one object (anObject) which is associated with aKey.

dictionaryWithObjects:forKey:

+ (id) dictionaryWithObjects: (NSArray*)objects forKey: (NSArray*)keys;
Returns a dictionary created using the given objects and keys. The two arrays must have the same size. The n th element of the objects array is associated with the n th element of the keys array.

dictionaryWithObjects:forKeys:count:

+ (id) dictionaryWithObjects: (id*)objects forKeys: (id*)keys count: (unsigned int)count;
Returns a dictionary created using the C arrays objects and keys. The number of elements in both C arrays must be count.

dictionaryWithObjectsAndKeys:

+ (id) dictionaryWithObjectsAndKeys: (id)object, ...;
Returns a dictionary created using the list given as argument. The list is alernately composed of objects and keys. Thus, the list's length must be pair.

Instances Methods

allKeys

- (NSArray*) allKeys;
Returns an array containing all the dictionary's keys.

allKeysForObject:

- (NSArray*) allKeysForObject: (id)anObject;
Returns an array containing all the dictionary's keys that are associated with anObject.

allValues

- (NSArray*) allValues;
Returns an array containing all the dictionary's objects.

count

- (unsigned int) count;
Returns an unsigned integer which is the number of elements stored in the dictionary.

descriptionInStringsFileFormat

- (NSString*) descriptionInStringsFileFormat;

descriptionWithLocale:

- (NSString*) descriptionWithLocale: (NSDictionary*)locale;

descriptionWithLocale:

- (NSString*) descriptionWithLocale: (NSDictionary*)locale;

fileGroupOwnerAccountName

- (NSString*) fileGroupOwnerAccountName;

fileModificationDate

- (NSDate*) fileModificationDate;

fileOwnerAccountName

- (NSString*) fileOwnerAccountName;

filePosixPermissions

- (unsigned long) filePosixPermissions;

fileSize

- (unsigned long long) fileSize;

fileSystemFileNumber

- (unsigned long) fileSystemFileNumber;

fileSystemNumber

- (unsigned long) fileSystemNumber;

fileType

- (NSString*) fileType;

initWithContentsOfFile:

- (id) initWithContentsOfFile: (NSString*)path;
see dictionaryWithContentOfFile:

initWithDictionary:

- (id) initWithDictionary: (NSDictionary*)otherDictionary;
See dictionaryWithDictionary:

initWithObjects:

- (id) initWithObjects: (NSArray*)objects;
See dictionaryWithObjects:

initWithObjects:forKeys:count:

- (id) initWithObjects: (id*)objects forKeys: (id*)keys count: (unsigned int)count;
see dictionaryWithObjects: forKeys: count:

initWithObjectsAndKeys:

- (id) initWithObjectsAndKeys: (id)object,;
see dictionaryWithObjectsAndKeys:

isEqualToDictionary:

- (BOOL) isEqualToDictionary: (NSDictionary*)otherDictionary;

keyEnumerator

- (NSEnumerator*) keyEnumerator;
Return an enumerator object containing all the keys of the dictionary.

keysSortedByValueUsingSelector:

- (NSArray*) keysSortedByValueUsingSelector: (SEL)comparator;

objectEnumerator

- (NSEnumerator*) objectEnumerator;
Return an enumerator object containing all the keys of the dictionary.

objectForKey:

- (id) objectForKey: (id)aKey;
Returns the first object which has aKey as key.

objectsForKeys:notFoundMarker:

- (NSArray*) objectsForKeys: (NSArray*)keys notFoundMarker: (id)anObject;

writeToFile:atomically:

- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)flag;

writeToURL:atomically:

- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)flag;