Added missing Mac OS X 10.6 methods related to NSSortDescriptor

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37689 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Quentin Mathe 2014-02-14 13:02:41 +00:00
parent 95b7ba8812
commit bb9c1ea364
3 changed files with 63 additions and 0 deletions

View file

@ -121,6 +121,20 @@ static BOOL initialized = NO;
return _ascending + GSPrivateHash(0, sel, strlen(sel)) + [_key hash];
}
+ (id) sortDescriptorWithKey: (NSString *)aKey ascending: (BOOL)ascending
{
return AUTORELEASE([[self alloc] initWithKey: aKey ascending: ascending]);
}
+ (id) sortDescriptorWithKey: (NSString *)aKey
ascending: (BOOL)ascending
selector: (SEL)aSelector
{
return AUTORELEASE([[self alloc] initWithKey: aKey
ascending: ascending
selector: aSelector]);
}
- (id) initWithKey: (NSString *) key ascending: (BOOL) ascending
{
return [self initWithKey: key ascending: ascending selector: NULL];
@ -449,3 +463,13 @@ SortRange(id *objects, NSRange range, id *descriptors,
}
@end
@implementation NSSet (NSSortDescriptorSorting)
- (NSArray *) sortedArrayUsingDescriptors: (NSArray *)sortDescriptors
{
return [[self allObjects] sortedArrayUsingDescriptors: sortDescriptors];
}
@end