mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-20 23:35:01 +00:00
Revert "Pulled @each out into a separate feature branch, so as to not conflict with the 0.8 work: http://github.com/280north/cappuccino/tree/@each ."
This reverts commit 7433c38d92.
This commit is contained in:
1 parent
d879b25458
commit
458481af4e
9 files changed
+509
No files matched your search
@@ -55,6 +55,11 @@
|
||||
return [_array objectAtIndex:_index];
|
||||
}
|
||||
|
||||
- (int)countByEnumeratingWithState:(id)aState objects:(id)objects count:(id)aCount
|
||||
{
|
||||
return [_array countByEnumeratingWithState:aState objects:objects count:aCount];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
/* @ignore */
|
||||
@@ -1206,6 +1211,31 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPArray (CPFastEnumeration)
|
||||
|
||||
- (int)countByEnumeratingWithState:(id)aState objects:(id)objects count:(id)aCount
|
||||
{
|
||||
var count = [self count],
|
||||
index = aState.state;
|
||||
|
||||
if (index >= count)
|
||||
return 0;
|
||||
|
||||
var indexIndex = 0,
|
||||
last = MIN(index + aCount, count);
|
||||
|
||||
aCount = last - index;
|
||||
|
||||
for (; index < last; ++index, ++indexIndex)
|
||||
objects[indexIndex] = [self objectAtIndex:index];
|
||||
|
||||
aState.state = last;
|
||||
|
||||
return aCount;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPArray (CPCoding)
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
|
||||
Reference in new issue
Block a user