mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
* 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:
parent
11cf284722
commit
e384821ba8
3 changed files with 42 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue