From: Jay Freeman (saurik) Date: Tue, 1 Mar 2011 05:21:58 +0000 (-0800) Subject: Move WebScriptObject (NSFastEnumeration) to (Cyte). X-Git-Tag: v1.1.0%b1~99 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/5276ff21e3ed70bb2c65099fff053e7eac49a936 Move WebScriptObject (NSFastEnumeration) to (Cyte). --- diff --git a/CyteKit/WebScriptObject-Cyte.h b/CyteKit/WebScriptObject-Cyte.h index 6da0d8ca..d071ea66 100644 --- a/CyteKit/WebScriptObject-Cyte.h +++ b/CyteKit/WebScriptObject-Cyte.h @@ -44,6 +44,7 @@ @interface WebScriptObject (Cyte) - (NSUInteger) count; +- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count; - (id) objectAtIndex:(unsigned)index; @end diff --git a/CyteKit/WebScriptObject-Cyte.mm b/CyteKit/WebScriptObject-Cyte.mm index 9df6f85a..36b02dde 100644 --- a/CyteKit/WebScriptObject-Cyte.mm +++ b/CyteKit/WebScriptObject-Cyte.mm @@ -53,4 +53,17 @@ return [self webScriptValueAtIndex:index]; } +- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count { + size_t length([self count] - state->state); + if (length <= 0) + return 0; + else if (length > count) + length = count; + for (size_t i(0); i != length; ++i) + objects[i] = [self objectAtIndex:state->state++]; + state->itemsPtr = objects; + state->mutationsPtr = (unsigned long *) self; + return length; +} + @end diff --git a/MobileCydia.mm b/MobileCydia.mm index 15075414..132c31e9 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -588,23 +588,6 @@ void CFArrayInsertionSortValues(CFMutableArrayRef array, CFRange range, CFCompar @end -@implementation WebScriptObject (NSFastEnumeration) - -- (NSUInteger) countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)objects count:(NSUInteger)count { - size_t length([self count] - state->state); - if (length <= 0) - return 0; - else if (length > count) - length = count; - for (size_t i(0); i != length; ++i) - objects[i] = [self objectAtIndex:state->state++]; - state->itemsPtr = objects; - state->mutationsPtr = (unsigned long *) self; - return length; -} - -@end - NSUInteger DOMNodeList$countByEnumeratingWithState$objects$count$(DOMNodeList *self, SEL sel, NSFastEnumerationState *state, id *objects, NSUInteger count) { size_t length([self length] - state->state); if (length <= 0)