home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / 3.3Headers / eoaccess / EOKeySortOrdering.h < prev    next >
Encoding:
Text File  |  1995-02-10  |  1.3 KB  |  40 lines

  1. // EOKeySortOrdering.h
  2. //
  3. // Generic key-based sorting of object arrays
  4.  
  5. #import <foundation/NSObject.h>
  6. #import <foundation/NSArray.h>
  7.  
  8. // Key-based ordering specification (analogous to EOAttributeOrdering)
  9. @interface EOKeySortOrdering : NSObject
  10. {
  11.     NSComparisonResult ordering; // NSOrderedAscending, NSOrderedSame, NSOrderedDescending
  12.     NSString *key;
  13. }
  14.  
  15. + keyOrderingWithKey:(NSString *)key ordering:(NSComparisonResult)ordering;
  16.     // Convenience method to return an autoreleased EOKeySortOrdering.
  17.  
  18. - initWithKey:(NSString *)key ordering:(NSComparisonResult) ordering;
  19. - (NSString *)key;
  20. - (NSComparisonResult)ordering;
  21. @end
  22.  
  23. // Categories on Array for EO sorting
  24. @interface NSArray (EOKeyBasedSorting)
  25. - (NSArray *)sortedArrayUsingKeyOrderArray:(NSArray *)orderArray;
  26.     // Returns a new array by sorting the objects of the receiver
  27.     // according to the EOKeySortOrderings in orderArray.
  28.     // The objects in the array are compared by extracting the
  29.     // sort properties using the KeyValueCoding protocol and sending
  30.     // them the compare: selector.
  31.     // This method will raise if the objects corresponding to the
  32.     // keys in the ordering array cannot be compared using the
  33.     // selector compare:
  34. @end
  35.  
  36. @interface NSMutableArray (EOKeyBasedSorting)
  37. - (void)sortUsingKeyOrderArray:(NSArray *)orderArray;
  38. @end
  39.  
  40.