Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Renamed remove:

  • Loading branch information...
commit d743fb3f9b9b0d80673c3a7db2fb2efee6721612 1 parent ff834e9
Fjölnir Ásgeirsson authored
2  Source/Tranquil/Runtime/NSCollections+Tranquil.h
View
@@ -15,6 +15,8 @@
@interface NSPointerArray (Tranquil)
+ (NSPointerArray *)tq_pointerArrayWithObjects:(id)firstObject , ...; // Arguments terminated by TQNothing
- (void)setObject:(id)aPtr atIndexedSubscript:(NSUInteger)aIdx;
+- (void)removeObjectAtIndex:(NSUInteger)aIdx;
+- (id)removeObject:(id)aObj;
- (id)objectAtIndexedSubscript:(NSUInteger)aIdx;
- (TQNumber *)size;
- (TQNumber *)indexOf:(id)aObj;
13 Source/Tranquil/Runtime/NSCollections+Tranquil.m
View
@@ -199,9 +199,18 @@ - (id)insert:(id)aObj at:(TQNumber *)aIdx
return nil;
}
-- (id)remove:(TQNumber *)aIdx
+- (id)removeObject:(id)aObj
{
- [self removePointerAtIndex:[aIdx unsignedIntegerValue]];
+ NSMutableIndexSet *indices = [NSMutableIndexSet indexSet];
+ NSUInteger i = 0;
+ for(id obj in self) {
+ if(tq_msgSend_noBoxing(aObj, TQEqOpSel, obj))
+ [indices addIndex:i];
+ ++i;
+ }
+ [indices enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
+ [self removePointerAtIndex:idx];
+ }];
return nil;
}
Please sign in to comment.
Something went wrong with that request. Please try again.