@@ -58,19 +58,17 @@ va_end(arguments); return ret; } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { return (id)[[OFMapTableSet alloc] initWithObjects: objects count: count]; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { return (id)[[OFMapTableSet alloc] initWithObject: firstObject arguments: arguments]; } @@ -140,12 +138,11 @@ va_end(arguments); return ret; } -+ (instancetype)setWithObjects: (id const *)objects - count: (size_t)count ++ (instancetype)setWithObjects: (id const *)objects count: (size_t)count { return [[[self alloc] initWithObjects: objects count: count] autorelease]; } @@ -173,12 +170,11 @@ - (instancetype)initWithArray: (OFArray *)array { OF_INVALID_INIT_METHOD } -- (instancetype)initWithObjects: (id const *)objects - count: (size_t)count +- (instancetype)initWithObjects: (id const *)objects count: (size_t)count { OF_INVALID_INIT_METHOD } - (instancetype)initWithObjects: (id)firstObject, ... @@ -185,19 +181,17 @@ { id ret; va_list arguments; va_start(arguments, firstObject); - ret = [self initWithObject: firstObject - arguments: arguments]; + ret = [self initWithObject: firstObject arguments: arguments]; va_end(arguments); return ret; } -- (instancetype)initWithObject: (id)firstObject - arguments: (va_list)arguments +- (instancetype)initWithObject: (id)firstObject arguments: (va_list)arguments { OF_INVALID_INIT_METHOD } - (instancetype)initWithSerialization: (OFXMLElement *)element @@ -229,16 +223,14 @@ [ret makeImmutable]; return ret; } -- (void)setValue: (id)value - forKey: (OFString *)key +- (void)setValue: (id)value forKey: (OFString *)key { for (id object in self) - [object setValue: value - forKey: key]; + [object setValue: value forKey: key]; } - (bool)containsObject: (id)object { OF_UNRECOGNIZED_SELECTOR @@ -247,11 +239,11 @@ - (OFEnumerator *)objectEnumerator { OF_UNRECOGNIZED_SELECTOR } -- (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state +- (int)countByEnumeratingWithState: (OFFastEnumerationState *)state objects: (id *)objects count: (int)count { OFEnumerator *enumerator; int i; @@ -331,14 +323,12 @@ if (++i < count) [ret appendString: @",\n"]; objc_autoreleasePoolPop(pool2); } - [ret replaceOccurrencesOfString: @"\n" - withString: @"\n\t"]; + [ret replaceOccurrencesOfString: @"\n" withString: @"\n\t"]; [ret appendString: @"\n)}"]; - [ret makeImmutable]; objc_autoreleasePoolPop(pool); return ret; @@ -377,20 +367,18 @@ void *pool = objc_autoreleasePoolPush(); OFXMLElement *element; if ([self isKindOfClass: [OFMutableSet class]]) element = [OFXMLElement elementWithName: @"OFMutableSet" - namespace: OF_SERIALIZATION_NS]; + namespace: OFSerializationNS]; else element = [OFXMLElement elementWithName: @"OFSet" - namespace: OF_SERIALIZATION_NS]; + namespace: OFSerializationNS]; for (id object in self) { void *pool2 = objc_autoreleasePoolPush(); - [element addChild: object.XMLElementBySerializing]; - objc_autoreleasePoolPop(pool2); } [element retain]; @@ -399,64 +387,50 @@ return [element autorelease]; } - (OFSet *)setBySubtractingSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new minusSet: set]; - [new makeImmutable]; - return new; } - (OFSet *)setByIntersectingWithSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new intersectSet: set]; - [new makeImmutable]; - return new; } - (OFSet *)setByAddingSet: (OFSet *)set { - OFMutableSet *new; - - new = [[self mutableCopy] autorelease]; + OFMutableSet *new = [[self mutableCopy] autorelease]; [new unionSet: set]; - [new makeImmutable]; - return new; } - (OFArray *)allObjects { void *pool = objc_autoreleasePoolPush(); OFArray *ret = [[[self objectEnumerator] allObjects] retain]; objc_autoreleasePoolPop(pool); - return [ret autorelease]; } - (id)anyObject { void *pool = objc_autoreleasePoolPush(); id ret = [[[self objectEnumerator] nextObject] retain]; objc_autoreleasePoolPop(pool); - return [ret autorelease]; } #ifdef OF_HAVE_BLOCKS -- (void)enumerateObjectsUsingBlock: (of_set_enumeration_block_t)block +- (void)enumerateObjectsUsingBlock: (OFSetEnumerationBlock)block { bool stop = false; for (id object in self) { block(object, &stop); @@ -464,11 +438,11 @@ if (stop) break; } } -- (OFSet *)filteredSetUsingBlock: (of_set_filter_block_t)block +- (OFSet *)filteredSetUsingBlock: (OFSetFilterBlock)block { OFMutableSet *ret = [OFMutableSet set]; [self enumerateObjectsUsingBlock: ^ (id object, bool *stop) { if (block(object))