| 1 |
/** Declaration of extension methods for base additions |
| 2 |
|
| 3 |
Copyright (C) 2003-2010 Free Software Foundation, Inc. |
| 4 |
|
| 5 |
Written by: Richard Frith-Macdonald <[email protected]> |
| 6 |
and: Adam Fedor <[email protected]> |
| 7 |
|
| 8 |
This file is part of the GNUstep Base Library. |
| 9 |
|
| 10 |
This library is free software; you can redistribute it and/or |
| 11 |
modify it under the terms of the GNU Lesser General Public |
| 12 |
License as published by the Free Software Foundation; either |
| 13 |
version 2 of the License, or (at your option) any later version. |
| 14 |
|
| 15 |
This library is distributed in the hope that it will be useful, |
| 16 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 |
Library General Public License for more details. |
| 19 |
|
| 20 |
You should have received a copy of the GNU Lesser General Public |
| 21 |
License along with this library; if not, write to the Free |
| 22 |
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 23 |
Boston, MA 02111 USA. |
| 24 |
|
| 25 |
*/ |
| 26 |
|
| 27 |
#ifndef INCLUDED_NSArray_GNUstepBase_h |
| 28 |
#define INCLUDED_NSArray_GNUstepBase_h |
| 29 |
|
| 30 |
#import "../GNUstepBase/GSVersionMacros.h" |
| 31 |
#import "../Foundation/NSArray.h" |
| 32 |
|
| 33 |
#if defined(__cplusplus) |
| 34 |
extern "C" { |
| 35 |
#endif |
| 36 |
|
| 37 |
#if OS_API_VERSION(GS_API_NONE,GS_API_LATEST) |
| 38 |
|
| 39 |
@interface NSArray (GNUstepBase) |
| 40 |
|
| 41 |
/** <p>Method for working with sorted arrays - use a binary chop |
| 42 |
* to determine the insertion location for an object. If equal objects |
| 43 |
* already exist in the array, they will be located immediately before |
| 44 |
* the insertion position. |
| 45 |
* </p> |
| 46 |
* <p>The comparator function takes two items as arguments, the first is the |
| 47 |
* item to be added, the second is the item already in the array. |
| 48 |
* The function should return NSOrderedAscending if the item to be |
| 49 |
* added is 'less than' the item in the array, NSOrderedDescending |
| 50 |
* if it is greater, and NSOrderedSame if it is equal. |
| 51 |
* </p> |
| 52 |
*/ |
| 53 |
- (NSUInteger) insertionPosition: (id)item |
| 54 |
usingFunction: (NSComparisonResult (*)(id, id, void *))sorter |
| 55 |
context: (void *)context; |
| 56 |
|
| 57 |
/* <p>Method for working with sorted arrays - use a binary chop |
| 58 |
* to determine the insertion location for an object. If equal objects |
| 59 |
* already exist in the array, they will be located immediately before |
| 60 |
* the insertion position. |
| 61 |
* </p> |
| 62 |
* <p>The selector identifies a method returning NSOrderedAscending if |
| 63 |
* the receiver is 'less than' the argument, and NSOrderedDescending if |
| 64 |
* it is greate. |
| 65 |
* </p> |
| 66 |
*/ |
| 67 |
- (NSUInteger) insertionPosition: (id)item |
| 68 |
usingSelector: (SEL)comp; |
| 69 |
@end |
| 70 |
|
| 71 |
#endif /* OS_API_VERSION */ |
| 72 |
|
| 73 |
#if defined(__cplusplus) |
| 74 |
} |
| 75 |
#endif |
| 76 |
|
| 77 |
#endif /* INCLUDED_NSArray_GNUstepBase_h */ |
| 78 |
|