mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 10:11:03 +00:00
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:
parent
5ade1a56bb
commit
dc839bfd81
2 changed files with 24 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
|||
* Source/NSKeyValueCoding.m: Fix termination of method names with nuls
|
||||
from report by Manuel Guesdon.
|
||||
* Source/NSDictionary.m: Implement MacOS-X compatible KVC behavior.
|
||||
Include webobjects/eof extension, with warnings.
|
||||
* Headers/Foundation/NSProtocolChecker.h: Change deprecated import to
|
||||
include.
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <Foundation/NSCoder.h>
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include <Foundation/NSObjCRuntime.h>
|
||||
#include <Foundation/NSValue.h>
|
||||
#include "GSUserDefaults.h"
|
||||
|
||||
@implementation NSDictionary
|
||||
|
@ -942,7 +943,28 @@ static NSString *indentStrings[] = {
|
|||
*/
|
||||
- (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
|
||||
|
||||
|
|
Loading…
Reference in a new issue