More KVC fixes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12810 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-02-27 09:25:30 +00:00
parent 28a76a26bd
commit 96230a2ae9
3 changed files with 47 additions and 1 deletions

View file

@ -936,6 +936,14 @@ static NSString *indentStrings[] = {
}
}
/**
* Default implementation for this class is to return the value stored in
* the dictionary under the specified key, or nil if there is no value.
*/
- (id) valueForKey: (NSString*)key
{
return [self objectForKey: key];
}
@end
@implementation NSMutableDictionary
@ -1096,4 +1104,37 @@ static NSString *indentStrings[] = {
[self addEntriesFromDictionary: otherDictionary];
}
/**
* Default implementation for this class is equivalent to the
* -setObject:forKey: method unless value is nil, in which case
* it is equivalent to -removeObjectForKey:
*/
- (void) takeStoredValue: (id)value forKey: (NSString*)key
{
if (value == nil)
{
[self removeObjectForKey: key];
}
else
{
[self setObject: value forKey: key];
}
}
/**
* Default implementation for this class is equivalent to the
* -setObject:forKey: method unless value is nil, in which case
* it is equivalent to -removeObjectForKey:
*/
- (void) takeValue: (id)value forKey: (NSString*)key
{
if (value == nil)
{
[self removeObjectForKey: key];
}
else
{
[self setObject: value forKey: key];
}
}
@end