home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / NEXTIME.framework / Versions / A / Headers / NTValueDictionary.h < prev    next >
Encoding:
Text File  |  1995-08-30  |  2.4 KB  |  66 lines

  1. /*
  2.  *  NTValueDictionary.h
  3.  *     Copyright 1994, NeXT Computer, Inc.
  4.  *    
  5.  *    Extensions on NSDictionary and NSMutableDictionary to support
  6.  *    keyed storage of values.  Since we do these operations in hundreds
  7.  *    of places in NEXTIME, the code is implemented once, as a category
  8.  *    on NSDictionary and NSMutableDictionary.
  9.  *
  10.  *    10 Jan 1994 mpaque Created.
  11.  *    07 Oct 1994 mpaque Ported to Foundation
  12.  */
  13. #import <Foundation/NSDictionary.h>
  14.  
  15. @interface NSDictionary(NEXTIME_Extensions)
  16. // Comparisons
  17. - (BOOL)isKeyKnown:(id)key;    // Returns YES if key exists in dict.
  18.  
  19. - (BOOL)isSubset:other;
  20.     /* Checks if other isKindOf NTValueDictionary;
  21.     If conforming, each item in messaged dictionary is compared */
  22.  
  23. // Queries for value by key
  24. - (const char *)cStringForKey:(id)key;
  25.     /* Returns a C string owned by the dictionary, or NULL if the 
  26.        key is not found or the object does not have a string representation */
  27.        
  28. - (NSString *)stringForKey:(id)key;
  29.     /* Returns a NSString owned by the dictionary, or nil if the 
  30.        key is not found or the object is not an NSString kind. */
  31.        
  32. - (BOOL)boolForKey:(id)key;
  33.     /*    Returns boolean value, or NO if key is not found or object does
  34.         not have a boolean or numeric representation. */
  35.  
  36. - (int)integerForKey:(id)key;
  37.     /*    Returns integer value, or 0 if key is not found or object does
  38.         not have a numeric representation. */
  39.     
  40. - (float)floatForKey:(id)key;
  41. - (double)doubleForKey:(id)key;
  42.     /*    Returns floating point value, or 0.0 (NaN?) if key is not
  43.         found or object does not have a numeric representation. */
  44.  
  45. // Variations which raise an exception if the key is not found or
  46. // the object cannot produce the desired value type.
  47. - (id)requiredObjectForKey:(id)key;
  48. - (const char *)requiredCStringForKey:(id)key;       
  49. - (NSString *)requiredStringForKey:(id)key;       
  50. - (BOOL)requiredBoolForKey:(id)key;
  51. - (int)requiredIntForKey:(id)key;
  52. - (float)requiredFloatForKey:(id)key;
  53. - (double)requiredDoubleForKey:(id)key;
  54. @end
  55.  
  56. @interface NSMutableDictionary(NEXTIME_Extensions)
  57. // Setting a keyed value.  The key and value are always retained or copied
  58. // Data for old keys are dereferenced.
  59. - (void)setCString:(const char *)value forKey:(id)key;
  60. - (void)setString:(NSString *)value forKey:(id)key;
  61. - (void)setBool:(BOOL)value forKey:(id)key;
  62. - (void)setInteger:(int)value forKey:(id)key;
  63. - (void)setFloat:(float)value forKey:(id)key;
  64. - (void)setDouble:(double)value forKey:(id)key;
  65. @end
  66.