gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Test fro overridden method


From: Fred Kiefer
Subject: Re: Test fro overridden method
Date: Sat, 30 Dec 2006 23:53:44 +0100
User-agent: Thunderbird 1.5.0.8 (X11/20060911)

Richard Frith-Macdonald schrieb:
> 
> 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()
> 

Oops, thank you for pointing this out. I should have checked in the code
before making this statement. The used functions are in the Additions of
base and would thereby be valid to be used in gui. Still I think this
function looks too serious to be thrown into a gui class as a helper. It
would confuse people like me. :-)

Cheers,
Fred





reply via email to

[Prev in Thread] Current Thread [Next in Thread]