Differences From Artifact [061b43fb0e]:
- File
src/OFIntrospection.h
— part of check-in
[80e1a9655b]
at
2015-06-17 22:11:31
on branch trunk
— Add OF_NULLABLE_PROPERTY
This is necessary to make GCC (>= 4.6 and Apple GCC) happy as they don't
like the list of property attributes ending in a comma. (user: js, size: 7093) [annotate] [blame] [check-ins using]
To Artifact [afc6aa5a2f]:
- File
src/OFIntrospection.h
— part of check-in
[48980f2297]
at
2015-11-29 11:43:05
on branch trunk
— Make properties a requirement and clean up code
This increases the required GCC version from 4.0 to 4.6 (exception:
Apple GCC, which already supports this with >= 4.0 starting with OS X
10.5). Since even GCC 4.6 is really old by now, there is no point in
still supporting something even older and making the code ugly because
of that. While some hardware and OS support was dropped from GCC 4.6
compared to GCC 4.0, there is nothing in there that would be an
interesting target with the exception of BeOS maybe - but a port to BeOS
can also be achieved using the Haiku support. The other dropped OSes are
mostly old versions of OSes while newer ones are still being supported
(and those newer versions of those OSes still support the same
hardware). (user: js, size: 5652) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
45 46 47 48 49 50 51 | @interface OFMethod: OFObject { SEL _selector; OFString *_name; const char *_typeEncoding; } | < < < < < < < < | | < < | | < < | | < < < < < < < < | | | < < | < < | | < < | | < < < < < < < < | | < < | | < < | | < < < < < < < < < < < < < < < < < < < < < < < | < < | | < < | | | > | > > > | > > | | > | > > > | < > > > | 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 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 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 202 203 204 205 206 207 208 209 210 211 212 | @interface OFMethod: OFObject { SEL _selector; OFString *_name; const char *_typeEncoding; } /*! * The selector of the method. */ @property (readonly) SEL selector; /*! * The name of the method. */ @property (readonly, copy) OFString *name; /*! * The type encoding for the method. */ @property OF_NULLABLE_PROPERTY (readonly) const char *typeEncoding; @end /*! * @class OFProperty OFIntrospection.h ObjFW/OFIntrospection.h * * @brief A class for describing a property. */ @interface OFProperty: OFObject { OFString *_name; unsigned _attributes; OFString *_getter, *_setter; } /*! * The name of the property. */ @property (readonly, copy) OFString *name; /*! * The attributes of the property. * * The attributes are a bitmask with the following possible flags:@n * Flag | Description * ------------------------------|------------------------------------- * OF_PROPERTY_READONLY | The property is declared `readonly` * OF_PROPERTY_READWRITE | The property is declared `readwrite` * OF_PROPERTY_ASSIGN | The property is declared `assign` * OF_PROPERTY_RETAIN | The property is declared `retain` * OF_PROPERTY_COPY | The property is declared `copy` * OF_PROPERTY_NONATOMIC | The property is declared `nonatomic` * OF_PROPERTY_ATOMIC | The property is declared `atomic` * OF_PROPERTY_WEAK | The property is declared `weak` * OF_PROPERTY_SYNTHESIZED | The property is synthesized * OF_PROPERTY_DYNAMIC | The property is dynamic */ @property (readonly) unsigned attributes; /*! * The name of the getter. */ @property OF_NULLABLE_PROPERTY (readonly, copy) OFString *getter; /*! * @return The name of the setter. */ @property OF_NULLABLE_PROPERTY (readonly, copy) OFString *setter; @end /*! * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h * * @brief A class for describing an instance variable. */ @interface OFInstanceVariable: OFObject { OFString *_name; const char *_typeEncoding; ptrdiff_t _offset; } /*! * The name of the instance variable. */ @property (readonly, copy) OFString *name; /*! * The offset of the instance variable. */ @property (readonly) ptrdiff_t offset; /*! * The type encoding for the instance variable. */ @property OF_NULLABLE_PROPERTY (readonly) const char *typeEncoding; @end /*! * @class OFIntrospection OFIntrospection.h ObjFW/OFIntrospection.h * * @brief A class for introspecting classes. */ @interface OFIntrospection: OFObject { OFMutableArray OF_GENERIC(OFMethod*) *_classMethods; OFMutableArray OF_GENERIC(OFMethod*) *_instanceMethods; OFMutableArray OF_GENERIC(OFProperty*) *_properties; OFMutableArray OF_GENERIC(OFInstanceVariable*) *_instanceVariables; } /*! * The class methods of the class. */ @property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *classMethods; /*! * The instance methods of the class. */ @property (readonly, copy) OFArray OF_GENERIC(OFMethod*) *instanceMethods; /*! * The properties of the class. * * @warning **Do not rely on this, as this behaves differently depending on the * compiler and ABI used!** * * @warning For the ObjFW ABI, Clang only emits data for property introspection * if `@``synthesize` or `@``dynamic` has been used on the property, * not if the property has only been implemented by methods. Using * `@``synthesize` and manually implementing the methods works, * though. * * @warning For the Apple ABI, Clang and GCC both emit data for property * introspection for every property that has been declared using * `@``property`, even if no `@``synchronize` or `@``dynamic` has been * used. * * @warning GCC does not emit any data for property introspection for the GNU * ABI. */ @property (readonly, copy) OFArray OF_GENERIC(OFProperty*) *properties; /*! * The instance variables of the class. */ @property (readonly, copy) OFArray OF_GENERIC(OFInstanceVariable*) *instanceVariables; /* TODO: protocols */ /*! * @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_; @end OF_ASSUME_NONNULL_END |