ObjFW  Diff

Differences From Artifact [cd6beb50c0]:

To Artifact [79c1692f33]:


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat: @"<%@: %@ [%s]>",
					   [self class], _name, _typeEncoding];
}

- (bool)isEqual: (id)object
{
	OFMethod *method;

	if (object == self)







|







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91

	[super dealloc];
}

- (OFString *)description
{
	return [OFString stringWithFormat: @"<%@: %@ [%s]>",
					   self.class, _name, _typeEncoding];
}

- (bool)isEqual: (id)object
{
	OFMethod *method;

	if (object == self)
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_HASH(hash, [_name hash]);

	if (_typeEncoding != NULL) {
		size_t length = strlen(_typeEncoding);

		for (size_t i = 0; i < length; i++)
			OF_HASH_ADD(hash, _typeEncoding[i]);
	}







|







115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_HASH(hash, _name.hash);

	if (_typeEncoding != NULL) {
		size_t length = strlen(_typeEncoding);

		for (size_t i = 0; i < length; i++)
			OF_HASH_ADD(hash, _typeEncoding[i]);
	}
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		const char *attributes;

		_name = [[OFString alloc]
		    initWithUTF8String: property_getName(property)];

		if ((attributes = property_getAttributes(property)) == NULL)
			@throw [OFInitializationFailedException
			    exceptionWithClass: [self class]];

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

			switch (*attributes) {
			case 'T':
				while (*attributes != ',' &&







|







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
		const char *attributes;

		_name = [[OFString alloc]
		    initWithUTF8String: property_getName(property)];

		if ((attributes = property_getAttributes(property)) == NULL)
			@throw [OFInitializationFailedException
			    exceptionWithClass: self.class];

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

			switch (*attributes) {
			case 'T':
				while (*attributes != ',' &&
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
				attributes++;
				break;
			case 'G':
				start = ++attributes;

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

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

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

				break;
			case 'S':
				start = ++attributes;

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

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

				_setter = [[OFString alloc]
				    initWithUTF8String: start







|















|







207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
				attributes++;
				break;
			case 'G':
				start = ++attributes;

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

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

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

				break;
			case 'S':
				start = ++attributes;

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

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

				_setter = [[OFString alloc]
				    initWithUTF8String: start
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
				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')
				@throw [OFInitializationFailedException
				    exceptionWithClass: [self class]];

			if (*attributes != '\0')
				attributes++;
		}

		if (!(_attributes & OF_PROPERTY_READONLY))
			_attributes |= OF_PROPERTY_READWRITE;







|












|




|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
				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')
				@throw [OFInitializationFailedException
				    exceptionWithClass: self.class];

			if (*attributes != '\0')
				attributes++;
		}

		if (!(_attributes & OF_PROPERTY_READONLY))
			_attributes |= OF_PROPERTY_READWRITE;
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
	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)







|
|







330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
	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)
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_HASH(hash, [_name hash]);
	OF_HASH_ADD(hash, (_attributes & 0xFF00) >> 8);
	OF_HASH_ADD(hash, _attributes & 0xFF);
	OF_HASH_ADD_HASH(hash, [_getter hash]);
	OF_HASH_ADD_HASH(hash, [_setter hash]);

	OF_HASH_FINALIZE(hash);

	return hash;
}
@end








|


|
|







364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382

- (uint32_t)hash
{
	uint32_t hash;

	OF_HASH_INIT(hash);

	OF_HASH_ADD_HASH(hash, _name.hash);
	OF_HASH_ADD(hash, (_attributes & 0xFF00) >> 8);
	OF_HASH_ADD(hash, _attributes & 0xFF);
	OF_HASH_ADD_HASH(hash, _getter.hash);
	OF_HASH_ADD_HASH(hash, _setter.hash);

	OF_HASH_FINALIZE(hash);

	return hash;
}
@end