home *** CD-ROM | disk | FTP | other *** search
- // EOKeySortOrdering.h
- //
- // Generic key-based sorting of object arrays
-
- #import <foundation/NSObject.h>
- #import <foundation/NSArray.h>
-
- // Key-based ordering specification (analogous to EOAttributeOrdering)
- @interface EOKeySortOrdering : NSObject
- {
- NSComparisonResult ordering; // NSOrderedAscending, NSOrderedSame, NSOrderedDescending
- NSString *key;
- }
-
- + keyOrderingWithKey:(NSString *)key ordering:(NSComparisonResult)ordering;
- // Convenience method to return an autoreleased EOKeySortOrdering.
-
- - initWithKey:(NSString *)key ordering:(NSComparisonResult) ordering;
- - (NSString *)key;
- - (NSComparisonResult)ordering;
- @end
-
- // Categories on Array for EO sorting
- @interface NSArray (EOKeyBasedSorting)
- - (NSArray *)sortedArrayUsingKeyOrderArray:(NSArray *)orderArray;
- // Returns a new array by sorting the objects of the receiver
- // according to the EOKeySortOrderings in orderArray.
- // The objects in the array are compared by extracting the
- // sort properties using the KeyValueCoding protocol and sending
- // them the compare: selector.
- // This method will raise if the objects corresponding to the
- // keys in the ordering array cannot be compared using the
- // selector compare:
- @end
-
- @interface NSMutableArray (EOKeyBasedSorting)
- - (void)sortUsingKeyOrderArray:(NSArray *)orderArray;
- @end
-
-