ObjFW  Diff

Differences From Artifact [2314d4ab1a]:

To Artifact [b853dc8c4c]:


16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

#import "OFObject.h"

@class OFString;
@class OFArray;
@class OFMutableArray;

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

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

/**
 * \brief Returns the selector of the method.
 *
 * \return The selector of the method
 */
- (SEL)selector;

/**
 * \brief Returns the name of the method.
 *
 * \return The name of the method
 */
- (OFString*)name;

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

/**
 * \brief A class for describing an instance variable.
 */
@interface OFInstanceVariable: OFObject
{
	OFString *name;
	const char *typeEncoding;
	ptrdiff_t offset;
}

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

/**
 * \brief Returns the name of the instance variable.
 *
 * \return The name of the instance variable
 */
- (OFString*)name;

/**
 * \brief Returns the offset of the instance variable.
 *
 * \return The offset of the instance variable
 */
- (ptrdiff_t)offset;

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

/**
 * \brief A class for introspecting classes.
 */
@interface OFIntrospection: OFObject
{
	OFMutableArray *classMethods;
	OFMutableArray *instanceMethods;
	OFMutableArray *instanceVariables;
#ifdef OF_HAVE_PROPERTIES
	OFMutableArray *properties;
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFArray *classMethods;
@property (readonly, copy) OFArray *instanceMethods;
@property (readonly, copy) OFArray *instanceVariables;
#endif

/**
 * \brief Creates a new introspection for the specified class.
 *
 * \return A new, autoreleased introspection for the specified class
 */
+ (instancetype)introspectionWithClass: (Class)class_;

/**
 * \brief Initializes an already allocated OFIntrospection with the specified
 *	  class.
 *
 * \return An initialized OFIntrospection
 */
- initWithClass: (Class)class_;

/**
 * \brief Returns the class methods of the class.
 *
 * \return An array of OFMethods
 */
- (OFArray*)classMethods;

/**
 * \brief Returns the instance methods of the class.
 *
 * \return An array of OFMethods
 */
- (OFArray*)instanceMethods;

/**
 * \brief Returns the instance variables of the class.
 *
 * \return An array of OFInstanceVariables
 */
- (OFArray*)instanceVariables;

/* TODO: protocols */
@end







|
|














|
|

|



|
|

|



|
|

|




|
|














|
|

|



|
|

|



|
|

|




|
|

















|
|

|



|
|


|



|
|

|



|
|

|



|
|

|





16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

#import "OFObject.h"

@class OFString;
@class OFArray;
@class OFMutableArray;

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

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

/*!
 * @brief Returns the selector of the method.
 *
 * @return The selector of the method
 */
- (SEL)selector;

/*!
 * @brief Returns the name of the method.
 *
 * @return The name of the method
 */
- (OFString*)name;

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

/*!
 * @brief A class for describing an instance variable.
 */
@interface OFInstanceVariable: OFObject
{
	OFString *name;
	const char *typeEncoding;
	ptrdiff_t offset;
}

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

/*!
 * @brief Returns the name of the instance variable.
 *
 * @return The name of the instance variable
 */
- (OFString*)name;

/*!
 * @brief Returns the offset of the instance variable.
 *
 * @return The offset of the instance variable
 */
- (ptrdiff_t)offset;

/*!
 * @brief Returns the type encoding for the instance variable.
 *
 * @return The type encoding for the instance variable
 */
- (const char*)typeEncoding;
@end

/*!
 * @brief A class for introspecting classes.
 */
@interface OFIntrospection: OFObject
{
	OFMutableArray *classMethods;
	OFMutableArray *instanceMethods;
	OFMutableArray *instanceVariables;
#ifdef OF_HAVE_PROPERTIES
	OFMutableArray *properties;
#endif
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFArray *classMethods;
@property (readonly, copy) OFArray *instanceMethods;
@property (readonly, copy) OFArray *instanceVariables;
#endif

/*!
 * @brief Creates a new introspection for the specified class.
 *
 * @return A new, autoreleased introspection for the specified class
 */
+ (instancetype)introspectionWithClass: (Class)class_;

/*!
 * @brief Initializes an already allocated OFIntrospection with the specified
 *	  class.
 *
 * @return An initialized OFIntrospection
 */
- initWithClass: (Class)class_;

/*!
 * @brief Returns the class methods of the class.
 *
 * @return An array of OFMethods
 */
- (OFArray*)classMethods;

/*!
 * @brief Returns the instance methods of the class.
 *
 * @return An array of OFMethods
 */
- (OFArray*)instanceMethods;

/*!
 * @brief Returns the instance variables of the class.
 *
 * @return An array of OFInstanceVariables
 */
- (OFArray*)instanceVariables;

/* TODO: protocols */
@end