ObjFW  Diff

Differences From Artifact [bc8548b155]:

To Artifact [07598bfdef]:

  • File src/OFIntrospection.h — part of check-in [0a73af49f0] at 2017-04-30 13:35:16 on branch trunk — Use nonatomic for properties and clean up

    This changes retaining behavior, meaning properties are not returned
    retained and autoreleased anymore, so a property returned from a getter
    now needs to be manually retained and autoreleased before calling the
    setter. However, this is rarely the case and not using atomic improves
    performance. (user: js, size: 5707) [annotate] [blame] [check-ins using]


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 * 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








|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 * The selector of the method.
 */
@property (readonly) SEL selector;

/*!
 * The name of the method.
 */
@property (readonly, nonatomic) OFString *name;

/*!
 * The type encoding for the method.
 */
@property OF_NULLABLE_PROPERTY (readonly) const char *typeEncoding;
@end

76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	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
 * ------------------------------|-------------------------------------







|







76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
	unsigned _attributes;
	OFString *_getter, *_setter;
}

/*!
 * The name of the property.
 */
@property (readonly, nonatomic) OFString *name;

/*!
 * The attributes of the property.
 *
 * The attributes are a bitmask with the following possible flags:@n
 * Flag                          | Description
 * ------------------------------|-------------------------------------
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
 * 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;

/*!







|




|

















|







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
 * OF_PROPERTY_DYNAMIC           | The property is dynamic
 */
@property (readonly) unsigned attributes;

/*!
 * The name of the getter.
 */
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *getter;

/*!
 * @return The name of the setter.
 */
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) 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, nonatomic) OFString *name;

/*!
 * The offset of the instance variable.
 */
@property (readonly) ptrdiff_t offset;

/*!
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	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!**
 *







|




|







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
	OFMutableArray OF_GENERIC(OFProperty*) *_properties;
	OFMutableArray OF_GENERIC(OFInstanceVariable*) *_instanceVariables;
}

/*!
 * The class methods of the class.
 */
@property (readonly, nonatomic) OFArray OF_GENERIC(OFMethod*) *classMethods;

/*!
 * The instance methods of the class.
 */
@property (readonly, nonatomic) 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!**
 *
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 *	    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.
 *







|




|







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 *	    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, nonatomic) OFArray OF_GENERIC(OFProperty*) *properties;

/*!
 * The instance variables of the class.
 */
@property (readonly, nonatomic)
    OFArray OF_GENERIC(OFInstanceVariable*) *instanceVariables;

/* TODO: protocols */

/*!
 * @brief Creates a new introspection for the specified class.
 *