26+ (id)weakRefWithObject:(
id<OOWeakReferenceSupport>)object
28 if (
object ==
nil)
return nil;
33 return [result autorelease];
39 [_object weakRefDied:self];
47 if (
_object !=
nil)
return [_object description];
48 else return [NSString stringWithFormat:@"<Dead %@ %p>", [
self class], self];
74 return [_object class];
84- (void)forwardInvocation:(NSInvocation *)invocation
87 [invocation invokeWithTarget:_object];
91- (NSMethodSignature *)methodSignatureForSelector:(
SEL)selector
93 NSMethodSignature *result =
nil;
100 if (__builtin_expect(
_object !=
nil, 1)) result = [(id)_object methodSignatureForSelector:selector];
113- (BOOL)respondsToSelector:(
SEL)selector
120 return [_object respondsToSelector:selector];
132- (id)forwardingTargetForSelector:(
SEL)sel
140@implementation NSObject (OOWeakReference)
155 return [weakSelf retain];
161 if (weakRef == weakSelf) weakSelf =
nil;
167 [weakSelf weakRefDrop];
174 return [[
self weakRetain] autorelease];
183+ (void)weakRefDrop {}
185+ (id)nilMethod {
return nil; }
id weakRefUnderlyingObject()
id weakRefUnderlyingObject()
id< OOWeakReferenceSupport > _object
id weakRefUnderlyingObject()
id weakRefWithObject:(id< OOWeakReferenceSupport > object)