ObjFW  Check-in [430222609a]

Overview
Comment:Make typeEncoding a const char* in OFIntrospection.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 430222609a269bc9b869e2b229270f6cab6a2c8873d4cfec79e916a11dbf9d7f
User & Date: js on 2011-07-29 20:35:34
Other Links: manifest | tags
Context
2011-07-29
21:34
OFConstantString: -[completeInitialization] -> -[finishInitialization]. check-in: 2caeadf65a user: js tags: trunk
20:35
Make typeEncoding a const char* in OFIntrospection. check-in: 430222609a user: js tags: trunk
2011-07-28
22:21
Don't create and release a pool in -[enumerateObjectsUsingBlock:]. check-in: 3b0699b790 user: js tags: trunk
Changes

Modified src/OFIntrospection.h from [ee956bd7fd] to [f2d1bab891].

23
24
25
26
27
28
29
30

31
32
33
34
35
36

37
38
39
40
41
42
43
23
24
25
26
27
28
29

30
31
32
33
34
35

36
37
38
39
40
41
42
43







-
+





-
+







/**
 * \brief A class for describing a method.
 */
@interface OFMethod: OFObject
{
	SEL selector;
	OFString *name;
	OFString *typeEncoding;
	const char *typeEncoding;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) SEL selector;
@property (readonly, copy) OFString *name;
@property (readonly, copy) OFString *typeEncoding;
@property (readonly) const char *typeEncoding;
#endif

/**
 * \brief Returns the selector of the method.
 *
 * \return The selector of the method
 */
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65







-
+







- (OFString*)name;

/**
 * \brief Returns the type encoding for the method.
 *
 * \return The type encoding for the method
 */
- (OFString*)typeEncoding;
- (const char*)typeEncoding;
@end

/**
 * \brief A class for introspecting classes.
 */
@interface OFIntrospection: OFObject
{

Modified src/OFIntrospection.m from [fa560f7e6a] to [e9f75e8e35].

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
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 = [[OFString alloc]
		    initWithCString: method_getTypeEncoding(method)];
		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 = [[OFString alloc]
		    initWithCString: method->method_types];
		typeEncoding = 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
- (const char*)typeEncoding
{
	OF_GETTER(typeEncoding, YES)
	return typeEncoding;
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"<OFMethod: %@ [%@]>",
	return [OFString stringWithFormat: @"<OFMethod: %@ [%s]>",
					   name, typeEncoding];
}
@end

@implementation OFIntrospection
+ introspectionWithClass: (Class)class
{