40 + (id)sortDescriptorWithKey:(
CPString)aKey ascending:(BOOL)isAscending
52 - (id)initWithKey:(
CPString)aKey ascending:(BOOL)isAscending
57 + (id)sortDescriptorWithKey:(
CPString)aKey ascending:(BOOL)isAscending selector:(
SEL)aSelector
69 - (id)initWithKey:(
CPString)aKey ascending:(BOOL)isAscending selector:(
SEL)aSelector
76 _ascending = isAscending;
77 _selector = aSelector;
115 - (CPComparisonResult)compareObject:(
id)lhsObject withObject:(
id)rhsObject
117 return (_ascending ? 1 : -1) * [[lhsObject valueForKeyPath:_key] performSelector:_selector withObject:[rhsObject valueForKeyPath:_key]];
124 - (id)reversedSortDescriptor
126 return [[[
self class] alloc] initWithKey:_key ascending:!_ascending selector:_selector];
132 [
self key], [
self ascending] ? @"ascending": @"descending", CPStringFromSelector([
self selector])];
145 if (
self = [super
init])
147 _key = [aCoder decodeObjectForKey:CPSortDescriptorKeyKey];
148 _ascending = [aCoder decodeBoolForKey:CPSortDescriptorAscendingKey];
157 [aCoder encodeObject:_key forKey:CPSortDescriptorKeyKey];
158 [aCoder encodeBool:_ascending forKey:CPSortDescriptorAscendingKey];
159 [aCoder encodeObject:CPStringFromSelector(_selector) forKey:CPSortDescriptorSelectorKey];
var CPSortDescriptorSelectorKey
function CPSelectorFromString(aSelectorName)
var CPSortDescriptorAscendingKey
An immutable string (collection of characters).
Holds attributes necessary to describe how to sort a set of objects.
id initWithKey:ascending:(CPString aKey, [ascending] BOOL isAscending)
var CPSortDescriptorKeyKey
Defines methods for use when archiving & restoring (enc/decoding).
id initWithKey:ascending:selector:(CPString aKey, [ascending] BOOL isAscending, [selector] SEL aSelector)
id stringWithFormat:(CPString format, [,] ...)
FrameUpdater prototype description