ObjFW  Check-in [cc198764b7]

Overview
Comment:OFIntrospection: Fix property parsing on Apple RT
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: cc198764b7af0fc50478368a6024677c0cbd615346e781ff21bb5710af363d0b
User & Date: js on 2018-01-14 14:12:51
Other Links: manifest | tags
Context
2018-01-14
18:25
OFData: Add -[rangeOfData:options:range:] check-in: c85b63d2af user: js tags: trunk
14:12
OFIntrospection: Fix property parsing on Apple RT check-in: cc198764b7 user: js tags: trunk
13:30
OFHTTPServer: Fix _contentLength not being set check-in: a74b645cb2 user: js tags: trunk
Changes

Modified src/OFIntrospection.h from [c9d3b3d057] to [2c3e6c42ab].

71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 *
 * @brief A class for describing a property.
 */
@interface OFProperty: OFObject
{
	OFString *_name;
	unsigned int _attributes;
	OFString *_Nullable _getter, *_Nullable _setter;
}

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








|







71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
 *
 * @brief A class for describing a property.
 */
@interface OFProperty: OFObject
{
	OFString *_name;
	unsigned int _attributes;
	OFString *_Nullable _getter, *_Nullable _setter, *_Nullable iVar;
}

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

108
109
110
111
112
113
114





115
116
117
118
119
120
121
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *getter;

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






- (instancetype)init OF_UNAVAILABLE;
@end

/*!
 * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h
 *
 * @brief A class for describing an instance variable.







>
>
>
>
>







108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *getter;

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

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

- (instancetype)init OF_UNAVAILABLE;
@end

/*!
 * @class OFInstanceVariable OFIntrospection.h ObjFW/OFIntrospection.h
 *
 * @brief A class for describing an instance variable.

Modified src/OFIntrospection.m from [948865fcb1] to [e061b9b24d].

132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

	return hash;
}
@end

@implementation OFProperty
@synthesize name = _name, attributes = _attributes;
@synthesize getter = _getter, setter = _setter;

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

#if defined(OF_OBJFW_RUNTIME)







|







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146

	return hash;
}
@end

@implementation OFProperty
@synthesize name = _name, attributes = _attributes;
@synthesize getter = _getter, setter = _setter, iVar = _iVar;

- (instancetype)init
{
	OF_INVALID_INIT_METHOD
}

#if defined(OF_OBJFW_RUNTIME)
181
182
183
184
185
186
187





188
189
190
191
192
193
194
			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];

		while (*attributes != '\0') {
			const char *start;

			switch (*attributes) {





			case 'R':
				_attributes |= OF_PROPERTY_READONLY;
				attributes++;
				break;
			case 'C':
				_attributes |= OF_PROPERTY_COPY;
				attributes++;







>
>
>
>
>







181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];

		while (*attributes != '\0') {
			const char *start;

			switch (*attributes) {
			case 'T':
				while (*attributes != ',' &&
				    *attributes != '\0')
					attributes++;
				break;
			case 'R':
				_attributes |= OF_PROPERTY_READONLY;
				attributes++;
				break;
			case 'C':
				_attributes |= OF_PROPERTY_COPY;
				attributes++;
240
241
242
243
244
245
246
247

248




249
250
251





252
253
254
255
256
257
258
			case 'W':
				_attributes |= OF_PROPERTY_WEAK;
				attributes++;
				break;
			case 'P':
				attributes++;
				break;
			case 'T':

			case 't':




				while (*attributes != ',' &&
				    *attributes != '\0')
					attributes++;





				break;
			default:
				@throw [OFInitializationFailedException
				    exceptionWithClass: [self class]];
			}

			if (*attributes != ',' && *attributes != '\0')







|
>
|
>
>
>
>



>
>
>
>
>







245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
			case 'W':
				_attributes |= OF_PROPERTY_WEAK;
				attributes++;
				break;
			case 'P':
				attributes++;
				break;
			case 'V':
				start = ++attributes;

				if (_iVar != nil)
					@throw [OFInitializationFailedException
					    exceptionWithClass: [self class]];

				while (*attributes != ',' &&
				    *attributes != '\0')
					attributes++;

				_iVar = [[OFString alloc]
				    initWithUTF8String: start
						length: attributes - start];

				break;
			default:
				@throw [OFInitializationFailedException
				    exceptionWithClass: [self class]];
			}

			if (*attributes != ',' && *attributes != '\0')
313
314
315
316
317
318
319

320
321
322
323
324
325
326
327
328
329
- (OFString *)description
{
	return [OFString
	    stringWithFormat: @"<%@: %@\n"
			      @"\tAttributes = 0x%03X\n"
			      @"\tGetter = %@\n"
			      @"\tSetter = %@\n"

			      @">",
			      [self class], _name, _attributes,
			      _getter, _setter];
}

- (bool)isEqual: (id)object
{
	OFProperty *otherProperty;

	if (object == self)







>


|







328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
- (OFString *)description
{
	return [OFString
	    stringWithFormat: @"<%@: %@\n"
			      @"\tAttributes = 0x%03X\n"
			      @"\tGetter = %@\n"
			      @"\tSetter = %@\n"
			      @"\tiVar = %@\n"
			      @">",
			      [self class], _name, _attributes,
			      _getter, _setter, _iVar];
}

- (bool)isEqual: (id)object
{
	OFProperty *otherProperty;

	if (object == self)