258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
|
sarray_at_put_safe(((Class)self->class_pointer)->dtable,
(sidx)method->method_name->sel_id, method->method_imp);
return oldimp;
#endif
}
+ (IMP)replaceClassMethod: (SEL)selector
withClassMethodFromClass: (Class)class;
{
IMP newimp;
#if defined(OF_OBJFW_RUNTIME)
newimp = objc_get_class_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
newimp = method_getImplementation(class_getClassMethod(class,
selector));
#else
|
|
|
>
>
>
>
|
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
|
sarray_at_put_safe(((Class)self->class_pointer)->dtable,
(sidx)method->method_name->sel_id, method->method_imp);
return oldimp;
#endif
}
+ (IMP)replaceClassMethod: (SEL)selector
withMethodFromClass: (Class)class;
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
#if defined(OF_OBJFW_RUNTIME)
newimp = objc_get_class_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
newimp = method_getImplementation(class_getClassMethod(class,
selector));
#else
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
sarray_at_put_safe(((Class)self)->dtable,
(sidx)method->method_name->sel_id, method->method_imp);
return oldimp;
#endif
}
+ (IMP)replaceInstanceMethod: (SEL)selector
withInstanceMethodFromClass: (Class)class;
{
IMP newimp;
#if defined(OF_OBJFW_RUNTIME)
newimp = objc_get_instance_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
newimp = class_getMethodImplementation(class, selector);
#else
newimp = method_get_imp(class_get_instance_method(class, selector));
|
|
|
>
>
>
>
|
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
sarray_at_put_safe(((Class)self)->dtable,
(sidx)method->method_name->sel_id, method->method_imp);
return oldimp;
#endif
}
+ (IMP)replaceInstanceMethod: (SEL)selector
withMethodFromClass: (Class)class;
{
IMP newimp;
if (![class isSubclassOfClass: self])
@throw [OFInvalidArgumentException newWithClass: self
selector: _cmd];
#if defined(OF_OBJFW_RUNTIME)
newimp = objc_get_instance_method(class, selector);
#elif defined(OF_APPLE_RUNTIME)
newimp = class_getMethodImplementation(class, selector);
#else
newimp = method_get_imp(class_get_instance_method(class, selector));
|