224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
return objc_get_instance_method(self, selector);
#elif defined(OF_APPLE_RUNTIME)
return class_getMethodImplementation(self, selector);
#else
return method_get_imp(class_get_instance_method(self, selector));
#endif
}
+ (IMP)setImplementation: (IMP)newimp
forClassMethod: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector))
@throw [OFInvalidArgumentException newWithClass: self
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
|
return objc_get_instance_method(self, selector);
#elif defined(OF_APPLE_RUNTIME)
return class_getMethodImplementation(self, selector);
#else
return method_get_imp(class_get_instance_method(self, selector));
#endif
}
+ (const char*)typeEncodingForInstanceSelector: (SEL)selector
{
#if defined(OF_APPLE_RUNTIME)
Method m;
const char *ret;
if ((m = class_getInstanceMethod(self, selector)) == NULL ||
(ret = method_getTypeEncoding(m)) == NULL)
@throw [OFNotImplementedException newWithClass: self
selector: selector];
return ret;
#elif defined(OF_GNU_RUNTIME)
Method_t m;
if ((m = class_get_instance_method(self, selector)) == NULL ||
m->method_types == NULL)
@throw [OFNotImplementedException newWithClass: self
selector: selector];
return m->method_types;
#elif defined(OF_OBJFW_RUNTIME)
const char *ret;
if ((ret = objc_get_type_encoding(self, selector)) == NULL)
@throw [OFNotImplementedException newWithClass: self
selector: selector];
return ret;
#endif
}
+ (IMP)setImplementation: (IMP)newimp
forClassMethod: (SEL)selector
{
#if defined(OF_OBJFW_RUNTIME)
if (newimp == (IMP)0 || !class_respondsToSelector(self->isa, selector))
@throw [OFInvalidArgumentException newWithClass: self
|
398
399
400
401
402
403
404
405
406
407
408
409
410
411
|
{
#ifdef OF_APPLE_RUNTIME
return class_getMethodImplementation(isa, selector);
#else
return objc_msg_lookup(self, selector);
#endif
}
- (BOOL)isEqual: (id)obj
{
/* Classes containing data should reimplement this! */
return (self == obj ? YES : NO);
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
|
{
#ifdef OF_APPLE_RUNTIME
return class_getMethodImplementation(isa, selector);
#else
return objc_msg_lookup(self, selector);
#endif
}
- (const char*)typeEncodingForSelector: (SEL)selector
{
#if defined(OF_APPLE_RUNTIME)
Method m;
const char *ret;
if ((m = class_getInstanceMethod(isa, selector)) == NULL ||
(ret = method_getTypeEncoding(m)) == NULL)
@throw [OFNotImplementedException newWithClass: isa
selector: selector];
return ret;
#elif defined(OF_GNU_RUNTIME)
Method_t m;
if ((m = class_get_instance_method(isa, selector)) == NULL ||
m->method_types == NULL)
@throw [OFNotImplementedException newWithClass: isa
selector: selector];
return m->method_types;
#elif defined(OF_OBJFW_RUNTIME)
const char *ret;
if ((ret = objc_get_type_encoding(isa, selector)) == NULL)
@throw [OFNotImplementedException newWithClass: isa
selector: selector];
return ret;
#endif
}
- (BOOL)isEqual: (id)obj
{
/* Classes containing data should reimplement this! */
return (self == obj ? YES : NO);
}
|