Hi,
Here is a patch to support -valueForKey: search pattern as described in
Apple Key-Value-Coding guide.
It adds -isKey as a possible getter and _isKey and isKey as possible ivars.
Quentin.
Index: Source/NSKeyValueCoding.m
===================================================================
--- Source/NSKeyValueCoding.m (revision 30292)
+++ Source/NSKeyValueCoding.m (working copy)
@@ -178,7 +178,15 @@
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 @@
{
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);
+ }
+ }
}
}
}
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev