Index: xotcl/library/patterns/OnCalleeProxy.xotcl =================================================================== diff -u -r5ce5a10c82bc948f50fc4542f844dcd50de1eae3 -r435b41481fb51bf000ebe736d8574fefbeec1710 --- xotcl/library/patterns/OnCalleeProxy.xotcl (.../OnCalleeProxy.xotcl) (revision 5ce5a10c82bc948f50fc4542f844dcd50de1eae3) +++ xotcl/library/patterns/OnCalleeProxy.xotcl (.../OnCalleeProxy.xotcl) (revision 435b41481fb51bf000ebe736d8574fefbeec1710) @@ -1,31 +1,41 @@ -# $Id: OnCalleeProxy.xotcl,v 1.2 2004/07/03 21:19:39 neumann Exp $ +# $Id: OnCalleeProxy.xotcl,v 1.3 2005/09/09 21:07:23 neumann Exp $ + package provide xotcl::pattern::onCalleeProxy 0.8 +package require XOTcl -Class OnCalleeProxy -superclass Class +namespace eval ::xotcl::pattern::onCalleeProxy { + namespace import ::xotcl::* -@ @File { - description { - Simple proxy pattern implementation enhanced with the ability to adapt - calls solely for specified calling objects - for each calling obj there may be a different delegator obj - } -} + Class OnCalleeProxy -superclass Class -OnCalleeProxy instproc onCalleeProxyFilter args { - set o [string trimleft [self callingobject] :] - my instvar callee - #puts stderr "[self class]: checking $o -- [self] -- [self calledproc] " - if {[info exists callee($o)]} { - return [::eval [set callee($o)] [self calledproc] $args] - } else { - next - } -} + @ @File { + description { + Simple proxy pattern implementation enhanced with the ability to adapt + calls solely for specified calling objects + for each calling obj there may be a different delegator obj + } + } -OnCalleeProxy instproc init args { - my instfilter add onCalleeProxyFilter - next - my instproc setCallee {callingObj a} { - my set callee([string trimleft $callingObj :]) $a - } + OnCalleeProxy instproc onCalleeProxyFilter args { + set o [string trimleft [self callingobject] :] + my instvar callee + #puts stderr "[self class]: checking $o -- [self] -- [self calledproc] " + if {[info exists callee($o)]} { + return [::eval [set callee($o)] [self calledproc] $args] + } else { + next + } + } + + OnCalleeProxy instproc init args { + my instfilter add onCalleeProxyFilter + next + my instproc setCallee {callingObj a} { + my set callee([string trimleft $callingObj :]) $a + } + } + + namespace export OnCalleeProxy } + +namespace import ::xotcl::pattern::onCalleeProxy::*