mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +00:00
Initial revision
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@750 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2b5de0130d
commit
5503dfbb4a
29 changed files with 7122 additions and 0 deletions
43
Source/ProtocolEnforcer.m
Normal file
43
Source/ProtocolEnforcer.m
Normal file
|
@ -0,0 +1,43 @@
|
|||
|
||||
@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
|
Loading…
Add table
Add a link
Reference in a new issue