35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
{
self = [super init];
@try {
selector = method_getName(method);
name = [[OFString alloc]
initWithCString: sel_getName(selector)];
typeEncoding = [[OFString alloc]
initWithCString: method_getTypeEncoding(method)];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#elif defined(OF_OLD_GNU_RUNTIME)
- _initWithMethod: (Method_t)method
{
self = [super init];
@try {
selector = method->method_name;
name = [[OFString alloc]
initWithCString: sel_get_name(selector)];
typeEncoding = [[OFString alloc]
initWithCString: method->method_types];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#endif
- (void)dealloc
{
[name release];
[typeEncoding release];
[super dealloc];
}
- (SEL)selector
{
return selector;
}
- (OFString*)name
{
OF_GETTER(name, YES)
}
- (OFString*)typeEncoding
{
OF_GETTER(typeEncoding, YES)
}
- (OFString*)description
{
return [OFString stringWithFormat: @"<OFMethod: %@ [%@]>",
name, typeEncoding];
}
@end
@implementation OFIntrospection
+ introspectionWithClass: (Class)class
{
|
<
|
<
|
<
|
|
|
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
{
self = [super init];
@try {
selector = method_getName(method);
name = [[OFString alloc]
initWithCString: sel_getName(selector)];
typeEncoding = method_getTypeEncoding(method);
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#elif defined(OF_OLD_GNU_RUNTIME)
- _initWithMethod: (Method_t)method
{
self = [super init];
@try {
selector = method->method_name;
name = [[OFString alloc]
initWithCString: sel_get_name(selector)];
typeEncoding = method->method_types;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
#endif
- (void)dealloc
{
[name release];
[super dealloc];
}
- (SEL)selector
{
return selector;
}
- (OFString*)name
{
OF_GETTER(name, YES)
}
- (const char*)typeEncoding
{
return typeEncoding;
}
- (OFString*)description
{
return [OFString stringWithFormat: @"<OFMethod: %@ [%s]>",
name, typeEncoding];
}
@end
@implementation OFIntrospection
+ introspectionWithClass: (Class)class
{
|