home *** CD-ROM | disk | FTP | other *** search
- // EOKeyValueCoding.h
- // Copyright (c) 1994, NeXT Computer, Inc. All rights reserved.
-
- #import <foundation/NSArray.h>
- #import <foundation/NSData.h>
- #import <foundation/NSDictionary.h>
- #import <foundation/NSObject.h>
- #import <foundation/NSString.h>
-
-
- // The EOKeyValueCoding categories define methods to initialize an object with
- // values stored in a dictionary, and to extract values from an object for a
- // set of keys. These keys are usually the internal names of attributes or
- // relationships as defined in an EOModel, and are used in both the access
- // and interface layers.
-
-
- @interface Object (EOKeyValueCoding)
-
- - (NSDictionary *)valuesForKeys:(NSArray *)keys;
- // Returns a dictionary providing values for the keys. The default
- // implementation searches first for a selector with the same name as the
- // key, and then for an instance variable with the same name as the key.
-
- - (BOOL)takeValuesFromDictionary:(NSDictionary *)dictionary;
- // Sets properties of the receiver with values from the dictionary.
- // Returns YES if the receiver read all values from the dictionary, NO if
- // it couldn't take all values. The default implementation searches first
- // for a selector named setKey: (where "Key" is replaced by the key in the
- // dictionary), and then for an instance variable with the same name as
- // the key.
-
- @end
-
-
- // This category on NSObject defines the same functionality for objects
- // derived from NSObject. In the case of an NSDictionary, this category
- // operates on the contents of the receiver, and not on the receiver's
- // instance variables.
-
-
- @interface NSObject (EOKeyValueCoding)
-
- - (void)flushKeyBindings;
- // Invalidates the cached key binding information for the receiver's
- // class. This method should be invoked whenever a class is modified or
- // removed from the runtime system.
-
- - (NSDictionary *)valuesForKeys:(NSArray *)keys;
- // Returns a dictionary providing values for the keys. The default
- // implementation searches first for a selector with the same name as the
- // key, and then for an instance variable with the same name as the key.
-
- - (BOOL)takeValuesFromDictionary:(NSDictionary *)dictionary;
- // Sets properties of the receiver with values from the dictionary.
- // Returns YES if the receiver read all values from the dictionary, NO if
- // it couldn't take all values. The default implementation searches first
- // for a selector named setKey: (where "Key" is replaced by the key in the
- // dictionary), and then for an instance variable with the same name as
- // the key.
-
- @end
-
- @interface NSObject (EOKeyValueCodingEONull)
- - (void)unableToSetNullForKey:(NSString *)key;
- // Classes can implement this method to perscribe the behavior
- // when EONull is assigned to a property in an EO that requires
- // a C scalar type (such as int or float). One possible implementation
- // is to call takeValuesFromDictionary recursively with a special
- // value object that will return the desired values to assign for
- // the methods floatValue, intValue, unsignedIntValue, etc.
- @end
-
-