mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Correct issues brought up by Fred K.
This commit is contained in:
parent
d66ad25b50
commit
268b2203c7
2 changed files with 66 additions and 5 deletions
|
@ -73,6 +73,9 @@ static SEL privateCountOfSel;
|
|||
}
|
||||
@end
|
||||
|
||||
@interface GSOrderedSetEnumeratorReverse : GSOrderedSetEnumerator
|
||||
@end
|
||||
|
||||
@implementation GSOrderedSetEnumerator
|
||||
- (id) initWithOrderedSet: (NSOrderedSet*)d
|
||||
{
|
||||
|
@ -104,6 +107,30 @@ static SEL privateCountOfSel;
|
|||
}
|
||||
@end
|
||||
|
||||
|
||||
@implementation GSOrderedSetEnumeratorReverse
|
||||
- (id) initWithOrderedSet: (GSOrderedSet*)d
|
||||
{
|
||||
self = [super initWithOrderedSet: d];
|
||||
if(self != nil)
|
||||
{
|
||||
current = GSIArrayCount(&set->array);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) nextObject
|
||||
{
|
||||
GSIArrayItem item;
|
||||
|
||||
if (current == 0)
|
||||
return nil;
|
||||
|
||||
item = GSIArrayItemAtIndex(&set->array, --current);
|
||||
return (id)(item.obj);
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation GSOrderedSet
|
||||
|
||||
static Class setClass;
|
||||
|
@ -145,6 +172,11 @@ static Class mutableSetClass;
|
|||
return AUTORELEASE([[GSOrderedSetEnumerator alloc] initWithOrderedSet: self]);
|
||||
}
|
||||
|
||||
- (NSEnumerator*) reverseObjectEnumerator
|
||||
{
|
||||
return AUTORELEASE([[GSOrderedSetEnumeratorReverse alloc] initWithOrderedSet: self]);
|
||||
}
|
||||
|
||||
- (NSUInteger) countByEnumeratingWithState: (NSFastEnumerationState*)state
|
||||
objects: (id*)stackbuf
|
||||
count: (NSUInteger)len
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue