mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-24 01:11:01 +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
28a76a26bd
commit
96230a2ae9
3 changed files with 47 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
|||
* Source/GSValue.m: attempt to correct encoding.
|
||||
* Source/NSKeyValueCoding.m: Fix termination of method names with nuls
|
||||
from report by Manuel Guesdon.
|
||||
* Source/NSDictionary.m: Implement MacOS-X compatible KVC behavior.
|
||||
|
||||
2002-02-26 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
- (BOOL) writeToFile: (NSString*)path atomically: (BOOL)useAuxiliaryFile;
|
||||
#ifndef STRICT_OPENSTEP
|
||||
- (id) valueForKey: (NSString*)key;
|
||||
- (BOOL) writeToURL: (NSURL*)url atomically: (BOOL)useAuxiliaryFile;
|
||||
#endif
|
||||
@end
|
||||
|
@ -82,7 +83,10 @@
|
|||
- (void) removeObjectsForKeys: (NSArray*)keyArray;
|
||||
- (void) setObject: (id)anObject forKey: (id)aKey; // Primitive
|
||||
- (void) setDictionary: (NSDictionary*)otherDictionary;
|
||||
|
||||
#ifndef STRICT_OPENSTEP
|
||||
- (void) takeStoredValue: (id)value forKey: (NSString*)key;
|
||||
- (void) takeValue: (id)value forKey: (NSString*)key;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#ifndef NO_GNUSTEP
|
||||
|
|
|
@ -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…
Reference in a new issue