This is NSDictionary.rtf in view mode; [Download] [Up]
paperh18648 margl-907 margr0 margt0 margb0 fi0 ri0 ql sb0 f1 fs24 Copyright f3 'e3f1 1994 by NeXT Computer, Inc. All Rights Reserved. s4 li100 fi0 ri1007 ql f0 b fs36 fs100 fs36 NSDictionary pard s11 li2872 fi-2771 ri1007 ql tx2872 f1 b0 fs28 fs48 fs28 f0 b fs24 Inherits From:tab b0 fs28 f1 NSObject fs20 fs28 s6 f0 b fs24 Conforms To:tab b0 fs28 f1 NSCoding, NSCopying, NSMutableCopying fi0 NSObject (NSObject) fs20 fs28 s7 fi-2771 f0 b fs24 Declared In:tab b0 fs28 f1 Foundation/NSDictionary.h fs20 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs28 fs20 fs28 Class Description fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 The NSDictionary class declares the programmatic interface to objects that manage immutable associations of keys and values. fs28 You use this class when you need a convenient and efficient way to retrieve data associated with an arbitrary key. fs16 fs28 fs28 A key-value pair within an NSDictionary is called an i entryi0 . Each entry consists of an string object that represents the key and another object (of any class) that is that key'27s value. You establish the entries when the NSDictionary is created, and thereafter the entries can'27t be modified. (The complementary class NSMutableDictionary defines objects that manage modifiable collections of entries. See the NSMutableDictionary class specification for more information.) fs16 fs28 Internally, an NSDictionary uses a hash table to organize its storage and to provide rapid access to a value given the corresponding key. However, the methods defined for this class insulate you from the complexities of working with hash tables, hashing functions, or the hashed value of keys. These methods take key values directly, not their hashed form. fs16 fs28 Generally, you instantiate an NSDictionary by sending one of the b dictionary...b0 messages to the class object. These methods return an NSDictionary containing the associations specified as arguments to the method. Each key argument is copied and the copy is added to the NSDictionary. Each corresponding value object receives a b retainb0 message to ensure that it won'27t be deallocated prematurely. fs16 fs28 NSDictionary'27s three primitive methods'd0b countb0 and b objectForKey:b0 and b keyEnumeratorb0 'd0provide the basis for all the other methods in its interface. The b countb0 method returns the number of entries in the object, b objectForKey: b0 returns the value associated with the given key, and b keyEnumeratorb0 returns an object that lets you step through entries in the dictionary. fs16 fs28 The other methods declared here operate by invoking one or more of these primitives. The non-primitive methods provide convenient ways of accessing multiple entries at once. The b description... b0 methods and the b writeToFile:atomically:b0 method cause an NSDictionary to generate a description of itself and store it in a string object or a file. fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Exceptions fs14 fs28 pard s1 li477 fi0 ri1007 ql tx2494 tx2872 tx3250 f1 b0 fs2 fs28 NSSet implements the encodeWithCoder: method, which raises NSInternalInconsistencyException if the number of objects enumerated for encoding turns out to be unequal to the number of objects in the set. fs16 fs28 pard s16 li100 fi0 ri1007 ql f0 b fs24 fs28 Creating and Initializing an NSDictionary fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 + (id)b allocWithZone:b0 (NSZone *)i zonei0 tab Creates and returns an uninitialized NSDictionary in i zonei0 . fi-6552 fs16 fs28 fi-6552 + (id)b dictionaryb0 tab Creates and returns an empty NSDictionary. fi-6552 fs16 fs28 fi-6552 + (id)b dictionaryWithContentsOfFile:b0 (NSString *)i pathi0 tab s9 li7030 fi-6553 fi-5796 tab Creates and returns an NSDictionary from the keys and values found in the file specified by i pathi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (id)b dictionaryWithObjects:b0 (NSArray *)i objectsi0 tab Creates and returns an NSDictionary that associates s9 li7030 fi-6553 fi-5796 b forKeys:b0 (NSArray *)i keysi0 tab tab objects from the i objectsi0 array with keys from the i keysi0 array. Keys must be strings. Raises NSInvalidArgumentException if the number of i objectsi0 is not equal to the number of i keysi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (id)b dictionaryWithObjects:b0 (id *)i objectsi0 tab Creates and returns an NSDictionary containing i counti0 s9 li7030 fi-6553 fi-5796 b forKeys:b0 (id *)i keysi0 tab tab objects from the i objectsi0 array. The objects are b count:b0 (unsigned int)i counti0 tab tab associated with i counti0 keys taken from the i keysi0 array. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 + (id)b dictionaryWithObjectsAndKeys:b0 (id)i firstObject, ... s9 li7030 fi-6553 fi-5796 i0 tab Creates and returns an NSDictionary that associates objects and keys from the argument list. The list must be in form: i object1i0 , i key1i0 , i object2i0 , i key2i0 , ..., b nilb0 . Raises NSInvalidArgumentException if any of the keys are nil, or if any of the keys are not of the NSString class. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithContentsOfFile:b0 (NSString *)i pathi0 tab Initializes a newly allocated NSDictionary using the keys and values found in i filenamei0 . fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithDictionary:b0 (NSDictionary *)i dictionary s9 li7030 fi-6553 fi-5796 i0 tab Initializes a newly allocated NSDictionary by placing in it the keys and values contained in i otherDictionaryi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithObjectsAndKeys:b0 (id)i firstObjecti0 ,...tab Initializes a newly allocated NSDictionary by placing in it the objects and keys from the argument list. The list must be in form: i object1i0 , i key1i0 , i object2i0 , i key2i0 , ..., b nilb0 . Raises NSInvalidArgumentException if any of the keys are nil, or if any of the keys are not of the NSString class. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (NSArray *)i objectsi0 tab Initializes a newly allocated NSDictionary by associating s9 li7030 fi-6553 fi-5796 b forKeys:b0 (NSArray *)i keysi0 tab tab objects from the i objectsi0 array with keys from the i keysi0 array. Keys must be strings. Raises NSInvalidArgumentException if the number of objects is not equal to the number of keys. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b initWithObjects:b0 (id *)i objectsi0 tab Initializes a newly allocated NSDictionary by associating s9 li7030 fi-6553 fi-5796 b forKeys:b0 (id *)i keysi0 tab tab i counti0 objects from the i objectsi0 array with an equal b count:b0 (unsigned)i counti0 tab tab number of keys from the i keysi0 array. Raises NSInvalidArgumentException if any of the i objectsi0 or i keysi0 are b nilb0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Accessing Keys and Values fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSArray *)b allKeysb0 tab Returns an NSArray containing the receiver'27s keys or an empty array if the receiver has no entries. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSArray *)b allKeysForObject:b0 (id)i objecti0 tab Finds all occurrences of the value i anObjecti0 in the receiver and returns an array with the corresponding keys.fs28 fi-6552 fs28 fs16 fs28 fi-6552 {f3 -} (NSArray *)b allValuesb0 tab Returns an NSArray containing the dictionary'27s values, or an empty array if the dictionary has no entries. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSEnumerator *)b keyEnumeratorb0 tab Returns an NSEnumerator that lets you access each of the receiver'27s keys. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSEnumerator *)b objectEnumeratorb0 tab Returns an NSEnumerator that lets you access each the receiver'27s values. fi-6552 fs16 fs28 fi-6552 {f3 -} (id)b objectForKey:b0 (id)i aKeyi0 tab Returns an entry'27s value given its key, or b nilb0 if no value is associated with i aKeyi0 . pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Counting Entries fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (unsigned)b countb0 tab Returns the number of entries in the receiver. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Comparing Dictionaries fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (BOOL)b isEqualToDictionary:b0 (NSDictionary *)i otheri0 tab s9 li7030 fi-6553 fi-5796 fs28 tab fs28 Compares the receiver to i otherDictionaryi0 . If the contents of i otherDictionaryi0 are equal to the contents of the receiver, this method returns YES. If not, it returns NO. pard s16 li100 fi0 ri1007 ql f0 b fs48 fs28 Storing Dictionaries fs14 fs28 pard s8 li7029 fi-6552 ri1007 ql tx6652 tx7030 f1 b0 fs2 fs28 fi-6552 {f3 -} (NSString *)b descriptionb0 tab Returns a string that represents the contents of the receiver. fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b descriptionInStringsFileFormatb0 tab Returns a string that represents the contents of the receiver. Key-value pairs are represented in a appropriate for use in 'aa.strings'ba files fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary s9 li7030 fi-6553 fi-5796 i0 tab Returns a string representation of the NSDictionary object. Included are the key and values that represent the locale data from i localeDictionaryi0 . s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (NSString *)b descriptionWithLocale:b0 (NSDictionary *)i localeDictionary s9 li7030 fi-6553 fi-5796 i0 b indent:b0 (unsigned int)i leveli0 tab Returns a string representation of the NSDictionary object. Included are the key and values that represent the locale data from i localeDictionaryi0 . Elements are indented from the left margin by i leveli0 + 1 multiples of four spaces, to make the output more readable. s8 li7029 fi-5794 fi-6552 fs16 fs28 fi-6552 {f3 -} (BOOL)b writeToFile:b0 (NSString *)i pathi0 tab Writes a textual description of the contents of the s9 li7030 fi-6553 fi-5796 b atomically:b0 (BOOL)i useAuxiliaryFilei0 tab tab receiver to i filenamei0 . Ifi useAuxiliaryFilei0 is YES, the data is written to a backup file and then, assuming no errors occur, the backup file is renamed to the intended file name. }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.