ObjFW  Diff

Differences From Artifact [133f93ff8b]:

To Artifact [757a211040]:


13
14
15
16
17
18
19

20
21



22
23
24
25
26
27
28
13
14
15
16
17
18
19
20


21
22
23
24
25
26
27
28
29
30







+
-
-
+
+
+







 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"

@class OFString;
#ifndef DOXYGEN
@class OFArray;
@class OFMutableArray;
@class OFArray OF_GENERIC(ObjectType);
@class OFMutableArray OF_GENERIC(ObjectType);
#endif

enum {
	OF_PROPERTY_READONLY	=   0x01,
	OF_PROPERTY_ASSIGN	=   0x04,
	OF_PROPERTY_READWRITE	=   0x08,
	OF_PROPERTY_RETAIN	=   0x10,
	OF_PROPERTY_COPY	=   0x20,
177
178
179
180
181
182
183
184
185
186
187




188
189
190
191
192
193
194





195
196
197
198
199
200
201
179
180
181
182
183
184
185




186
187
188
189
190
191
192




193
194
195
196
197
198
199
200
201
202
203
204







-
-
-
-
+
+
+
+



-
-
-
-
+
+
+
+
+







/*!
 * @class OFIntrospection OFIntrospection.h ObjFW/OFIntrospection.h
 *
 * @brief A class for introspecting classes.
 */
@interface OFIntrospection: OFObject
{
	OFMutableArray *_classMethods;
	OFMutableArray *_instanceMethods;
	OFMutableArray *_properties;
	OFMutableArray *_instanceVariables;
	OFMutableArray OF_GENERIC(OFMethod*) *_classMethods;
	OFMutableArray OF_GENERIC(OFMethod*) *_instanceMethods;
	OFMutableArray OF_GENERIC(OFProperty*) *_properties;
	OFMutableArray OF_GENERIC(OFInstanceVariable*) *_instanceVariables;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFArray *classMethods;
@property (readonly, copy) OFArray *instanceMethods;
@property (readonly, copy) OFArray *properties;
@property (readonly, copy) OFArray *instanceVariables;
@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *classMethods;
@property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *instanceMethods;
@property (readonly, copy) OFArray OF_GENERIC(OFProperty*) *properties;
@property (readonly, copy)
    OFArray OF_GENERIC(OFInstanceVariable*) *instanceVariables;
#endif

/*!
 * @brief Creates a new introspection for the specified class.
 *
 * @return A new, autoreleased introspection for the specified class
 */
210
211
212
213
214
215
216
217

218
219
220
221
222
223
224

225
226
227
228
229
230
231
213
214
215
216
217
218
219

220
221
222
223
224
225
226

227
228
229
230
231
232
233
234







-
+






-
+







- initWithClass: (Class)class_;

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

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

/*!
 * @brief Returns the properties of the class.
 *
 * @warning **Do not rely on this, as this behaves differently depending on the
 *	    compiler and ABI used!**
 *
241
242
243
244
245
246
247
248

249
250
251
252
253
254
255

256
257
258
244
245
246
247
248
249
250

251
252
253
254
255
256
257

258
259
260
261







-
+






-
+



 *	    used.
 *
 * @warning GCC does not emit any data for property introspection for the GNU
 *	    ABI.
 *
 * @return An array of objects of class @ref OFProperty
 */
- (OFArray*)properties;
- (OFArray OF_GENERIC(OFProperty*)*)properties;

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

/* TODO: protocols */
@end