mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-25 17:51:01 +00:00
44 lines
719 B
Mathematica
44 lines
719 B
Mathematica
|
|
||
|
@interface ProtocolEnforcer
|
||
|
{
|
||
|
id target;
|
||
|
Protocol *protocol;
|
||
|
}
|
||
|
|
||
|
- initWithProtocol: aProtocol target: anObj;
|
||
|
|
||
|
- (BOOL) conformsTo: aProtocol;
|
||
|
- forward: (SEL)sel :(arglist_t)frame;
|
||
|
|
||
|
@end
|
||
|
|
||
|
@implementation ProtocolEnforcer
|
||
|
|
||
|
- initWithProtocol: aProtocol target: anObj
|
||
|
{
|
||
|
[super init];
|
||
|
protocol = aProtocol;
|
||
|
target = anObj;
|
||
|
return self;
|
||
|
}
|
||
|
|
||
|
- (BOOL) conformsTo: aProtocol
|
||
|
{
|
||
|
if (aProtocol == protocol)
|
||
|
return YES;
|
||
|
else
|
||
|
return NO;
|
||
|
}
|
||
|
|
||
|
- (retval_t) forward: (SEL)sel :(arglist_t)frame
|
||
|
{
|
||
|
if ([protocol descriptionForInstanceMethod:sel])
|
||
|
return [target performv:sel :frame];
|
||
|
else
|
||
|
#warning Fix this
|
||
|
return
|
||
|
[self error:"We should punish the remote connection not the local one"];
|
||
|
}
|
||
|
|
||
|
@end
|