On 30 Dec 2006, at 16:09, Fred Kiefer wrote:
BOOL
GSObjCHasOverridden(Class baseClass, id object, SEL selector)
{
if (GSObjCIsClass(object))
{
if ((Class)object == baseClass
|| GSGetMethod((Class)object, selector, NO. YES) ==
GSGetMethod(base, selector, NO. YES))
{
return YES;
}
}
else
{
Class instanceClass = GSObjCClass(object);
if (instanceClass == baseClass
|| GSGetMethod(instanceClass, selector, YES. YES) ==
GSGetMethod(base, selector, YES. YES))
{
return YES;
}
}
return NO;
}
Thank you very much for this code. This uses some fast but GNU runtime
specific functions. I will stick with my slower method of testing
until
this implementation makes it into GSobjCRuntime and we also have an
abstraction that allows similar tests with the Apple runtime.
Actually, it doesn't use ANY GNU runtime specific functions, it's
entirely runtime independent code!
It uses functions from GSObjCRuntime.h and GSObjCRuntime.m ... which
are wrappers round either GNU runtime functions or Apple runtime
functions depending on which system you build.
The equivalent GNU runtime specific code would use object_is_class()
rather than GSObjCIsClass() and would use class_get_instance_method()
and class_get_class_method() rather than GSGetMethod()
_______________________________________________
Gnustep-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnustep-dev