mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
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:
parent
22f8f72d56
commit
47fb20dd9b
3 changed files with 47 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue