19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#import "OFInvocation.h"
#import "OFArray.h"
#import "OFData.h"
#import "OFMethodSignature.h"
#ifdef OF_INVOCATION_CAN_INVOKE
extern void of_invocation_invoke(OFInvocation *);
#endif
@implementation OFInvocation
@synthesize methodSignature = _methodSignature;
+ (instancetype)invocationWithMethodSignature: (OFMethodSignature *)signature
{
|
|
|
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#import "OFInvocation.h"
#import "OFArray.h"
#import "OFData.h"
#import "OFMethodSignature.h"
#ifdef OF_INVOCATION_CAN_INVOKE
extern void OFInvocationInvoke(OFInvocation *);
#endif
@implementation OFInvocation
@synthesize methodSignature = _methodSignature;
+ (instancetype)invocationWithMethodSignature: (OFMethodSignature *)signature
{
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
_arguments = [[OFMutableArray alloc] init];
for (size_t i = 0; i < numberOfArguments; i++) {
OFMutableData *data;
typeEncoding = [_methodSignature
argumentTypeAtIndex: i];
typeSize = of_sizeof_type_encoding(typeEncoding);
data = [OFMutableData dataWithItemSize: typeSize
capacity: 1];
[data increaseCountBy: 1];
[_arguments addObject: data];
}
typeEncoding = _methodSignature.methodReturnType;
typeSize = of_sizeof_type_encoding(typeEncoding);
if (typeSize > 0) {
_returnValue = [[OFMutableData alloc]
initWithItemSize: typeSize
capacity: 1];
[_returnValue increaseCountBy: 1];
}
|
|
|
|
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
_arguments = [[OFMutableArray alloc] init];
for (size_t i = 0; i < numberOfArguments; i++) {
OFMutableData *data;
typeEncoding = [_methodSignature
argumentTypeAtIndex: i];
typeSize = OFSizeOfTypeEncoding(typeEncoding);
data = [OFMutableData dataWithItemSize: typeSize
capacity: 1];
[data increaseCountBy: 1];
[_arguments addObject: data];
}
typeEncoding = _methodSignature.methodReturnType;
typeSize = OFSizeOfTypeEncoding(typeEncoding);
if (typeSize > 0) {
_returnValue = [[OFMutableData alloc]
initWithItemSize: typeSize
capacity: 1];
[_returnValue increaseCountBy: 1];
}
|
109
110
111
112
113
114
115
116
117
118
119
|
{
memcpy(buffer, _returnValue.items, _returnValue.itemSize);
}
#ifdef OF_INVOCATION_CAN_INVOKE
- (void)invoke
{
of_invocation_invoke(self);
}
#endif
@end
|
|
|
109
110
111
112
113
114
115
116
117
118
119
|
{
memcpy(buffer, _returnValue.items, _returnValue.itemSize);
}
#ifdef OF_INVOCATION_CAN_INVOKE
- (void)invoke
{
OFInvocationInvoke(self);
}
#endif
@end
|