ObjFW
 All Classes Functions Variables
OFIntrospection.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #import "OFObject.h"
18 
19 @class OFString;
20 @class OFArray;
21 @class OFMutableArray;
22 
26 @interface OFMethod: OFObject
27 {
28  SEL selector;
29  OFString *name;
30  const char *typeEncoding;
31 }
32 
33 #ifdef OF_HAVE_PROPERTIES
34 @property (readonly) SEL selector;
35 @property (readonly, copy) OFString *name;
36 @property (readonly) const char *typeEncoding;
37 #endif
38 
44 - (SEL)selector;
45 
51 - (OFString*)name;
52 
58 - (const char*)typeEncoding;
59 @end
60 
65 {
66  OFString *name;
67  const char *typeEncoding;
68  ptrdiff_t offset;
69 }
70 
71 #ifdef OF_HAVE_PROPERTIES
72 @property (readonly, copy) OFString *name;
73 @property (readonly) ptrdiff_t offset;
74 @property (readonly) const char *typeEncoding;
75 #endif
76 
82 - (OFString*)name;
83 
89 - (ptrdiff_t)offset;
90 
96 - (const char*)typeEncoding;
97 @end
98 
103 {
107 #ifdef OF_HAVE_PROPERTIES
108  OFMutableArray *properties;
109 #endif
110 }
111 
112 #ifdef OF_HAVE_PROPERTIES
113 @property (readonly, copy) OFArray *classMethods;
114 @property (readonly, copy) OFArray *instanceMethods;
115 @property (readonly, copy) OFArray *instanceVariables;
116 #endif
117 
123 + (instancetype)introspectionWithClass: (Class)class_;
124 
131 - initWithClass: (Class)class_;
132 
138 - (OFArray*)classMethods;
139 
145 - (OFArray*)instanceMethods;
146 
152 - (OFArray*)instanceVariables;
153 
154 /* TODO: protocols */
155 @end