<AOCAdviceProtocol> Protocol Reference

The protocol implemented by all advice objects. More...

#import <AOCAdvice.h>

Inheritance diagram for <AOCAdviceProtocol>:
AOCAdvice

List of all members.

Public Member Functions

(void) - adviceBefore:
 Where "before" advice is executed.
(BOOL) - adviceInsteadOf:
 Where the "instead of" advice is executed.
(void) - adviceAfter:
 Where "after" advice is executed.

Detailed Description

The protocol implemented by all advice objects.

In all of the methods, [inv imp] is the actual IMP that the advice is running for. This will be different from [[inv target] methodForSelector:[inv selector]] because the method has been swizzled.

The following code will crash because of infinite recursion:

    [[inv target] performSelector:[inv selector]]

You can't call the selector that advice is running for without causing infinite recursion. If you want to call actual method the advice is running for, use [inv invoke] without modifying the target, selector or IMP.


Member Function Documentation

- (void) adviceAfter: (id< AOCInvocationProtocol >)  inv   [optional]

Where "after" advice is executed.

The invocation argument should have already been invoked by the time this method is called. The return value of the invocation argument may be modified here.

Parameters:
inv The invocation after which this method is executing
- (void) adviceBefore: (id< AOCInvocationProtocol >)  inv   [optional]

Where "before" advice is executed.

The invocation argument will be invoked after this method is called, with any modification made to it. This means that the arguments may be modified here before the actual method is invoked.

Parameters:
inv The invocation before which this method is executing.
- (BOOL) adviceInsteadOf: (id< AOCInvocationProtocol >)  inv   [optional]

Where the "instead of" advice is executed.

The invocation argument is only invoked if this method returns YES. Otherwise, the return value of the invocation should be set manually by calling either AOCInvocationProtocol::invoke or AOCInvocationProtocol::setReturnValue:

Parameters:
inv The invocation instead of which this method is executing
Returns:
YES if the invocation argument should still be invoked after this method returns, otherwise NO

The documentation for this protocol was generated from the following file:
 All Classes Functions
Generated by  doxygen 1.6.3