* EOControl/EOKeyValueCoding.m ([NSArray -valueForKeyPath:]):

implemented the case of invoking an aggregate function using a simple
key.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gdl2/trunk@15242 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
mirko 2002-12-04 17:15:18 +00:00
parent db5d9aa1f9
commit e08b178887
2 changed files with 37 additions and 33 deletions

View file

@ -1,5 +1,9 @@
2002-12-04 Mirko Viviani <mirko.viviani@rccr.cremona.it>
* EOControl/EOKeyValueCoding.m ([NSArray -valueForKeyPath:]):
implemented the case of invoking an aggregate function using a simple
key.
* EOControl/EOGenericRecord.m ([EOGenericRecord
-_infoForInstanceVariableNamed:retType:retSize:retOffset:]): renamed
GSObjCFindInstanceVariable in GSFindInstanceVariable

View file

@ -345,47 +345,47 @@ static char rcsId[] = "$Id$";
{
NSMutableString *selString = [NSMutableString stringWithCapacity: 10];
NSArray *pathArray = [keyPath componentsSeparatedByString: @"."];
NSString *fn = [pathArray objectAtIndex:0];
NSString *key = nil;
SEL computeSelector;
char l;
if ([pathArray count] == 1)
{
}
else
{
NSString* fn= [pathArray objectAtIndex:0];
NSString* key=nil;
SEL computeSelector;
char l;
str=[fn cString];
l = str[1];
str = [fn cString];
l = str[1];
if (islower(l))
l = toupper(l);
if (islower(l))
l = toupper(l);
[selString appendString: @"compute"];
[selString appendString: [NSString stringWithCString: &l
length: 1]];
[selString appendString: [NSString stringWithCString: &str[2]]];
[selString appendString: @"ForKey:"];
[selString appendString: @"compute"];
[selString appendString: [NSString stringWithCString: &l
length: 1]];
[selString appendString: [NSString stringWithCString: &str[2]]];
[selString appendString: @"ForKey:"];
computeSelector = NSSelectorFromString(selString);
if ([pathArray count] > 1)
key = [pathArray objectAtIndex: 1];
computeSelector = NSSelectorFromString(selString);
result = [self performSelector: computeSelector
if ([pathArray count] > 1)
{
key = [pathArray objectAtIndex: 1];
result = [self performSelector: computeSelector
withObject: key];
}
else
result = [self performSelector: computeSelector
withObject: @""];
if (result && [pathArray count] > 2)
{
NSArray *rightKeyPathArray
= [pathArray subarrayWithRange:
NSMakeRange(2, [pathArray count] - 2)];
NSString *rightKeyPath
= [rightKeyPathArray componentsJoinedByString: @"."];
if (result && [pathArray count] > 2)
{
NSArray *rightKeyPathArray
= [pathArray subarrayWithRange:
NSMakeRange(2, [pathArray count] - 2)];
NSString *rightKeyPath
= [rightKeyPathArray componentsJoinedByString: @"."];
result = [result valueForKeyPath: rightKeyPath];
}
}
}
result = [result valueForKeyPath: rightKeyPath];
}
}
}
else if ([keyPath isEqualToString: @"count"]) //Special case: Apple Doc is wrong; here we return -count
{