home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / 3.3Headers / eoaccess / EOKeyValueCoding.h < prev    next >
Encoding:
Text File  |  1994-11-14  |  3.1 KB  |  74 lines

  1. // EOKeyValueCoding.h
  2. // Copyright (c) 1994, NeXT Computer, Inc.  All rights reserved.
  3.  
  4. #import <foundation/NSArray.h>
  5. #import <foundation/NSData.h>
  6. #import <foundation/NSDictionary.h>
  7. #import <foundation/NSObject.h>
  8. #import <foundation/NSString.h>
  9.  
  10.  
  11. // The EOKeyValueCoding categories define methods to initialize an object with
  12. // values stored in a dictionary, and to extract values from an object for a
  13. // set of keys. These keys are usually the internal names of attributes or
  14. // relationships as defined in an EOModel, and are used in both the access
  15. // and interface layers.
  16.  
  17.  
  18. @interface Object (EOKeyValueCoding)
  19.  
  20. - (NSDictionary *)valuesForKeys:(NSArray *)keys;
  21.     // Returns a dictionary providing values for the keys.  The default
  22.     // implementation searches first for a selector with the same name as the
  23.     // key, and then for an instance variable with the same name as the key.
  24.  
  25. - (BOOL)takeValuesFromDictionary:(NSDictionary *)dictionary;
  26.     // Sets properties of the receiver with values from the dictionary.
  27.     // Returns YES if the receiver read all values from the dictionary, NO if
  28.     // it couldn't take all values.  The default implementation searches first
  29.     // for a selector named setKey: (where "Key" is replaced by the key in the
  30.     // dictionary), and then for an instance variable with the same name as
  31.     // the key.
  32.  
  33. @end
  34.  
  35.  
  36. // This category on NSObject defines the same functionality for objects
  37. // derived from NSObject.  In the case of an NSDictionary, this category
  38. // operates on the contents of the receiver, and not on the receiver's
  39. // instance variables.
  40.  
  41.  
  42. @interface NSObject (EOKeyValueCoding)
  43.  
  44. - (void)flushKeyBindings;
  45.     // Invalidates the cached key binding information for the receiver's
  46.     // class.  This method should be invoked whenever a class is modified or
  47.     // removed from the runtime system.
  48.  
  49. - (NSDictionary *)valuesForKeys:(NSArray *)keys;
  50.     // Returns a dictionary providing values for the keys.  The default
  51.     // implementation searches first for a selector with the same name as the
  52.     // key, and then for an instance variable with the same name as the key.
  53.  
  54. - (BOOL)takeValuesFromDictionary:(NSDictionary *)dictionary;
  55.     // Sets properties of the receiver with values from the dictionary.
  56.     // Returns YES if the receiver read all values from the dictionary, NO if
  57.     // it couldn't take all values.  The default implementation searches first
  58.     // for a selector named setKey: (where "Key" is replaced by the key in the
  59.     // dictionary), and then for an instance variable with the same name as
  60.     // the key.
  61.  
  62. @end
  63.  
  64. @interface NSObject (EOKeyValueCodingEONull)
  65. - (void)unableToSetNullForKey:(NSString *)key;
  66.     // Classes can implement this method to perscribe the behavior
  67.     // when EONull is assigned to a property in an EO that requires
  68.     // a C scalar type (such as int or float).  One possible implementation
  69.     // is to call takeValuesFromDictionary recursively with a special
  70.     // value object that will return the desired values to assign for
  71.     // the methods floatValue, intValue, unsignedIntValue, etc.
  72. @end
  73.  
  74.