ObjFW  Diff

Differences From Artifact [c4a3756934]:

To Artifact [35aae4e27a]:


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
274

275
276
277
278
279

280
281
282
283
284

285
286
287
288
289
290
291
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

274
275
276
277
278

279
280
281
282
283

284
285
286
287
288
289
290
291







-
+



















-
+




-
+




-
+








- (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (BOOL)containsObject: (id)object
- (bool)containsObject: (id)object
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (OFEnumerator*)objectEnumerator
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t*)state
			   objects: (id*)objects
			     count: (int)count
{
	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (BOOL)isEqual: (id)object
- (bool)isEqual: (id)object
{
	OFSet *otherSet;

	if (![object isKindOfClass: [OFSet class]])
		return NO;
		return false;

	otherSet = object;

	if ([otherSet count] != [self count])
		return NO;
		return false;

	return [otherSet isSubsetOfSet: self];
}

- (uint32_t)hash
{
	void *pool = objc_autoreleasePoolPush();
345
346
347
348
349
350
351
352

353
354
355
356
357
358
359
360
361
362

363
364
365
366
367
368

369
370
371

372
373
374
375
376
377
378
379
380
381

382
383
384
385
386
387

388
389
390
391
392
393
394
345
346
347
348
349
350
351

352
353
354
355
356
357
358
359
360
361

362
363
364
365
366
367

368
369
370

371
372
373
374
375
376
377
378
379
380

381
382
383
384
385
386

387
388
389
390
391
392
393
394







-
+









-
+





-
+


-
+









-
+





-
+







}

- mutableCopy
{
	return [[OFMutableSet alloc] initWithSet: self];
}

- (BOOL)isSubsetOfSet: (OFSet*)set
- (bool)isSubsetOfSet: (OFSet*)set
{
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *enumerator;
	id object;

	enumerator = [self objectEnumerator];
	while ((object = [enumerator nextObject]) != nil) {
		if (![set containsObject: object]) {
			objc_autoreleasePoolPop(pool);
			return NO;
			return false;
		}
	}

	objc_autoreleasePoolPop(pool);

	return YES;
	return true;
}

- (BOOL)intersectsSet: (OFSet*)set
- (bool)intersectsSet: (OFSet*)set
{
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *enumerator;
	id object;

	enumerator = [self objectEnumerator];
	while ((object = [enumerator nextObject]) != nil) {
		if ([set containsObject: object]) {
			objc_autoreleasePoolPop(pool);
			return YES;
			return true;
		}
	}

	objc_autoreleasePoolPop(pool);

	return NO;
	return false;
}

- (OFXMLElement*)XMLElementBySerializing
{
	void *pool = objc_autoreleasePoolPush();
	OFXMLElement *element;
	OFEnumerator *enumerator;
453
454
455
456
457
458
459
460

461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476

477
478
479
480
481
482
483
484
485
486
453
454
455
456
457
458
459

460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475

476
477
478
479
480
481
482
483
484
485
486







-
+















-
+











	return new;
}

#if defined(OF_HAVE_BLOCKS) && defined(OF_HAVE_FAST_ENUMERATION)
- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block
{
	BOOL stop = NO;
	bool stop = false;

	for (id object in self) {
		block(object, &stop);

		if (stop)
			break;
	}
}
#endif

#ifdef OF_HAVE_BLOCKS
- (OFSet*)filteredSetUsingBlock: (of_set_filter_block_t)block
{
	OFMutableSet *ret = [OFMutableSet set];

	[self enumerateObjectsUsingBlock: ^ (id object, BOOL *stop) {
	[self enumerateObjectsUsingBlock: ^ (id object, bool *stop) {
		if (block(object))
			[ret addObject: object];
	}];

	[ret makeImmutable];

	return ret;
}
#endif
@end