home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSDictionary.h < prev    next >
Encoding:
Text File  |  1996-09-11  |  2.5 KB  |  85 lines

  1. /*    NSDictionary.h
  2.     Hashed collection mapping object keys to object values
  3.     Copyright 1994-1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #import <Foundation/NSObject.h>
  7.  
  8. @class NSArray, NSEnumerator, NSString;
  9.  
  10. /****************    Immutable Dictionary    ****************/
  11.  
  12. @interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSCoding>
  13.  
  14. - (unsigned)count;
  15. - (NSEnumerator *)keyEnumerator;
  16. - (id)objectForKey:(id)aKey;
  17.  
  18. @end
  19.  
  20. @interface NSDictionary (NSExtendedDictionary)
  21.  
  22. - (NSArray *)allKeys;
  23. - (NSArray *)allKeysForObject:(id)anObject;    
  24. - (NSArray *)allValues;
  25. - (NSString *)description;
  26. - (NSString *)descriptionInStringsFileFormat;
  27. - (NSString *)descriptionWithLocale:(NSDictionary *)locale;
  28. - (NSString *)descriptionWithLocale:(NSDictionary *)locale indent:(unsigned)level;
  29. - (BOOL)isEqualToDictionary:(NSDictionary *)otherDictionary;
  30. - (NSEnumerator *)objectEnumerator;
  31. - (NSArray *)objectsForKeys:(NSArray *)keys notFoundMarker:(id)marker;
  32. - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile;
  33.  
  34. #if !defined(STRICT_OPENSTEP)
  35. - (NSArray *)keysSortedByValueUsingSelector:(SEL)comparator;
  36. #endif /* !STRICT_OPENSTEP */
  37.  
  38. @end
  39.  
  40. @interface NSDictionary (NSDictionaryCreation)
  41.  
  42. + (id)dictionary;
  43. + (id)dictionaryWithContentsOfFile:(NSString *)path;
  44. + (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
  45. + (id)dictionaryWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count;
  46. + (id)dictionaryWithObjectsAndKeys:(id)firstObject, ...;
  47. - (id)initWithContentsOfFile:(NSString *)path;
  48. - (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys;
  49. - (id)initWithObjects:(id *)objects forKeys:(id *)keys count:(unsigned)count;
  50. - (id)initWithObjectsAndKeys:(id)firstObject, ...;
  51. - (id)initWithDictionary:(NSDictionary *)otherDictionary;
  52.  
  53. #if !defined(STRICT_OPENSTEP)
  54. + (id)dictionaryWithDictionary:(NSDictionary *)dict;
  55. + (id)dictionaryWithObject:(id)object forKey:(id)key;
  56. #endif /* !STRICT_OPENSTEP */
  57.  
  58. @end
  59.  
  60. /****************    Mutable Dictionary    ****************/
  61.  
  62. @interface NSMutableDictionary : NSDictionary
  63.  
  64. - (void)removeObjectForKey:(id)aKey;
  65. - (void)setObject:(id)anObject forKey:(id)aKey;
  66.  
  67. @end
  68.  
  69. @interface NSMutableDictionary (NSExtendedMutableDictionary)
  70.  
  71. - (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary;
  72. - (void)removeAllObjects;
  73. - (void)removeObjectsForKeys:(NSArray *)keyArray;
  74. - (void)setDictionary:(NSDictionary *)otherDictionary;
  75.  
  76. @end
  77.  
  78. @interface NSMutableDictionary (NSMutableDictionaryCreation)
  79.  
  80. + (id)dictionaryWithCapacity:(unsigned)numItems;
  81. - (id)initWithCapacity:(unsigned)numItems;
  82.  
  83. @end
  84.  
  85.