more kvc tidying

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12844 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-02-27 17:41:31 +00:00
parent 5ade1a56bb
commit dc839bfd81
2 changed files with 24 additions and 1 deletions

View file

@ -13,6 +13,7 @@
* Source/NSKeyValueCoding.m: Fix termination of method names with nuls * Source/NSKeyValueCoding.m: Fix termination of method names with nuls
from report by Manuel Guesdon. from report by Manuel Guesdon.
* Source/NSDictionary.m: Implement MacOS-X compatible KVC behavior. * Source/NSDictionary.m: Implement MacOS-X compatible KVC behavior.
Include webobjects/eof extension, with warnings.
* Headers/Foundation/NSProtocolChecker.h: Change deprecated import to * Headers/Foundation/NSProtocolChecker.h: Change deprecated import to
include. include.

View file

@ -37,6 +37,7 @@
#include <Foundation/NSCoder.h> #include <Foundation/NSCoder.h>
#include <Foundation/NSDebug.h> #include <Foundation/NSDebug.h>
#include <Foundation/NSObjCRuntime.h> #include <Foundation/NSObjCRuntime.h>
#include <Foundation/NSValue.h>
#include "GSUserDefaults.h" #include "GSUserDefaults.h"
@implementation NSDictionary @implementation NSDictionary
@ -942,7 +943,28 @@ static NSString *indentStrings[] = {
*/ */
- (id) valueForKey: (NSString*)key - (id) valueForKey: (NSString*)key
{ {
return [self objectForKey: key]; id o = [self objectForKey: key];
if (o == nil)
{
if ([key isEqualToString: @"count"] == YES)
{
o = [NSNumber numberWithUnsignedInt: [self count]];
}
else if ([key isEqualToString: @"allKeys"] == YES)
{
o = [self allKeys];
}
else if ([key isEqualToString: @"allValues"] == YES)
{
o = [self allValues];
}
if (o != nil)
{
NSWarnMLog(@"Key '%@' would return nil in MacOS-X Foundation", key);
}
}
return o;
} }
@end @end