gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re[4]: Recent key-value encoding changes to NSObject.


From: Manuel Guesdon
Subject: Re[4]: Recent key-value encoding changes to NSObject.
Date: Mon, 11 Feb 2002 17:07:29 +0100 (CET)

On Mon, 11 Feb 2002 15:46:33 +0000 Richard Frith-Macdonald <address@hidden> 
wrote:
 >| Example -
 >| 
 >| @implementation MyObject
 >| - (id) takeValueForKey: (NSString*)aKey
 >| {
 >|    id result = [myDictionary objectForKey: aKey];
 >| 
 >|    if (result == nil)
 >|      {
 >|        result = [super takeValueForKey: aKey];
 >|      }
 >|    return result;
 >| }
 >| @end
 >| 
 >| Zero code duplication.
 >| Works for MyObject and all subclasses.
 >| What is wrong with this in the case you are concerened about?

values can be stored in a mixed way: ivars or dictionary as the user like (in 
objects derived from EOGenericRecords).
Calling takeValue:anObject forKey:aKey should call -[aKey] if it exists for the 
derived object.

Please see my last new mail wich contain a "real" example.

Manuel

--
______________________________________________________________________
Manuel Guesdon - OXYMIUM <address@hidden>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998




reply via email to

[Prev in Thread] Current Thread [Next in Thread]