mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Added missing support to ValueForKey() as described in Apple Key-Value-Coding guide.
-isKey is now treated as a KVC-compliant getter, and _isKey and isKey as KVC-compliant ivars. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@30464 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5d036eee5e
commit
8633b7d611
2 changed files with 34 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-05-28 Quentin Mathe <quentin.mathe@gmail.com>
|
||||
|
||||
* Source/NSKeyValueCoding.m: Added missing support to ValueForKey() as
|
||||
described in Apple Key-Value-Coding guide. -isKey is now treated as a
|
||||
KVC-compliant getter, and _isKey and isKey as KVC-compliant ivars.
|
||||
|
||||
2010-05-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPropertyList.m: ([-parser:foundCharacters:]) don't trim
|
||||
|
|
|
@ -178,7 +178,15 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
sel = 0;
|
||||
buf[4] = hi;
|
||||
buf[3] = 's';
|
||||
buf[2] = 'i';
|
||||
name = &buf[2]; // isKey
|
||||
sel = GSSelectorFromName(name);
|
||||
if (sel == 0 || [self respondsToSelector: sel] == NO)
|
||||
{
|
||||
sel = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,11 +210,27 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
{
|
||||
buf[4] = lo;
|
||||
buf[3] = '_';
|
||||
name = &buf[3]; // _key
|
||||
name = &buf[3]; // _key
|
||||
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
|
||||
{
|
||||
name = &buf[4]; // key
|
||||
GSObjCFindVariable(self, name, &type, &size, &off);
|
||||
buf[4] = hi;
|
||||
buf[3] = 's';
|
||||
buf[2] = 'i';
|
||||
buf[1] = '_';
|
||||
name = &buf[1]; // _isKey
|
||||
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
|
||||
{
|
||||
buf[4] = lo;
|
||||
name = &buf[4]; // key
|
||||
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
|
||||
{
|
||||
buf[4] = hi;
|
||||
buf[3] = 's';
|
||||
buf[2] = 'i';
|
||||
name = &buf[2]; // isKey
|
||||
GSObjCFindVariable(self, name, &type, &size, &off);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue