* Headers/Foundation/NSKeyValueObserving.h,

* Source/NSKeyValueObserving.m: Add method
        -keyPathsForValuesAffectingValueForKey:.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37636 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2014-01-26 13:22:38 +00:00
parent 11cf284722
commit e384821ba8
3 changed files with 42 additions and 2 deletions

View file

@ -2016,6 +2016,32 @@ triggerChangeNotificationsForDependentKey: (NSString*)dependentKey
}
}
+ (NSSet*) keyPathsForValuesAffectingValueForKey: (NSString*)dependentKey
{
NSString *selString = [NSString stringWithFormat: @"keyPathsForValuesAffecting%@",
dependentKey];
SEL sel = NSSelectorFromString(selString);
NSMapTable *affectingKeys;
NSEnumerator *enumerator;
NSString *affectingKey;
NSMutableSet *keyPaths;
if ([self respondsToSelector: sel])
{
return [self performSelector: sel];
}
affectingKeys = NSMapGet(dependentKeyTable, self);
keyPaths = [[NSMutableSet alloc] initWithCapacity: [affectingKeys count]];
enumerator = [affectingKeys keyEnumerator];
while ((affectingKey = [enumerator nextObject]))
{
[keyPaths addObject: affectingKey];
}
return AUTORELEASE(keyPaths);
}
- (void*) observationInfo
{
void *info;