mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: Make sure we handle undefined when testing for nil values (#2862)
This commit is contained in:
@@ -271,7 +271,7 @@
|
|||||||
if (_disableSetContent)
|
if (_disableSetContent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
value = [];
|
value = [];
|
||||||
|
|
||||||
if (![value isKindOfClass:[CPArray class]])
|
if (![value isKindOfClass:[CPArray class]])
|
||||||
@@ -754,7 +754,7 @@
|
|||||||
_filterPredicate = nil;
|
_filterPredicate = nil;
|
||||||
[self _rearrangeObjects];
|
[self _rearrangeObjects];
|
||||||
}
|
}
|
||||||
else if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
|
else if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
|
||||||
{
|
{
|
||||||
// Insert directly into the array.
|
// Insert directly into the array.
|
||||||
var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors];
|
var pos = [_arrangedObjects insertObject:object inArraySortedByDescriptors:_sortDescriptors];
|
||||||
@@ -767,7 +767,7 @@
|
|||||||
[_selectionIndexes shiftIndexesStartingAtIndex:pos by:1];
|
[_selectionIndexes shiftIndexesStartingAtIndex:pos by:1];
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
else if (_filterPredicate !== nil)
|
else if (_filterPredicate != nil)
|
||||||
...
|
...
|
||||||
// Implies _filterPredicate && ![_filterPredicate evaluateWithObject:object], so the new object does
|
// Implies _filterPredicate && ![_filterPredicate evaluateWithObject:object], so the new object does
|
||||||
// not appear in arrangedObjects and we do not have to update at all.
|
// not appear in arrangedObjects and we do not have to update at all.
|
||||||
@@ -867,7 +867,7 @@
|
|||||||
|
|
||||||
_disableSetContent = NO;
|
_disableSetContent = NO;
|
||||||
|
|
||||||
if (_filterPredicate === nil || [_filterPredicate evaluateWithObject:object])
|
if (_filterPredicate == nil || [_filterPredicate evaluateWithObject:object])
|
||||||
{
|
{
|
||||||
// selectionIndexes change notification will be fired as a result of the
|
// selectionIndexes change notification will be fired as a result of the
|
||||||
// content change. Don't fire manually.
|
// content change. Don't fire manually.
|
||||||
|
|||||||
+1
-1
@@ -807,7 +807,7 @@ CPButtonImageOffset = 3.0;
|
|||||||
{
|
{
|
||||||
var selfWindow = [self window];
|
var selfWindow = [self window];
|
||||||
|
|
||||||
if (selfWindow === aWindow || aWindow === nil)
|
if (selfWindow === aWindow || aWindow == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([selfWindow defaultButton] === self)
|
if ([selfWindow defaultButton] === self)
|
||||||
|
|||||||
@@ -739,7 +739,7 @@ var HORIZONTAL_MARGIN = 2;
|
|||||||
*/
|
*/
|
||||||
- (void)setMinItemSize:(CGSize)aSize
|
- (void)setMinItemSize:(CGSize)aSize
|
||||||
{
|
{
|
||||||
if (aSize === nil || aSize === undefined)
|
if (aSize == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:"Invalid value provided for minimum size"];
|
[CPException raise:CPInvalidArgumentException reason:"Invalid value provided for minimum size"];
|
||||||
|
|
||||||
if (CGSizeEqualToSize(_minItemSize, aSize))
|
if (CGSizeEqualToSize(_minItemSize, aSize))
|
||||||
|
|||||||
+1
-1
@@ -564,7 +564,7 @@ var CPComboBoxTextSubview = @"text",
|
|||||||
|
|
||||||
var selectedStringValue = [_listDelegate selectedStringValue];
|
var selectedStringValue = [_listDelegate selectedStringValue];
|
||||||
|
|
||||||
if (selectedStringValue === nil)
|
if (selectedStringValue == nil)
|
||||||
return NO;
|
return NO;
|
||||||
else
|
else
|
||||||
_selectedStringValue = selectedStringValue;
|
_selectedStringValue = selectedStringValue;
|
||||||
|
|||||||
+8
-8
@@ -622,15 +622,15 @@ var CPControlBlackColor = [CPColor blackColor];
|
|||||||
*/
|
*/
|
||||||
- (CPString)stringValue
|
- (CPString)stringValue
|
||||||
{
|
{
|
||||||
if (_formatter && _value !== undefined)
|
if (_formatter && _value != nil)
|
||||||
{
|
{
|
||||||
var formattedValue = [self hasThemeState:CPThemeStateEditing] ? [_formatter editingStringForObjectValue:_value] : [_formatter stringForObjectValue:_value];
|
var formattedValue = [self hasThemeState:CPThemeStateEditing] ? [_formatter editingStringForObjectValue:_value] : [_formatter stringForObjectValue:_value];
|
||||||
|
|
||||||
if (formattedValue !== nil && formattedValue !== undefined)
|
if (formattedValue != nil)
|
||||||
return formattedValue;
|
return formattedValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (_value === undefined || _value === nil) ? @"" : String(_value);
|
return _value == nil ? @"" : String(_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -639,7 +639,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
|||||||
- (void)setStringValue:(CPString)aString
|
- (void)setStringValue:(CPString)aString
|
||||||
{
|
{
|
||||||
// Cocoa raises an invalid parameter assertion and returns if you pass nil.
|
// Cocoa raises an invalid parameter assertion and returns if you pass nil.
|
||||||
if (aString === nil || aString === undefined)
|
if (aString == nil)
|
||||||
{
|
{
|
||||||
CPLog.warn("nil or undefined sent to CPControl -setStringValue");
|
CPLog.warn("nil or undefined sent to CPControl -setStringValue");
|
||||||
return;
|
return;
|
||||||
@@ -1137,18 +1137,18 @@ var CPControlActionKey = @"CPControlActionKey",
|
|||||||
|
|
||||||
var objectValue = [self objectValue];
|
var objectValue = [self objectValue];
|
||||||
|
|
||||||
if (objectValue !== nil)
|
if (objectValue != nil)
|
||||||
[aCoder encodeObject:objectValue forKey:CPControlValueKey];
|
[aCoder encodeObject:objectValue forKey:CPControlValueKey];
|
||||||
|
|
||||||
if (_target !== nil)
|
if (_target != nil)
|
||||||
[aCoder encodeConditionalObject:_target forKey:CPControlTargetKey];
|
[aCoder encodeConditionalObject:_target forKey:CPControlTargetKey];
|
||||||
|
|
||||||
if (_action !== nil)
|
if (_action != nil)
|
||||||
[aCoder encodeObject:_action forKey:CPControlActionKey];
|
[aCoder encodeObject:_action forKey:CPControlActionKey];
|
||||||
|
|
||||||
[aCoder encodeInt:_sendActionOn forKey:CPControlSendActionOnKey];
|
[aCoder encodeInt:_sendActionOn forKey:CPControlSendActionOnKey];
|
||||||
|
|
||||||
if (_formatter !== nil)
|
if (_formatter != nil)
|
||||||
[aCoder encodeObject:_formatter forKey:CPControlFormatterKey];
|
[aCoder encodeObject:_formatter forKey:CPControlFormatterKey];
|
||||||
|
|
||||||
[aCoder encodeInt:_controlSize forKey:CPControlControlSizeKey];
|
[aCoder encodeInt:_controlSize forKey:CPControlControlSizeKey];
|
||||||
|
|||||||
@@ -69,7 +69,7 @@
|
|||||||
aNewObject._controller = self;
|
aNewObject._controller = self;
|
||||||
aNewObject._key = aKey;
|
aNewObject._key = aKey;
|
||||||
|
|
||||||
if (aValue !== nil)
|
if (aValue != nil)
|
||||||
[aNewObject setValue:aValue];
|
[aNewObject setValue:aValue];
|
||||||
|
|
||||||
return aNewObject;
|
return aNewObject;
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
var iter = [[CPSet setWithArray:allKeys] objectEnumerator],
|
var iter = [[CPSet setWithArray:allKeys] objectEnumerator],
|
||||||
obj;
|
obj;
|
||||||
|
|
||||||
while ((obj = [iter nextObject]) !== nil)
|
while ((obj = [iter nextObject]) != nil)
|
||||||
if (![_excludedKeys containsObject:obj])
|
if (![_excludedKeys containsObject:obj])
|
||||||
[array addObject:[self _newObjectWithKey:obj value:nil]];
|
[array addObject:[self _newObjectWithKey:obj value:nil]];
|
||||||
|
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ var CPSharedDocumentController = nil;
|
|||||||
var iter = [_documents objectEnumerator],
|
var iter = [_documents objectEnumerator],
|
||||||
obj;
|
obj;
|
||||||
|
|
||||||
while ((obj = [iter nextObject]) !== nil)
|
while ((obj = [iter nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([obj isDocumentEdited])
|
if ([obj isDocumentEdited])
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
+1
-1
@@ -608,7 +608,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
|||||||
*/
|
*/
|
||||||
+ (void)stopPeriodicEvents
|
+ (void)stopPeriodicEvents
|
||||||
{
|
{
|
||||||
if (_CPEventPeriodicEventTimer === nil)
|
if (_CPEventPeriodicEventTimer == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
window.clearTimeout(_CPEventPeriodicEventTimer);
|
window.clearTimeout(_CPEventPeriodicEventTimer);
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
|
|||||||
var enumerator = [_params keyEnumerator],
|
var enumerator = [_params keyEnumerator],
|
||||||
key;
|
key;
|
||||||
|
|
||||||
while (_DOMObjectElement && (key = [enumerator nextObject]) !== nil)
|
while (_DOMObjectElement && (key = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var param = document.createElement(@"param");
|
var param = document.createElement(@"param");
|
||||||
param.name = key;
|
param.name = key;
|
||||||
@@ -177,7 +177,7 @@ var IEFlashCLSID = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";
|
|||||||
paramEnumerator = [_params keyEnumerator],
|
paramEnumerator = [_params keyEnumerator],
|
||||||
key;
|
key;
|
||||||
|
|
||||||
while ((key = [paramEnumerator nextObject]) !== nil)
|
while ((key = [paramEnumerator nextObject]) != nil)
|
||||||
paramString = [paramString stringByAppendingFormat:@"<param name='%@' value='%@' />", key, [_params objectForKey:key]];
|
paramString = [paramString stringByAppendingFormat:@"<param name='%@' value='%@' />", key, [_params objectForKey:key]];
|
||||||
|
|
||||||
_DOMObjectElement = document.createElement(@"object");
|
_DOMObjectElement = document.createElement(@"object");
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ CPRemoveTraitFontAction = 7;
|
|||||||
- (@action)addFontTrait:(id)sender
|
- (@action)addFontTrait:(id)sender
|
||||||
{
|
{
|
||||||
var tag = [sender tag];
|
var tag = [sender tag];
|
||||||
_activeChange = tag === nil ? @{} : @{ @"addTraits": tag };
|
_activeChange = tag == nil ? @{} : @{ @"addTraits": tag };
|
||||||
_fontAction = CPAddTraitFontAction;
|
_fontAction = CPAddTraitFontAction;
|
||||||
|
|
||||||
[self sendAction];
|
[self sendAction];
|
||||||
|
|||||||
+2
-2
@@ -85,7 +85,7 @@ function CPImageInBundle()
|
|||||||
|
|
||||||
if (typeof(arguments[1]) === "number")
|
if (typeof(arguments[1]) === "number")
|
||||||
{
|
{
|
||||||
if (arguments[1] !== nil && arguments[1] !== undefined)
|
if (arguments[1] != nil)
|
||||||
size = CGSizeMake(arguments[1], arguments[2]);
|
size = CGSizeMake(arguments[1], arguments[2]);
|
||||||
|
|
||||||
bundle = arguments[3];
|
bundle = arguments[3];
|
||||||
@@ -161,7 +161,7 @@ function CPAppKitImage(aFilename, aSize)
|
|||||||
- (id)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
|
- (id)initByReferencingFile:(CPString)aFilename size:(CGSize)aSize
|
||||||
{
|
{
|
||||||
// Quietly return nil like in Cocoa, rather than crashing later.
|
// Quietly return nil like in Cocoa, rather than crashing later.
|
||||||
if (aFilename === undefined || aFilename === nil)
|
if (aFilename == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ var CPBindingOperationAnd = 0,
|
|||||||
// If the value is nil AND the source doesn't respond to setPlaceholderString: then
|
// If the value is nil AND the source doesn't respond to setPlaceholderString: then
|
||||||
// we set the value to the placeholder. Otherwise, we do not want to short cut the process
|
// we set the value to the placeholder. Otherwise, we do not want to short cut the process
|
||||||
// of setting the placeholder that is based on the fact that the value is nil.
|
// of setting the placeholder that is based on the fact that the value is nil.
|
||||||
if ((aValue === undefined || aValue === nil || aValue === [CPNull null])
|
if ((aValue == nil || aValue === [CPNull null])
|
||||||
&& ![_source respondsToSelector:@selector(setPlaceholderString:)])
|
&& ![_source respondsToSelector:@selector(setPlaceholderString:)])
|
||||||
aValue = [options objectForKey:CPNullPlaceholderBindingOption] || nil;
|
aValue = [options objectForKey:CPNullPlaceholderBindingOption] || nil;
|
||||||
|
|
||||||
@@ -653,7 +653,7 @@ var CPBindingOperationAnd = 0,
|
|||||||
keyPath = [info objectForKey:CPObservedKeyPathKey],
|
keyPath = [info objectForKey:CPObservedKeyPathKey],
|
||||||
value = [object valueForKeyPath:keyPath];
|
value = [object valueForKeyPath:keyPath];
|
||||||
|
|
||||||
if (value === nil || value === undefined)
|
if (value == nil)
|
||||||
{
|
{
|
||||||
[_source setEnabled:NO];
|
[_source setEnabled:NO];
|
||||||
return;
|
return;
|
||||||
@@ -796,7 +796,7 @@ var CPBindingOperationAnd = 0,
|
|||||||
else
|
else
|
||||||
value = [theBinding transformValue:value withOptions:options];
|
value = [theBinding transformValue:value withOptions:options];
|
||||||
|
|
||||||
if (value === nil || value === undefined)
|
if (value == nil)
|
||||||
value = @"";
|
value = @"";
|
||||||
|
|
||||||
result.value = result.value.replace("%{" + _patternPlaceholder + count + "}@", [value description]);
|
result.value = result.value.replace("%{" + _patternPlaceholder + count + "}@", [value description]);
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ var _CPMenuBarVisible = NO,
|
|||||||
|
|
||||||
+ (void)_setOrRemoveMenuBarAttribute:(id)aValue forKey:(id)aKey
|
+ (void)_setOrRemoveMenuBarAttribute:(id)aValue forKey:(id)aKey
|
||||||
{
|
{
|
||||||
if (aValue === nil)
|
if (aValue == nil)
|
||||||
[_CPMenuBarAttributes removeObjectForKey:aKey];
|
[_CPMenuBarAttributes removeObjectForKey:aKey];
|
||||||
else
|
else
|
||||||
[_CPMenuBarAttributes setObject:aValue forKey:aKey];
|
[_CPMenuBarAttributes setObject:aValue forKey:aKey];
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ var STICKY_TIME_INTERVAL = 0.4,
|
|||||||
var iter = [selectorNames objectEnumerator],
|
var iter = [selectorNames objectEnumerator],
|
||||||
obj;
|
obj;
|
||||||
|
|
||||||
while ((obj = [iter nextObject]) !== nil)
|
while ((obj = [iter nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var aSelector = CPSelectorFromString(obj);
|
var aSelector = CPSelectorFromString(obj);
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ var STICKY_TIME_INTERVAL = 0.4,
|
|||||||
var iter = [[menu itemArray] objectEnumerator],
|
var iter = [[menu itemArray] objectEnumerator],
|
||||||
obj;
|
obj;
|
||||||
|
|
||||||
while ((obj = [iter nextObject]) !== nil)
|
while ((obj = [iter nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([obj isHidden] || ![obj isEnabled])
|
if ([obj isHidden] || ![obj isEnabled])
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -384,7 +384,7 @@
|
|||||||
*/
|
*/
|
||||||
- (void)_selectionDidChange
|
- (void)_selectionDidChange
|
||||||
{
|
{
|
||||||
if (_selection === undefined || _selection === nil)
|
if (_selection == nil)
|
||||||
_selection = [[CPControllerSelectionProxy alloc] initWithController:self];
|
_selection = [[CPControllerSelectionProxy alloc] initWithController:self];
|
||||||
|
|
||||||
[_selection controllerDidChange];
|
[_selection controllerDidChange];
|
||||||
@@ -770,7 +770,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value === nil || value.isa && [value isEqual:[CPNull null]])
|
if (value == nil || value.isa && [value isEqual:[CPNull null]])
|
||||||
value = CPNullMarker;
|
value = CPNullMarker;
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -1438,7 +1438,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
|||||||
_shouldRetargetChildIndex = YES;
|
_shouldRetargetChildIndex = YES;
|
||||||
|
|
||||||
// set CPTableView's _retargetedDropRow based on retargetedItem and retargetedChildIndex
|
// set CPTableView's _retargetedDropRow based on retargetedItem and retargetedChildIndex
|
||||||
var retargetedItemInfo = (_retargetedItem !== nil) ? _itemInfosForItems[[_retargetedItem UID]] : _rootItemInfo;
|
var retargetedItemInfo = (_retargetedItem != nil) ? _itemInfosForItems[[_retargetedItem UID]] : _rootItemInfo;
|
||||||
|
|
||||||
if (_retargedChildIndex === [retargetedItemInfo.children count])
|
if (_retargedChildIndex === [retargetedItemInfo.children count])
|
||||||
{
|
{
|
||||||
@@ -1940,7 +1940,7 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
|
|||||||
if (theDropOperation === CPTableViewDropAbove)
|
if (theDropOperation === CPTableViewDropAbove)
|
||||||
{
|
{
|
||||||
var parentItem = [_outlineView _parentItemForUpperRow:theRow - 1 andLowerRow:theRow atMouseOffset:theOffset],
|
var parentItem = [_outlineView _parentItemForUpperRow:theRow - 1 andLowerRow:theRow atMouseOffset:theOffset],
|
||||||
itemInfo = (parentItem !== nil) ? _outlineView._itemInfosForItems[[parentItem UID]] : _outlineView._rootItemInfo,
|
itemInfo = (parentItem != nil) ? _outlineView._itemInfosForItems[[parentItem UID]] : _outlineView._rootItemInfo,
|
||||||
children = itemInfo.children;
|
children = itemInfo.children;
|
||||||
|
|
||||||
childIndex = [children indexOfObject:[_outlineView itemAtRow:theRow]];
|
childIndex = [children indexOfObject:[_outlineView itemAtRow:theRow]];
|
||||||
|
|||||||
@@ -397,7 +397,7 @@ var CPResponderNextResponderKey = @"CPResponderNextResponderKey",
|
|||||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||||
{
|
{
|
||||||
// This will come out nil on the other side with decodeObjectForKey:
|
// This will come out nil on the other side with decodeObjectForKey:
|
||||||
if (_nextResponder !== nil)
|
if (_nextResponder != nil)
|
||||||
[aCoder encodeConditionalObject:_nextResponder forKey:CPResponderNextResponderKey];
|
[aCoder encodeConditionalObject:_nextResponder forKey:CPResponderNextResponderKey];
|
||||||
|
|
||||||
[aCoder encodeObject:_menu forKey:CPResponderMenuKey];
|
[aCoder encodeObject:_menu forKey:CPResponderMenuKey];
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
|||||||
- (id)initWithFrame:(CGRect)frame
|
- (id)initWithFrame:(CGRect)frame
|
||||||
{
|
{
|
||||||
self = [super initWithFrame:frame];
|
self = [super initWithFrame:frame];
|
||||||
if (self !== nil)
|
if (self)
|
||||||
{
|
{
|
||||||
_slices = [[CPMutableArray alloc] init];
|
_slices = [[CPMutableArray alloc] init];
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
|||||||
*/
|
*/
|
||||||
- (void)setFormattingStringsFilename:(CPString)stringsFilename
|
- (void)setFormattingStringsFilename:(CPString)stringsFilename
|
||||||
{
|
{
|
||||||
if (_standardLocalizer === nil)
|
if (_standardLocalizer == nil)
|
||||||
_standardLocalizer = [_CPRuleEditorLocalizer new];
|
_standardLocalizer = [_CPRuleEditorLocalizer new];
|
||||||
|
|
||||||
if (_stringsFilename !== stringsFilename)
|
if (_stringsFilename !== stringsFilename)
|
||||||
@@ -427,14 +427,14 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
|||||||
// Convert an empty string to nil
|
// Convert an empty string to nil
|
||||||
_stringsFilename = stringsFilename || nil;
|
_stringsFilename = stringsFilename || nil;
|
||||||
|
|
||||||
if (stringsFilename !== nil)
|
if (stringsFilename != nil)
|
||||||
{
|
{
|
||||||
if (![stringsFilename hasSuffix:@".strings"])
|
if (![stringsFilename hasSuffix:@".strings"])
|
||||||
stringsFilename = stringsFilename + @".strings";
|
stringsFilename = stringsFilename + @".strings";
|
||||||
|
|
||||||
var path = [[CPBundle mainBundle] pathForResource:stringsFilename];
|
var path = [[CPBundle mainBundle] pathForResource:stringsFilename];
|
||||||
|
|
||||||
if (path !== nil)
|
if (path != nil)
|
||||||
[_standardLocalizer loadContentOfURL:[CPURL URLWithString:path]];
|
[_standardLocalizer loadContentOfURL:[CPURL URLWithString:path]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ var CPRuleEditorItemPBoardType = @"CPRuleEditorItemPBoardType",
|
|||||||
*/
|
*/
|
||||||
- (void)setCriteria:(CPArray)criteria andDisplayValues:(CPArray)values forRowAtIndex:(int)rowIndex
|
- (void)setCriteria:(CPArray)criteria andDisplayValues:(CPArray)values forRowAtIndex:(int)rowIndex
|
||||||
{
|
{
|
||||||
if (criteria === nil || values === nil)
|
if (criteria == nil || values == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:_cmd + @". criteria and values parameters must not be nil."];
|
[CPException raise:CPInvalidArgumentException reason:_cmd + @". criteria and values parameters must not be nil."];
|
||||||
|
|
||||||
if (rowIndex < 0 || rowIndex >= [self numberOfRows])
|
if (rowIndex < 0 || rowIndex >= [self numberOfRows])
|
||||||
@@ -852,7 +852,7 @@ TODO: implement
|
|||||||
while (current_index !== CPNotFound)
|
while (current_index !== CPNotFound)
|
||||||
{
|
{
|
||||||
var subpredicate = [self predicateForRow:current_index];
|
var subpredicate = [self predicateForRow:current_index];
|
||||||
if (subpredicate !== nil)
|
if (subpredicate != nil)
|
||||||
[subpredicates addObject:subpredicate];
|
[subpredicates addObject:subpredicate];
|
||||||
|
|
||||||
current_index = [subrowsIndexes indexGreaterThanIndex:current_index];
|
current_index = [subrowsIndexes indexGreaterThanIndex:current_index];
|
||||||
@@ -888,33 +888,33 @@ TODO: implement
|
|||||||
modifier = [predicateParts objectForKey:CPRuleEditorPredicateComparisonModifier],
|
modifier = [predicateParts objectForKey:CPRuleEditorPredicateComparisonModifier],
|
||||||
selector = CPSelectorFromString([predicateParts objectForKey:CPRuleEditorPredicateCustomSelector]);
|
selector = CPSelectorFromString([predicateParts objectForKey:CPRuleEditorPredicateCustomSelector]);
|
||||||
|
|
||||||
if (lhs === nil)
|
if (lhs == nil)
|
||||||
{
|
{
|
||||||
CPLogConsole(@"missing left expression in predicate parts dictionary");
|
CPLogConsole(@"missing left expression in predicate parts dictionary");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rhs === nil)
|
if (rhs == nil)
|
||||||
{
|
{
|
||||||
CPLogConsole(@"missing right expression in predicate parts dictionary");
|
CPLogConsole(@"missing right expression in predicate parts dictionary");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selector === nil && operator === nil)
|
if (selector == nil && operator == nil)
|
||||||
{
|
{
|
||||||
CPLogConsole(@"missing operator and selector in predicate parts dictionary");
|
CPLogConsole(@"missing operator and selector in predicate parts dictionary");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modifier === nil)
|
if (modifier == nil)
|
||||||
CPLogConsole(@"missing modifier in predicate parts dictionary. Setting default: CPDirectPredicateModifier");
|
CPLogConsole(@"missing modifier in predicate parts dictionary. Setting default: CPDirectPredicateModifier");
|
||||||
|
|
||||||
if (options === nil)
|
if (options == nil)
|
||||||
CPLogConsole(@"missing options in predicate parts dictionary. Setting default: CPCaseInsensitivePredicateOption");
|
CPLogConsole(@"missing options in predicate parts dictionary. Setting default: CPCaseInsensitivePredicateOption");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (selector !== nil)
|
if (selector != nil)
|
||||||
predicate = [CPComparisonPredicate predicateWithLeftExpression:lhs
|
predicate = [CPComparisonPredicate predicateWithLeftExpression:lhs
|
||||||
rightExpression:rhs
|
rightExpression:rhs
|
||||||
customSelector:selector
|
customSelector:selector
|
||||||
@@ -1167,7 +1167,7 @@ TODO: implement
|
|||||||
|
|
||||||
- (BOOL)_wantsRowAnimations
|
- (BOOL)_wantsRowAnimations
|
||||||
{
|
{
|
||||||
return (_currentAnimation !== nil);
|
return (_currentAnimation != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_updateButtonVisibilities
|
- (void)_updateButtonVisibilities
|
||||||
@@ -1753,7 +1753,7 @@ TODO: implement
|
|||||||
{
|
{
|
||||||
var subpredicate = [self predicateForRow:current_index];
|
var subpredicate = [self predicateForRow:current_index];
|
||||||
|
|
||||||
if (subpredicate !== nil)
|
if (subpredicate != nil)
|
||||||
[subpredicates addObject:subpredicate];
|
[subpredicates addObject:subpredicate];
|
||||||
|
|
||||||
current_index = [subindexes indexGreaterThanIndex:current_index];
|
current_index = [subindexes indexGreaterThanIndex:current_index];
|
||||||
@@ -1795,7 +1795,7 @@ TODO: implement
|
|||||||
startRect = [aslice frame],
|
startRect = [aslice frame],
|
||||||
startIndex = [aslice rowIndex] - 1;
|
startIndex = [aslice rowIndex] - 1;
|
||||||
|
|
||||||
if ([aslice superview] === nil)
|
if ([aslice superview] == nil)
|
||||||
{
|
{
|
||||||
startRect = CGRectMake(0, startIndex * _sliceHeight, CGRectGetWidth(startRect), _sliceHeight);
|
startRect = CGRectMake(0, startIndex * _sliceHeight, CGRectGetWidth(startRect), _sliceHeight);
|
||||||
[aslice _reconfigureSubviews];
|
[aslice _reconfigureSubviews];
|
||||||
@@ -2129,7 +2129,7 @@ TODO: implement
|
|||||||
|
|
||||||
- (BOOL)_dragShouldBeginFromMouseDown:(CPView)view
|
- (BOOL)_dragShouldBeginFromMouseDown:(CPView)view
|
||||||
{
|
{
|
||||||
return (([self nestingMode] === CPRuleEditorNestingModeList || [view rowIndex] !== 0) && _editable && [view isKindOfClass:[_CPRuleEditorViewSliceRow class]] && _draggingRows === nil);
|
return (([self nestingMode] === CPRuleEditorNestingModeList || [view rowIndex] !== 0) && _editable && [view isKindOfClass:[_CPRuleEditorViewSliceRow class]] && _draggingRows == nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)_performDragForSlice:(id)slice withEvent:(CPEvent)event
|
- (BOOL)_performDragForSlice:(id)slice withEvent:(CPEvent)event
|
||||||
@@ -2321,7 +2321,7 @@ TODO: implement
|
|||||||
|
|
||||||
- (void)_postRowCountChangedNotificationOfType:(CPString)notificationName indexes:indexes
|
- (void)_postRowCountChangedNotificationOfType:(CPString)notificationName indexes:indexes
|
||||||
{
|
{
|
||||||
var userInfo = indexes === nil ? @{} : @{ "indexes": indexes };
|
var userInfo = indexes == nil ? @{} : @{ "indexes": indexes };
|
||||||
[[CPNotificationCenter defaultCenter] postNotificationName:notificationName object:self userInfo:userInfo];
|
[[CPNotificationCenter defaultCenter] postNotificationName:notificationName object:self userInfo:userInfo];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2386,7 +2386,7 @@ TODO: implement
|
|||||||
var criteria = [self criteriaForRow:aRow];
|
var criteria = [self criteriaForRow:aRow];
|
||||||
indexofCriterion = [criteria indexOfObject:criterion];
|
indexofCriterion = [criteria indexOfObject:criterion];
|
||||||
|
|
||||||
if (parentItem !== nil
|
if (parentItem != nil
|
||||||
&& indexofCriterion !== CPNotFound
|
&& indexofCriterion !== CPNotFound
|
||||||
&& indexofCriterion < [criteria count] - 1)
|
&& indexofCriterion < [criteria count] - 1)
|
||||||
{
|
{
|
||||||
@@ -2469,7 +2469,7 @@ var CPRuleEditorAlignmentGridWidthKey = @"CPRuleEditorAlignmentGridWidth",
|
|||||||
- (id)initWithCoder:(CPCoder)coder
|
- (id)initWithCoder:(CPCoder)coder
|
||||||
{
|
{
|
||||||
self = [super initWithCoder:coder];
|
self = [super initWithCoder:coder];
|
||||||
if (self !== nil)
|
if (self)
|
||||||
{
|
{
|
||||||
[self setFormattingStringsFilename:[coder decodeObjectForKey:CPRuleEditorStringsFilenameKey]];
|
[self setFormattingStringsFilename:[coder decodeObjectForKey:CPRuleEditorStringsFilenameKey]];
|
||||||
_alignmentGridWidth = [coder decodeFloatForKey:CPRuleEditorAlignmentGridWidthKey];
|
_alignmentGridWidth = [coder decodeFloatForKey:CPRuleEditorAlignmentGridWidthKey];
|
||||||
@@ -2553,7 +2553,7 @@ var CriteriaKey = @"criteria",
|
|||||||
- (id)initWithCoder:(CPCoder)coder
|
- (id)initWithCoder:(CPCoder)coder
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self !== nil)
|
if (self)
|
||||||
{
|
{
|
||||||
subrows = [coder decodeObjectForKey:SubrowsKey];
|
subrows = [coder decodeObjectForKey:SubrowsKey];
|
||||||
criteria = [coder decodeObjectForKey:CriteriaKey];
|
criteria = [coder decodeObjectForKey:CriteriaKey];
|
||||||
|
|||||||
@@ -131,7 +131,7 @@
|
|||||||
{
|
{
|
||||||
var title = [self title];
|
var title = [self title];
|
||||||
|
|
||||||
if (title !== nil)
|
if (title != nil)
|
||||||
return title;
|
return title;
|
||||||
|
|
||||||
return [self templateView];
|
return [self templateView];
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
|||||||
|
|
||||||
- (void)reloadIfNeeded
|
- (void)reloadIfNeeded
|
||||||
{
|
{
|
||||||
if (connection !== nil) // Connection waiting
|
if (connection != nil) // Connection waiting
|
||||||
{
|
{
|
||||||
connection = nil;
|
connection = nil;
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
|||||||
|
|
||||||
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)rawString
|
- (void)connection:(CPURLConnection)aConnection didReceiveData:(CPString)rawString
|
||||||
{
|
{
|
||||||
if (connection !== nil && rawString !== nil)
|
if (connection != nil && rawString != nil)
|
||||||
[self loadContent:rawString];
|
[self loadContent:rawString];
|
||||||
|
|
||||||
connection = nil;
|
connection = nil;
|
||||||
@@ -83,11 +83,11 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
|
|||||||
{
|
{
|
||||||
[self reloadIfNeeded];
|
[self reloadIfNeeded];
|
||||||
|
|
||||||
if (_dictionary !== nil && aString !== nil)
|
if (_dictionary != nil && aString != nil)
|
||||||
{
|
{
|
||||||
var localized = [_dictionary objectForKey:aString];
|
var localized = [_dictionary objectForKey:aString];
|
||||||
|
|
||||||
if (localized !== nil)
|
if (localized != nil)
|
||||||
return localized;
|
return localized;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
|
|||||||
|
|
||||||
var globalValue = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPScrollersGlobalStyle"];
|
var globalValue = [[CPBundle mainBundle] objectForInfoDictionaryKey:@"CPScrollersGlobalStyle"];
|
||||||
|
|
||||||
if (globalValue === nil || globalValue === -1)
|
if (globalValue == nil || globalValue === -1)
|
||||||
CPScrollerStyleGlobal = _isBrowserUsingOverlayScrollers() ? CPScrollerStyleOverlay : CPScrollerStyleLegacy
|
CPScrollerStyleGlobal = _isBrowserUsingOverlayScrollers() ? CPScrollerStyleOverlay : CPScrollerStyleLegacy
|
||||||
else
|
else
|
||||||
CPScrollerStyleGlobal = globalValue;
|
CPScrollerStyleGlobal = globalValue;
|
||||||
@@ -309,7 +309,7 @@ Notifies the delegate when the scroll view has finished scrolling.
|
|||||||
_delegate = aDelegate;
|
_delegate = aDelegate;
|
||||||
_implementedDelegateMethods = 0;
|
_implementedDelegateMethods = 0;
|
||||||
|
|
||||||
if (_delegate === nil)
|
if (_delegate == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(scrollViewWillScroll:)])
|
if ([_delegate respondsToSelector:@selector(scrollViewWillScroll:)])
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
|||||||
- (void)resetSearchButton
|
- (void)resetSearchButton
|
||||||
{
|
{
|
||||||
var button = [self searchButton],
|
var button = [self searchButton],
|
||||||
searchButtonImage = (_searchMenuTemplate === nil) ? [self currentValueForThemeAttribute:@"image-search"] : [self currentValueForThemeAttribute:@"image-find"];
|
searchButtonImage = (_searchMenuTemplate == nil) ? [self currentValueForThemeAttribute:@"image-search"] : [self currentValueForThemeAttribute:@"image-find"];
|
||||||
|
|
||||||
[button setBordered:NO];
|
[button setBordered:NO];
|
||||||
[button setImageScaling:CPImageScaleAxesIndependently];
|
[button setImageScaling:CPImageScaleAxesIndependently];
|
||||||
@@ -491,7 +491,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
|||||||
|
|
||||||
- (void)_addStringToRecentSearches:(CPString)string
|
- (void)_addStringToRecentSearches:(CPString)string
|
||||||
{
|
{
|
||||||
if (string === nil || string === @"" || [_recentSearches containsObject:string])
|
if (string == nil || string === @"" || [_recentSearches containsObject:string])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var searches = [CPMutableArray arrayWithArray:_recentSearches];
|
var searches = [CPMutableArray arrayWithArray:_recentSearches];
|
||||||
@@ -598,7 +598,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
|||||||
|
|
||||||
- (void)_updateSearchMenu
|
- (void)_updateSearchMenu
|
||||||
{
|
{
|
||||||
if (_searchMenuTemplate === nil)
|
if (_searchMenuTemplate == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var menu = [[CPMenu alloc] init],
|
var menu = [[CPMenu alloc] init],
|
||||||
@@ -678,7 +678,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
|||||||
|
|
||||||
- (void)_showMenu
|
- (void)_showMenu
|
||||||
{
|
{
|
||||||
if (_searchMenu === nil || [_searchMenu numberOfItems] === 0 || ![self isEnabled])
|
if (_searchMenu == nil || [_searchMenu numberOfItems] === 0 || ![self isEnabled])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var aFrame = [[self superview] convertRect:[self frame] toView:nil],
|
var aFrame = [[self superview] convertRect:[self frame] toView:nil],
|
||||||
@@ -752,12 +752,12 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
|
|||||||
- (void)_loadRecentSearchList
|
- (void)_loadRecentSearchList
|
||||||
{
|
{
|
||||||
var name = [self recentsAutosaveName];
|
var name = [self recentsAutosaveName];
|
||||||
if (name === nil)
|
if (name == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var list = [[CPUserDefaults standardUserDefaults] objectForKey:name];
|
var list = [[CPUserDefaults standardUserDefaults] objectForKey:name];
|
||||||
|
|
||||||
if (list !== nil)
|
if (list != nil)
|
||||||
_recentSearches = list;
|
_recentSearches = list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1168,7 +1168,7 @@ The sum of the views and the sum of the dividers should be equal to the size of
|
|||||||
{
|
{
|
||||||
var item = preCollapseArray[i];
|
var item = preCollapseArray[i];
|
||||||
|
|
||||||
if (item === nil)
|
if (item == nil)
|
||||||
[_preCollapsePositions removeObjectForKey:String(i)];
|
[_preCollapsePositions removeObjectForKey:String(i)];
|
||||||
else
|
else
|
||||||
[_preCollapsePositions setObject:item forKey:String(i)];
|
[_preCollapsePositions setObject:item forKey:String(i)];
|
||||||
|
|||||||
+6
-6
@@ -275,7 +275,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
|||||||
*/
|
*/
|
||||||
- (void)selectNextTabViewItem:(id)aSender
|
- (void)selectNextTabViewItem:(id)aSender
|
||||||
{
|
{
|
||||||
if (_selectedTabViewItem === nil)
|
if (_selectedTabViewItem == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var nextIndex = [self indexOfTabViewItem:_selectedTabViewItem] + 1;
|
var nextIndex = [self indexOfTabViewItem:_selectedTabViewItem] + 1;
|
||||||
@@ -293,7 +293,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
|||||||
*/
|
*/
|
||||||
- (void)selectPreviousTabViewItem:(id)aSender
|
- (void)selectPreviousTabViewItem:(id)aSender
|
||||||
{
|
{
|
||||||
if (_selectedTabViewItem === nil)
|
if (_selectedTabViewItem == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var previousIndex = [self indexOfTabViewItem:_selectedTabViewItem] - 1;
|
var previousIndex = [self indexOfTabViewItem:_selectedTabViewItem] - 1;
|
||||||
@@ -353,15 +353,15 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
|||||||
{
|
{
|
||||||
var controller = [aTabViewItem viewController];
|
var controller = [aTabViewItem viewController];
|
||||||
|
|
||||||
if (controller !== nil && ![controller isViewLoaded])
|
if (controller != nil && ![controller isViewLoaded])
|
||||||
{
|
{
|
||||||
[controller loadViewWithCompletionHandler:function(view, error)
|
[controller loadViewWithCompletionHandler:function(view, error)
|
||||||
{
|
{
|
||||||
if (error !== nil)
|
if (error != nil)
|
||||||
{
|
{
|
||||||
CPLog.warn("Could not load the view for item " + aTabViewItem + ". " + error);
|
CPLog.warn("Could not load the view for item " + aTabViewItem + ". " + error);
|
||||||
}
|
}
|
||||||
else if (view !== nil)
|
else if (view != nil)
|
||||||
{
|
{
|
||||||
[aTabViewItem setView:view];
|
[aTabViewItem setView:view];
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
|||||||
{
|
{
|
||||||
var theBinder = [self binderForBinding:CPSelectionIndexesBinding];
|
var theBinder = [self binderForBinding:CPSelectionIndexesBinding];
|
||||||
|
|
||||||
if (theBinder !== nil)
|
if (theBinder != nil)
|
||||||
[theBinder reverseSetValueFor:@"selectionIndexes"];
|
[theBinder reverseSetValueFor:@"selectionIndexes"];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -593,7 +593,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
|||||||
{
|
{
|
||||||
var options = [_info objectForKey:CPOptionsKey],
|
var options = [_info objectForKey:CPOptionsKey],
|
||||||
optionValue = [options objectForKey:CPCreatesSortDescriptorBindingOption];
|
optionValue = [options objectForKey:CPCreatesSortDescriptorBindingOption];
|
||||||
return optionValue === nil ? YES : [optionValue boolValue];
|
return optionValue == nil ? YES : [optionValue boolValue];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -2977,7 +2977,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
oldMainSortDescriptor = [[self sortDescriptors] objectAtIndex: 0];
|
oldMainSortDescriptor = [[self sortDescriptors] objectAtIndex: 0];
|
||||||
|
|
||||||
// Remove every main descriptor equivalents (normally only one)
|
// Remove every main descriptor equivalents (normally only one)
|
||||||
while ((descriptor = [e nextObject]) !== nil)
|
while ((descriptor = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([[descriptor key] isEqual: [newMainSortDescriptor key]])
|
if ([[descriptor key] isEqual: [newMainSortDescriptor key]])
|
||||||
[outdatedDescriptors addObject:descriptor];
|
[outdatedDescriptors addObject:descriptor];
|
||||||
@@ -3319,7 +3319,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
var oldSortDescriptors = [[self sortDescriptors] copy],
|
var oldSortDescriptors = [[self sortDescriptors] copy],
|
||||||
newSortDescriptors = [CPArray array];
|
newSortDescriptors = [CPArray array];
|
||||||
|
|
||||||
if (sortDescriptors !== nil)
|
if (sortDescriptors != nil)
|
||||||
[newSortDescriptors addObjectsFromArray:sortDescriptors];
|
[newSortDescriptors addObjectsFromArray:sortDescriptors];
|
||||||
|
|
||||||
if ([newSortDescriptors isEqual:oldSortDescriptors])
|
if ([newSortDescriptors isEqual:oldSortDescriptors])
|
||||||
@@ -3380,7 +3380,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
objectValue = tableColumnObjectValues[aRowIndex];
|
objectValue = tableColumnObjectValues[aRowIndex];
|
||||||
|
|
||||||
// tableView:objectValueForTableColumn:row: is optional if content bindings are in place.
|
// tableView:objectValueForTableColumn:row: is optional if content bindings are in place.
|
||||||
if (objectValue === undefined)
|
if (objectValue == nil)
|
||||||
{
|
{
|
||||||
if ([self _dataSourceRespondsToObjectValueForTableColumn])
|
if ([self _dataSourceRespondsToObjectValueForTableColumn])
|
||||||
{
|
{
|
||||||
@@ -3835,7 +3835,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
else if ([self _delegateRespondsToDataViewForTableColumn])
|
else if ([self _delegateRespondsToDataViewForTableColumn])
|
||||||
_viewForTableColumnRowSelector = @selector(_sendDelegateDataViewForTableColumn:row:);
|
_viewForTableColumnRowSelector = @selector(_sendDelegateDataViewForTableColumn:row:);
|
||||||
|
|
||||||
_isViewBased = (_viewForTableColumnRowSelector !== nil || _archivedDataViews !== nil);
|
_isViewBased = (_viewForTableColumnRowSelector != nil || _archivedDataViews != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -4724,7 +4724,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
dropOperation = [self _proposedDropOperationAtPoint:location],
|
dropOperation = [self _proposedDropOperationAtPoint:location],
|
||||||
row = [self _proposedRowAtPoint:location];
|
row = [self _proposedRowAtPoint:location];
|
||||||
|
|
||||||
if (_retargetedDropRow !== nil)
|
if (_retargetedDropRow != nil)
|
||||||
row = _retargetedDropRow;
|
row = _retargetedDropRow;
|
||||||
|
|
||||||
var draggedTypes = [self registeredDraggedTypes],
|
var draggedTypes = [self registeredDraggedTypes],
|
||||||
@@ -4780,7 +4780,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
*/
|
*/
|
||||||
- (CPTableViewDropOperation)_proposedDropOperationAtPoint:(CGPoint)theDragPoint
|
- (CPTableViewDropOperation)_proposedDropOperationAtPoint:(CGPoint)theDragPoint
|
||||||
{
|
{
|
||||||
if (_retargetedDropOperation !== nil)
|
if (_retargetedDropOperation != nil)
|
||||||
return _retargetedDropOperation;
|
return _retargetedDropOperation;
|
||||||
|
|
||||||
var row = [self _proposedRowAtPoint:theDragPoint],
|
var row = [self _proposedRowAtPoint:theDragPoint],
|
||||||
@@ -4859,10 +4859,10 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
row = [self _proposedRowAtPoint:location],
|
row = [self _proposedRowAtPoint:location],
|
||||||
dragOperation = [self _sendDataSourceValidateDrop:sender proposedRow:row proposedDropOperation:dropOperation];
|
dragOperation = [self _sendDataSourceValidateDrop:sender proposedRow:row proposedDropOperation:dropOperation];
|
||||||
|
|
||||||
if (_retargetedDropRow !== nil)
|
if (_retargetedDropRow != nil)
|
||||||
row = _retargetedDropRow;
|
row = _retargetedDropRow;
|
||||||
|
|
||||||
if (_retargetedDropOperation !== nil)
|
if (_retargetedDropOperation != nil)
|
||||||
dropOperation = _retargetedDropOperation;
|
dropOperation = _retargetedDropOperation;
|
||||||
|
|
||||||
if (dropOperation === CPTableViewDropOn && row >= numberOfRows)
|
if (dropOperation === CPTableViewDropOn && row >= numberOfRows)
|
||||||
@@ -4907,7 +4907,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
|||||||
operation = [self _proposedDropOperationAtPoint:location],
|
operation = [self _proposedDropOperationAtPoint:location],
|
||||||
row = _retargetedDropRow;
|
row = _retargetedDropRow;
|
||||||
|
|
||||||
if (row === nil)
|
if (row == nil)
|
||||||
row = [self _proposedRowAtPoint:location];
|
row = [self _proposedRowAtPoint:location];
|
||||||
|
|
||||||
return [self _sendDataSourceAcceptDrop:sender row:row dropOperation:operation];
|
return [self _sendDataSourceAcceptDrop:sender row:row dropOperation:operation];
|
||||||
|
|||||||
@@ -1332,7 +1332,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
// If there is a formatter, make sure the object value can be formatted successfully
|
// If there is a formatter, make sure the object value can be formatted successfully
|
||||||
var formattedString = [self hasThemeState:CPThemeStateEditing] ? [formatter editingStringForObjectValue:aValue] : [formatter stringForObjectValue:aValue];
|
var formattedString = [self hasThemeState:CPThemeStateEditing] ? [formatter editingStringForObjectValue:aValue] : [formatter stringForObjectValue:aValue];
|
||||||
|
|
||||||
if (formattedString === nil)
|
if (formattedString == nil)
|
||||||
{
|
{
|
||||||
var value = nil;
|
var value = nil;
|
||||||
|
|
||||||
@@ -1342,7 +1342,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
value = undefined;
|
value = undefined;
|
||||||
|
|
||||||
[super setObjectValue:value];
|
[super setObjectValue:value];
|
||||||
_stringValue = (value === nil || value === undefined) ? @"" : String(value);
|
_stringValue = (value == nil) ? @"" : String(value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_stringValue = formattedString;
|
_stringValue = formattedString;
|
||||||
@@ -1498,7 +1498,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
else
|
else
|
||||||
[[CPRunLoop mainRunLoop] performBlock:function(){ element.select(); } argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
[[CPRunLoop mainRunLoop] performBlock:function(){ element.select(); } argument:nil order:0 modes:[CPDefaultRunLoopMode]];
|
||||||
}
|
}
|
||||||
else if (wind !== nil && [wind makeFirstResponder:self])
|
else if (wind != nil && [wind makeFirstResponder:self])
|
||||||
[self _selectText:sender immediately:immediately];
|
[self _selectText:sender immediately:immediately];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1508,7 +1508,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
|||||||
#else
|
#else
|
||||||
// Even if we can't actually select the text we need to preserve the first
|
// Even if we can't actually select the text we need to preserve the first
|
||||||
// responder side effect.
|
// responder side effect.
|
||||||
if (wind !== nil && [wind firstResponder] !== self)
|
if (wind != nil && [wind firstResponder] !== self)
|
||||||
[wind makeFirstResponder:self];
|
[wind makeFirstResponder:self];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -2153,7 +2153,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
|
|||||||
newValue = [self valueForBinding:aBinding],
|
newValue = [self valueForBinding:aBinding],
|
||||||
value = [destination valueForKeyPath:keyPath];
|
value = [destination valueForKeyPath:keyPath];
|
||||||
|
|
||||||
if (CPIsControllerMarker(value) && newValue === nil)
|
if (CPIsControllerMarker(value) && newValue == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newValue = [self reverseTransformValue:newValue withOptions:options];
|
newValue = [self reverseTransformValue:newValue withOptions:options];
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ var _availableTraits= [@"Normal", @"Italic", @"Bold", @"Bold Italic"],
|
|||||||
*/
|
*/
|
||||||
+ (BOOL)sharedFontPanelExists
|
+ (BOOL)sharedFontPanelExists
|
||||||
{
|
{
|
||||||
return _sharedFontPanel !== nil;
|
return _sharedFontPanel != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -980,7 +980,7 @@ Sets the selection to a range of characters in response to user action.
|
|||||||
if (!isNewSelection && _mouseDownOldSelection)
|
if (!isNewSelection && _mouseDownOldSelection)
|
||||||
isNewSelection = !CPEqualRanges(newSelectionRange, _mouseDownOldSelection);
|
isNewSelection = !CPEqualRanges(newSelectionRange, _mouseDownOldSelection);
|
||||||
|
|
||||||
if (doOverwrite && _placeholderString === nil && isNewSelection)
|
if (doOverwrite && _placeholderString == nil && isNewSelection)
|
||||||
[self setTypingAttributes:[_textStorage attributesAtIndex:CPMaxRange(range) effectiveRange:nil]];
|
[self setTypingAttributes:[_textStorage attributesAtIndex:CPMaxRange(range) effectiveRange:nil]];
|
||||||
|
|
||||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPTextViewDidChangeSelectionNotification object:self];
|
[[CPNotificationCenter defaultCenter] postNotificationName:CPTextViewDidChangeSelectionNotification object:self];
|
||||||
@@ -2916,7 +2916,7 @@ var _CPCopyPlaceholder = '-';
|
|||||||
|
|
||||||
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
- (void)setValue:(id)aValue forBinding:(CPString)aBinding
|
||||||
{
|
{
|
||||||
if (aValue === nil || (aValue.isa && [aValue isMemberOfClass:CPNull]))
|
if (aValue == nil || (aValue.isa && [aValue isMemberOfClass:CPNull]))
|
||||||
[_source _setPlaceholderString:[self _placeholderForMarker:CPNullMarker]];
|
[_source _setPlaceholderString:[self _placeholderForMarker:CPNullMarker]];
|
||||||
else
|
else
|
||||||
[_source _setPlaceholderString:nil];
|
[_source _setPlaceholderString:nil];
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ function _points2twips(a) { return (a) * 20.0; }
|
|||||||
keyArray = [keyArray sortedArrayUsingSelector:@selector(compare:)];
|
keyArray = [keyArray sortedArrayUsingSelector:@selector(compare:)];
|
||||||
fontEnum = [keyArray objectEnumerator];
|
fontEnum = [keyArray objectEnumerator];
|
||||||
|
|
||||||
while ((currFont = [fontEnum nextObject]) !== nil)
|
while ((currFont = [fontEnum nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var fontFamily,
|
var fontFamily,
|
||||||
detail;
|
detail;
|
||||||
@@ -149,7 +149,7 @@ function _points2twips(a) { return (a) * 20.0; }
|
|||||||
next,
|
next,
|
||||||
i;
|
i;
|
||||||
|
|
||||||
while ((next = [keyEnum nextObject]) !== nil)
|
while ((next = [keyEnum nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var cn = [colorDict objectForKey:next];
|
var cn = [colorDict objectForKey:next];
|
||||||
[list insertObject:[CPColor colorWithCSSString:next] atIndex:[cn intValue]-1];
|
[list insertObject:[CPColor colorWithCSSString:next] atIndex:[cn intValue]-1];
|
||||||
|
|||||||
+6
-6
@@ -259,7 +259,7 @@ var CPThemesByName = { },
|
|||||||
attributeNames = [attributes keyEnumerator],
|
attributeNames = [attributes keyEnumerator],
|
||||||
objectThemeClass = [anObject themeClass];
|
objectThemeClass = [anObject themeClass];
|
||||||
|
|
||||||
while ((attributeName = [attributeNames nextObject]) !== nil)
|
while ((attributeName = [attributeNames nextObject]) != nil)
|
||||||
[self _recordAttribute:[attributes objectForKey:attributeName] forClass:objectThemeClass];
|
[self _recordAttribute:[attributes objectForKey:attributeName] forClass:objectThemeClass];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
|||||||
{
|
{
|
||||||
var attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute];
|
var attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute];
|
||||||
|
|
||||||
if (aValue !== undefined && aValue !== nil)
|
if (aValue != nil)
|
||||||
attribute._values = @{ CPThemeStateNormalString: aValue };
|
attribute._values = @{ CPThemeStateNormalString: aValue };
|
||||||
|
|
||||||
return attribute;
|
return attribute;
|
||||||
@@ -695,7 +695,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
|||||||
|
|
||||||
- (_CPThemeAttribute)attributeBySettingValue:(id)aValue forState:(ThemeState)aState
|
- (_CPThemeAttribute)attributeBySettingValue:(id)aValue forState:(ThemeState)aState
|
||||||
{
|
{
|
||||||
var shouldRemoveValue = aValue === undefined || aValue === nil,
|
var shouldRemoveValue = aValue == nil,
|
||||||
attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute],
|
attribute = [[_CPThemeAttribute alloc] initWithName:_name defaultValue:_defaultValue defaultAttribute:_themeDefaultAttribute],
|
||||||
values = _values;
|
values = _values;
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
|||||||
// Not in cache. OK, search in values.
|
// Not in cache. OK, search in values.
|
||||||
value = [_values objectForKey:stateName];
|
value = [_values objectForKey:stateName];
|
||||||
|
|
||||||
if ((value !== undefined) && (value !== nil))
|
if (value != nil)
|
||||||
return _cache[stateName] = value;
|
return _cache[stateName] = value;
|
||||||
|
|
||||||
// No direct match in values.
|
// No direct match in values.
|
||||||
@@ -754,13 +754,13 @@ CPThemeStateNormalString = String(CPThemeStateNormal);
|
|||||||
// Still don't have a value? OK, let's use the normal value.
|
// Still don't have a value? OK, let's use the normal value.
|
||||||
value = [_values objectForKey:String(CPThemeStateNormal)];
|
value = [_values objectForKey:String(CPThemeStateNormal)];
|
||||||
|
|
||||||
if ((value !== undefined) && (value !== nil))
|
if (value != nil)
|
||||||
return _cache[stateName] = value;
|
return _cache[stateName] = value;
|
||||||
|
|
||||||
// No normal value, try asking _themeDefaultAttribute
|
// No normal value, try asking _themeDefaultAttribute
|
||||||
value = [_themeDefaultAttribute valueForState:aState];
|
value = [_themeDefaultAttribute valueForState:aState];
|
||||||
|
|
||||||
if ((value !== undefined) && (value !== nil))
|
if (value != nil)
|
||||||
return _cache[stateName] = value;
|
return _cache[stateName] = value;
|
||||||
|
|
||||||
// Well, last option, use default value
|
// Well, last option, use default value
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
|
|
||||||
- (void)setObjectValue:(id)aValue
|
- (void)setObjectValue:(id)aValue
|
||||||
{
|
{
|
||||||
if (aValue !== nil && ![aValue isKindOfClass:[CPArray class]])
|
if (aValue != nil && ![aValue isKindOfClass:[CPArray class]])
|
||||||
{
|
{
|
||||||
[super setObjectValue:nil];
|
[super setObjectValue:nil];
|
||||||
return;
|
return;
|
||||||
@@ -645,7 +645,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
newTokens = [];
|
newTokens = [];
|
||||||
|
|
||||||
// Preserve as many existing tokens as possible to reduce redraw flickering.
|
// Preserve as many existing tokens as possible to reduce redraw flickering.
|
||||||
if (aValue !== nil)
|
if (aValue != nil)
|
||||||
{
|
{
|
||||||
for (var i = 0, count = [aValue count]; i < count; i++)
|
for (var i = 0, count = [aValue count]; i < count; i++)
|
||||||
{
|
{
|
||||||
@@ -666,7 +666,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newToken === nil)
|
if (newToken == nil)
|
||||||
{
|
{
|
||||||
newToken = [_CPTokenFieldToken new];
|
newToken = [_CPTokenFieldToken new];
|
||||||
[newToken setTokenField:self];
|
[newToken setTokenField:self];
|
||||||
@@ -1310,7 +1310,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
{
|
{
|
||||||
var stringForRepresentedObject = [_tokenFieldDelegate tokenField:self displayStringForRepresentedObject:representedObject];
|
var stringForRepresentedObject = [_tokenFieldDelegate tokenField:self displayStringForRepresentedObject:representedObject];
|
||||||
|
|
||||||
if (stringForRepresentedObject !== nil)
|
if (stringForRepresentedObject != nil)
|
||||||
return stringForRepresentedObject;
|
return stringForRepresentedObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,7 +1332,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
{
|
{
|
||||||
var approvedObjects = [_tokenFieldDelegate tokenField:self shouldAddObjects:tokens atIndex:index];
|
var approvedObjects = [_tokenFieldDelegate tokenField:self shouldAddObjects:tokens atIndex:index];
|
||||||
|
|
||||||
if (approvedObjects !== nil)
|
if (approvedObjects != nil)
|
||||||
return approvedObjects;
|
return approvedObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1354,7 +1354,7 @@ CPTokenFieldDeleteButtonType = 1;
|
|||||||
{
|
{
|
||||||
var token = [_tokenFieldDelegate tokenField:self representedObjectForEditingString:aString];
|
var token = [_tokenFieldDelegate tokenField:self representedObjectForEditingString:aString];
|
||||||
|
|
||||||
if (token !== nil && token !== undefined)
|
if (token != nil)
|
||||||
return token;
|
return token;
|
||||||
// If nil was returned, assume the string is the represented object. The alternative would have been
|
// If nil was returned, assume the string is the represented object. The alternative would have been
|
||||||
// to not add anything to the object value array for a nil response.
|
// to not add anything to the object value array for a nil response.
|
||||||
|
|||||||
+1
-1
@@ -363,7 +363,7 @@ var CPToolbarsByIdentifier = nil,
|
|||||||
|
|
||||||
item = [item copy];
|
item = [item copy];
|
||||||
|
|
||||||
if (item === nil)
|
if (item == nil)
|
||||||
[CPException raise:CPInvalidArgumentException
|
[CPException raise:CPInvalidArgumentException
|
||||||
reason:@"Toolbar delegate " + _delegate + " returned nil toolbar item for identifier \"" + identifier + "\""];
|
reason:@"Toolbar delegate " + _delegate + " returned nil toolbar item for identifier \"" + identifier + "\""];
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ingroup appkit
|
@ingroup appkit
|
||||||
|
|
||||||
A CPTrackingArea defines a region of view that generates mouse-tracking and
|
A CPTrackingArea defines a region of view that generates mouse-tracking and
|
||||||
cursor-update events when the mouse is over that region.
|
cursor-update events when the mouse is over that region.
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +61,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
|||||||
CPTrackingAreaOptions _options @accessors(getter=options);
|
CPTrackingAreaOptions _options @accessors(getter=options);
|
||||||
id _owner @accessors(getter=owner);
|
id _owner @accessors(getter=owner);
|
||||||
CPDictionary _userInfo @accessors(getter=userInfo);
|
CPDictionary _userInfo @accessors(getter=userInfo);
|
||||||
|
|
||||||
CPView _referencingView @accessors(property=view);
|
CPView _referencingView @accessors(property=view);
|
||||||
CGRect _windowRect @accessors(getter=windowRect);
|
CGRect _windowRect @accessors(getter=windowRect);
|
||||||
|
|
||||||
@@ -72,13 +72,13 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark Initialization
|
#pragma mark Initialization
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly
|
Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly
|
||||||
all these events.
|
all these events.
|
||||||
*/
|
*/
|
||||||
- (CPTrackingArea)initWithRect:(CGRect)aRect options:(CPTrackingAreaOptions)options owner:(id)owner userInfo:(CPDictionary)userInfo
|
- (CPTrackingArea)initWithRect:(CGRect)aRect options:(CPTrackingAreaOptions)options owner:(id)owner userInfo:(CPDictionary)userInfo
|
||||||
{
|
{
|
||||||
if (owner === nil)
|
if (owner == nil)
|
||||||
[CPException raise:CPInternalInconsistencyException reason:"No owner specified"];
|
[CPException raise:CPInternalInconsistencyException reason:"No owner specified"];
|
||||||
|
|
||||||
if (options === 0)
|
if (options === 0)
|
||||||
@@ -116,7 +116,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
|||||||
if ([_owner respondsToSelector:@selector(cursorUpdate:)])
|
if ([_owner respondsToSelector:@selector(cursorUpdate:)])
|
||||||
_implementedOwnerMethods |= CPTrackingOwnerImplementsCursorUpdate;
|
_implementedOwnerMethods |= CPTrackingOwnerImplementsCursorUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
|
|||||||
_referencingView = [aCoder decodeObjectForKey:CPTrackingAreaReferencingViewKey];
|
_referencingView = [aCoder decodeObjectForKey:CPTrackingAreaReferencingViewKey];
|
||||||
_windowRect = [aCoder decodeObjectForKey:CPTrackingAreaWindowRect];
|
_windowRect = [aCoder decodeObjectForKey:CPTrackingAreaWindowRect];
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -160,13 +160,13 @@ var CPUserDefaultsControllerSharedKey = "CPUserDefaultsControllerSharedKey";
|
|||||||
- (id)valueForKey:(CPString)aKey
|
- (id)valueForKey:(CPString)aKey
|
||||||
{
|
{
|
||||||
var value = [_cachedValues objectForKey:aKey];
|
var value = [_cachedValues objectForKey:aKey];
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
{
|
{
|
||||||
value = [[_controller defaults] objectForKey:aKey];
|
value = [[_controller defaults] objectForKey:aKey];
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
value = [[_controller initialValues] objectForKey:aKey];
|
value = [[_controller initialValues] objectForKey:aKey];
|
||||||
|
|
||||||
if (value !== nil)
|
if (value != nil)
|
||||||
[_cachedValues setObject:value forKey:aKey];
|
[_cachedValues setObject:value forKey:aKey];
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@@ -220,7 +220,7 @@ var CPUserDefaultsControllerSharedKey = "CPUserDefaultsControllerSharedKey";
|
|||||||
[self willChangeValueForKey:key];
|
[self willChangeValueForKey:key];
|
||||||
|
|
||||||
var initialValue = [initial objectForKey:key];
|
var initialValue = [initial objectForKey:key];
|
||||||
if (initialValue !== nil)
|
if (initialValue != nil)
|
||||||
[_cachedValues setObject:initialValue forKey:key];
|
[_cachedValues setObject:initialValue forKey:key];
|
||||||
else
|
else
|
||||||
[_cachedValues removeObjectForKey:key];
|
[_cachedValues removeObjectForKey:key];
|
||||||
|
|||||||
+9
-9
@@ -800,7 +800,7 @@ var CPViewHighDPIDrawingEnabled = YES;
|
|||||||
var addedSubview = nil,
|
var addedSubview = nil,
|
||||||
addedSubviewEnumerator = [addedSubviews objectEnumerator];
|
addedSubviewEnumerator = [addedSubviews objectEnumerator];
|
||||||
|
|
||||||
while ((addedSubview = [addedSubviewEnumerator nextObject]) !== nil)
|
while ((addedSubview = [addedSubviewEnumerator nextObject]) != nil)
|
||||||
[self addSubview:addedSubview];
|
[self addSubview:addedSubview];
|
||||||
|
|
||||||
// If the order is fine, no need to reorder.
|
// If the order is fine, no need to reorder.
|
||||||
@@ -1703,8 +1703,8 @@ var CPViewHighDPIDrawingEnabled = YES;
|
|||||||
|
|
||||||
- (void)_setSuperview:(CPView)aSuperview
|
- (void)_setSuperview:(CPView)aSuperview
|
||||||
{
|
{
|
||||||
var hasOldSuperview = (_superview !== nil),
|
var hasOldSuperview = (_superview != nil),
|
||||||
hasNewSuperview = (aSuperview !== nil),
|
hasNewSuperview = (aSuperview != nil),
|
||||||
oldSuperviewIsHidden = hasOldSuperview && [_superview isHiddenOrHasHiddenAncestor],
|
oldSuperviewIsHidden = hasOldSuperview && [_superview isHiddenOrHasHiddenAncestor],
|
||||||
newSuperviewIsHidden = hasNewSuperview && [aSuperview isHiddenOrHasHiddenAncestor];
|
newSuperviewIsHidden = hasNewSuperview && [aSuperview isHiddenOrHasHiddenAncestor];
|
||||||
|
|
||||||
@@ -3802,7 +3802,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
|||||||
|
|
||||||
// Other views (CPBox) might set an autoresizes mask on their subviews before it is actually decoded.
|
// Other views (CPBox) might set an autoresizes mask on their subviews before it is actually decoded.
|
||||||
// We make sure we don't override the value by checking if it was already set.
|
// We make sure we don't override the value by checking if it was already set.
|
||||||
if (_autoresizingMask === nil)
|
if (_autoresizingMask == nil)
|
||||||
_autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] || CPViewNotSizable;
|
_autoresizingMask = [aCoder decodeIntForKey:CPViewAutoresizingMaskKey] || CPViewNotSizable;
|
||||||
|
|
||||||
_autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
|
_autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
|
||||||
@@ -3876,7 +3876,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
|||||||
[aCoder encodeRect:_bounds forKey:CPViewBoundsKey];
|
[aCoder encodeRect:_bounds forKey:CPViewBoundsKey];
|
||||||
|
|
||||||
// This will come out nil on the other side with decodeObjectForKey:
|
// This will come out nil on the other side with decodeObjectForKey:
|
||||||
if (_window !== nil)
|
if (_window != nil)
|
||||||
[aCoder encodeConditionalObject:_window forKey:CPViewWindowKey];
|
[aCoder encodeConditionalObject:_window forKey:CPViewWindowKey];
|
||||||
|
|
||||||
var count = [_subviews count],
|
var count = [_subviews count],
|
||||||
@@ -3895,7 +3895,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
|||||||
[aCoder encodeObject:encodedSubviews forKey:CPViewSubviewsKey];
|
[aCoder encodeObject:encodedSubviews forKey:CPViewSubviewsKey];
|
||||||
|
|
||||||
// This will come out nil on the other side with decodeObjectForKey:
|
// This will come out nil on the other side with decodeObjectForKey:
|
||||||
if (_superview !== nil)
|
if (_superview != nil)
|
||||||
[aCoder encodeConditionalObject:_superview forKey:CPViewSuperviewKey];
|
[aCoder encodeConditionalObject:_superview forKey:CPViewSuperviewKey];
|
||||||
|
|
||||||
if (_autoresizingMask !== CPViewNotSizable)
|
if (_autoresizingMask !== CPViewNotSizable)
|
||||||
@@ -3904,7 +3904,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
|||||||
if (!_autoresizesSubviews)
|
if (!_autoresizesSubviews)
|
||||||
[aCoder encodeBool:_autoresizesSubviews forKey:CPViewAutoresizesSubviewsKey];
|
[aCoder encodeBool:_autoresizesSubviews forKey:CPViewAutoresizesSubviewsKey];
|
||||||
|
|
||||||
if (_backgroundColor !== nil)
|
if (_backgroundColor != nil)
|
||||||
[aCoder encodeObject:_backgroundColor forKey:CPViewBackgroundColorKey];
|
[aCoder encodeObject:_backgroundColor forKey:CPViewBackgroundColorKey];
|
||||||
|
|
||||||
if (_hitTests !== YES)
|
if (_hitTests !== YES)
|
||||||
@@ -3921,12 +3921,12 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
|||||||
|
|
||||||
var nextKeyView = [self nextKeyView];
|
var nextKeyView = [self nextKeyView];
|
||||||
|
|
||||||
if (nextKeyView !== nil && ![nextKeyView isEqual:self])
|
if (nextKeyView != nil && ![nextKeyView isEqual:self])
|
||||||
[aCoder encodeConditionalObject:nextKeyView forKey:CPViewNextKeyViewKey];
|
[aCoder encodeConditionalObject:nextKeyView forKey:CPViewNextKeyViewKey];
|
||||||
|
|
||||||
var previousKeyView = [self previousKeyView];
|
var previousKeyView = [self previousKeyView];
|
||||||
|
|
||||||
if (previousKeyView !== nil && ![previousKeyView isEqual:self])
|
if (previousKeyView != nil && ![previousKeyView isEqual:self])
|
||||||
[aCoder encodeConditionalObject:previousKeyView forKey:CPViewPreviousKeyViewKey];
|
[aCoder encodeConditionalObject:previousKeyView forKey:CPViewPreviousKeyViewKey];
|
||||||
|
|
||||||
[self _encodeThemeObjectsWithCoder:aCoder];
|
[self _encodeThemeObjectsWithCoder:aCoder];
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ var CPViewControllerCachedCibs;
|
|||||||
|
|
||||||
[self loadView];
|
[self loadView];
|
||||||
|
|
||||||
if (_view === nil && [cibOwner isKindOfClass:[CPDocument class]])
|
if (_view == nil && [cibOwner isKindOfClass:[CPDocument class]])
|
||||||
[self setView:[cibOwner valueForKey:@"view"]];
|
[self setView:[cibOwner valueForKey:@"view"]];
|
||||||
|
|
||||||
if (!_view)
|
if (!_view)
|
||||||
@@ -408,7 +408,7 @@ var CPViewControllerCachedCibs;
|
|||||||
[self willChangeValueForKey:"isViewLoaded"];
|
[self willChangeValueForKey:"isViewLoaded"];
|
||||||
|
|
||||||
_view = aView;
|
_view = aView;
|
||||||
_isViewLoaded = aView !== nil;
|
_isViewLoaded = aView != nil;
|
||||||
|
|
||||||
if (willChangeIsViewLoaded)
|
if (willChangeIsViewLoaded)
|
||||||
[self didChangeValueForKey:"isViewLoaded"];
|
[self didChangeValueForKey:"isViewLoaded"];
|
||||||
@@ -421,7 +421,7 @@ var CPViewControllerCachedCibs;
|
|||||||
|
|
||||||
- (void)_registerOrUnregister:(BOOL)shouldRegister notificationsForView:(CPView)aView
|
- (void)_registerOrUnregister:(BOOL)shouldRegister notificationsForView:(CPView)aView
|
||||||
{
|
{
|
||||||
if (aView === nil)
|
if (aView == nil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var center = [CPNotificationCenter defaultCenter],
|
var center = [CPNotificationCenter defaultCenter],
|
||||||
|
|||||||
+3
-3
@@ -470,7 +470,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
|||||||
|
|
||||||
_iframe.src = _url;
|
_iframe.src = _url;
|
||||||
}
|
}
|
||||||
else if (_html !== nil)
|
else if (_html != nil)
|
||||||
{
|
{
|
||||||
// clear the iframe
|
// clear the iframe
|
||||||
_iframe.src = "";
|
_iframe.src = "";
|
||||||
@@ -480,7 +480,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
|||||||
|
|
||||||
_ignoreLoadEnd = NO;
|
_ignoreLoadEnd = NO;
|
||||||
|
|
||||||
if (_loadHTMLStringTimer !== nil)
|
if (_loadHTMLStringTimer != nil)
|
||||||
{
|
{
|
||||||
window.clearTimeout(_loadHTMLStringTimer);
|
window.clearTimeout(_loadHTMLStringTimer);
|
||||||
_loadHTMLStringTimer = nil;
|
_loadHTMLStringTimer = nil;
|
||||||
@@ -848,7 +848,7 @@ CPWebViewAppKitScrollMaxPollCount = 3;
|
|||||||
- (@action)reload:(id)sender
|
- (@action)reload:(id)sender
|
||||||
{
|
{
|
||||||
// If we're displaying pure HTML, redisplay it.
|
// If we're displaying pure HTML, redisplay it.
|
||||||
if (!_url && (_html !== nil))
|
if (!_url && (_html != nil))
|
||||||
[self loadHTMLString:_html];
|
[self loadHTMLString:_html];
|
||||||
else
|
else
|
||||||
[self _loadMainFrameURL];
|
[self _loadMainFrameURL];
|
||||||
|
|||||||
@@ -3119,7 +3119,7 @@ CPTexturedBackgroundWindowMask
|
|||||||
*/
|
*/
|
||||||
- (CPWindow)attachedSheet
|
- (CPWindow)attachedSheet
|
||||||
{
|
{
|
||||||
if (_sheetContext === nil)
|
if (_sheetContext == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return _sheetContext["sheet"];
|
return _sheetContext["sheet"];
|
||||||
|
|||||||
@@ -752,7 +752,7 @@ _CPWindowViewResizeSlop = 3;
|
|||||||
|
|
||||||
- (BOOL)showsResizeIndicator
|
- (BOOL)showsResizeIndicator
|
||||||
{
|
{
|
||||||
return _resizeIndicator !== nil;
|
return _resizeIndicator != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setResizeIndicatorOffset:(CGSize)anOffset
|
- (void)setResizeIndicatorOffset:(CGSize)anOffset
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
*/
|
*/
|
||||||
- (BOOL)isWindowLoaded
|
- (BOOL)isWindowLoaded
|
||||||
{
|
{
|
||||||
return _window !== nil;
|
return _window != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -184,7 +184,7 @@
|
|||||||
|
|
||||||
[self loadWindow];
|
[self loadWindow];
|
||||||
|
|
||||||
if (_window === nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
if (_window == nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
||||||
[self setWindow:[_cibOwner valueForKey:@"window"]];
|
[self setWindow:[_cibOwner valueForKey:@"window"]];
|
||||||
|
|
||||||
if (!_window)
|
if (!_window)
|
||||||
|
|||||||
+1
-1
@@ -152,7 +152,7 @@ var CPCibObjectDataKey = @"CPCibObjectDataKey";
|
|||||||
var key = nil,
|
var key = nil,
|
||||||
keyEnumerator = [replacementClasses keyEnumerator];
|
keyEnumerator = [replacementClasses keyEnumerator];
|
||||||
|
|
||||||
while ((key = [keyEnumerator nextObject]) !== nil)
|
while ((key = [keyEnumerator nextObject]) != nil)
|
||||||
[unarchiver setClass:[replacementClasses objectForKey:key] forClassName:key];
|
[unarchiver setClass:[replacementClasses objectForKey:key] forClassName:key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@
|
|||||||
var object = nil,
|
var object = nil,
|
||||||
objectEnumerator = [_visibleWindows objectEnumerator];
|
objectEnumerator = [_visibleWindows objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
[_replacementObjects[[object UID]] makeKeyAndOrderFront:self];
|
[_replacementObjects[[object UID]] makeKeyAndOrderFront:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ var frameToCSSTranslationTransformMatrix = function(start, current)
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([[self animatorClass] _cssPropertiesForKeyPath:aKey] !== nil)
|
if ([[self animatorClass] _cssPropertiesForKeyPath:aKey] != nil)
|
||||||
return [CAAnimation animation];
|
return [CAAnimation animation];
|
||||||
|
|
||||||
return nil;
|
return nil;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ var _supportsCSSAnimations = null;
|
|||||||
if ([self class] !== [_CPObjectAnimator class])
|
if ([self class] !== [_CPObjectAnimator class])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var compat = (CPBrowserCSSProperty("animation") !== nil);
|
var compat = (CPBrowserCSSProperty("animation") != nil);
|
||||||
CPSetPlatformFeature(CPCSSAnimationFeature, compat);
|
CPSetPlatformFeature(CPCSSAnimationFeature, compat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ function CGContextFillRect(aContext, aRect)
|
|||||||
*/
|
*/
|
||||||
function CGContextFillRects(aContext, rects, count)
|
function CGContextFillRects(aContext, rects, count)
|
||||||
{
|
{
|
||||||
if (arguments[2] === undefined)
|
if (arguments[2] == nil)
|
||||||
var count = rects.length;
|
var count = rects.length;
|
||||||
|
|
||||||
CGContextBeginPath(aContext);
|
CGContextBeginPath(aContext);
|
||||||
@@ -641,7 +641,7 @@ function CGContextStrokeLineSegments(aContext, points, count)
|
|||||||
{
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
if (count === NULL)
|
if (count == NULL)
|
||||||
var count = points.length;
|
var count = points.length;
|
||||||
|
|
||||||
CGContextBeginPath(aContext);
|
CGContextBeginPath(aContext);
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ function CGContextAddCurveToPoint(aContext, cp1x, cp1y, cp2x, cp2y, x, y)
|
|||||||
function CGContextAddLines(aContext, points, count)
|
function CGContextAddLines(aContext, points, count)
|
||||||
{
|
{
|
||||||
// implementation mirrors that of CGPathAddLines()
|
// implementation mirrors that of CGPathAddLines()
|
||||||
if (count === null || count === undefined)
|
if (count == null)
|
||||||
count = points.length;
|
count = points.length;
|
||||||
|
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
@@ -234,7 +234,7 @@ function CGContextAddQuadCurveToPoint(aContext, cpx, cpy, x, y)
|
|||||||
|
|
||||||
function CGContextAddRects(aContext, rects, count)
|
function CGContextAddRects(aContext, rects, count)
|
||||||
{
|
{
|
||||||
if (count === null || count === undefined)
|
if (count == null)
|
||||||
count = rects.length;
|
count = rects.length;
|
||||||
|
|
||||||
for (var i = 0; i < count; ++i)
|
for (var i = 0; i < count; ++i)
|
||||||
@@ -297,7 +297,7 @@ function CGContextFillRect(aContext, aRect)
|
|||||||
|
|
||||||
function CGContextFillRects(aContext, rects, count)
|
function CGContextFillRects(aContext, rects, count)
|
||||||
{
|
{
|
||||||
if (count === null || count === undefined)
|
if (count == null)
|
||||||
count = rects.length;
|
count = rects.length;
|
||||||
|
|
||||||
for (var i = 0; i < count; ++i)
|
for (var i = 0; i < count; ++i)
|
||||||
@@ -333,7 +333,7 @@ function CGContextClipToRect(aContext, aRect)
|
|||||||
|
|
||||||
function CGContextClipToRects(aContext, rects, count)
|
function CGContextClipToRects(aContext, rects, count)
|
||||||
{
|
{
|
||||||
if (count === null || count === undefined)
|
if (count == null)
|
||||||
count = rects.length;
|
count = rects.length;
|
||||||
|
|
||||||
_CGContextBeginPathCanvas(aContext);
|
_CGContextBeginPathCanvas(aContext);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ kCGGradientDrawsAfterEndLocation = 1 << 1;
|
|||||||
|
|
||||||
function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count)
|
function CGGradientCreateWithColorComponents(aColorSpace, components, locations, count)
|
||||||
{
|
{
|
||||||
if (locations === undefined || locations === NULL)
|
if (locations == NULL)
|
||||||
{
|
{
|
||||||
var num_of_colors = components.length / 4,
|
var num_of_colors = components.length / 4,
|
||||||
locations = [];
|
locations = [];
|
||||||
@@ -39,7 +39,7 @@ function CGGradientCreateWithColorComponents(aColorSpace, components, locations,
|
|||||||
locations.push( idx / (num_of_colors - 1) );
|
locations.push( idx / (num_of_colors - 1) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count === undefined || count === NULL)
|
if (count == NULL)
|
||||||
count = locations.length;
|
count = locations.length;
|
||||||
|
|
||||||
var colors = [];
|
var colors = [];
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ function CGPathAddCurveToPoint(aPath, aTransform, cp1x, cp1y, cp2x, cp2y, x, y)
|
|||||||
|
|
||||||
function CGPathAddLines(aPath, aTransform, points, count)
|
function CGPathAddLines(aPath, aTransform, points, count)
|
||||||
{
|
{
|
||||||
if (count === null || count === undefined)
|
if (count == null)
|
||||||
count = points.length;
|
count = points.length;
|
||||||
|
|
||||||
if (!aPath || count < 1)
|
if (!aPath || count < 1)
|
||||||
@@ -284,7 +284,7 @@ function CGPathAddRects(aPath, aTransform, rects, count)
|
|||||||
{
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
|
||||||
if (count === NULL)
|
if (count == NULL)
|
||||||
var count = rects.length;
|
var count = rects.length;
|
||||||
|
|
||||||
for (; i < count; ++i)
|
for (; i < count; ++i)
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ var screenNeedsInitialization = NO,
|
|||||||
platformWindowEnumerator = [platformWindows objectEnumerator],
|
platformWindowEnumerator = [platformWindows objectEnumerator],
|
||||||
platformWindow = nil;
|
platformWindow = nil;
|
||||||
|
|
||||||
while ((platformWindow = [platformWindowEnumerator nextObject]) !== nil)
|
while ((platformWindow = [platformWindowEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if (platformWindow != primaryPlatformWindow)
|
if (platformWindow != primaryPlatformWindow)
|
||||||
[platformWindow orderOut:self];
|
[platformWindow orderOut:self];
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var needsDOMImageElement = _image !== nil && _imagePosition !== CPNoImage,
|
var needsDOMImageElement = _image != nil && _imagePosition !== CPNoImage,
|
||||||
hasDOMImageElement = !!_DOMImageElement,
|
hasDOMImageElement = !!_DOMImageElement,
|
||||||
// For CSS theming
|
// For CSS theming
|
||||||
isCSSBasedImage = [_image isCSSBased],
|
isCSSBasedImage = [_image isCSSBased],
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ var ListColumnIdentifier = @"1";
|
|||||||
{
|
{
|
||||||
var value = [self selectedObjectValue];
|
var value = [self selectedObjectValue];
|
||||||
|
|
||||||
return value !== nil ? [_dataSource list:self stringValueForObjectValue:value] : nil;
|
return value != nil ? [_dataSource list:self stringValueForObjectValue:value] : nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
|||||||
originTop.x += platformRect.size.width / 2.0 - frameSize.width / 2.0;
|
originTop.x += platformRect.size.width / 2.0 - frameSize.width / 2.0;
|
||||||
originTop.y -= frameSize.height;
|
originTop.y -= frameSize.height;
|
||||||
|
|
||||||
var requestedEdge = (anEdge !== nil) ? anEdge : CPMaxXEdge,
|
var requestedEdge = (anEdge != nil) ? anEdge : CPMaxXEdge,
|
||||||
requestedOrigin;
|
requestedOrigin;
|
||||||
|
|
||||||
switch (requestedEdge)
|
switch (requestedEdge)
|
||||||
|
|||||||
+5
-5
@@ -394,7 +394,7 @@ Every brace gets its own line, very simple to remember:
|
|||||||
|
|
||||||
In JavaScript, the null object value should be written as null. In Objective-J, it should be written as `nil` when the variable refers to an object, and `Nil` when it refers to a `Class`. Objective-J `BOOL` values should be written as `YES` and `NO`.
|
In JavaScript, the null object value should be written as null. In Objective-J, it should be written as `nil` when the variable refers to an object, and `Nil` when it refers to a `Class`. Objective-J `BOOL` values should be written as `YES` and `NO`.
|
||||||
|
|
||||||
Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done without equality comparisons, except for cases when a value could be both 0 or `null` (or another "falsey" value). In this case, the comparison should be preceded by a comment explaining the distinction.
|
Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done without equality comparisons, except for cases when a value could be both 0, "" or `null` (or another "falsey" value). In this case, the comparison should be preceded by a comment explaining the distinction. When comparing with nil/null always use '==' / '!=' as the value cound also be undefined.
|
||||||
|
|
||||||
##### Right:
|
##### Right:
|
||||||
|
|
||||||
@@ -407,8 +407,8 @@ Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done wi
|
|||||||
if (!count)
|
if (!count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// object is an ID number, so 0 is OK, but null is not.
|
// object is an ID number, so 0 is OK, but null/undefined is not.
|
||||||
if (object === null)
|
if (object == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
##### Wrong:
|
##### Wrong:
|
||||||
@@ -416,13 +416,13 @@ Tests for `true/false`, `null/non-null`, and zero/non-zero should all be done wi
|
|||||||
if (condition == true)
|
if (condition == true)
|
||||||
doIt();
|
doIt();
|
||||||
|
|
||||||
if (ptr == NULL)
|
if (ptr === NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (object == null)
|
if (object === null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -458,11 +458,11 @@
|
|||||||
enumerator = [self objectEnumerator],
|
enumerator = [self objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var value = [object valueForKey:aKey];
|
var value = [object valueForKey:aKey];
|
||||||
|
|
||||||
if (value === nil || value === undefined)
|
if (value == nil)
|
||||||
value = [CPNull null];
|
value = [CPNull null];
|
||||||
|
|
||||||
newArray.push(value);
|
newArray.push(value);
|
||||||
@@ -499,11 +499,11 @@
|
|||||||
enumerator = [self objectEnumerator],
|
enumerator = [self objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var value = [object valueForKeyPath:aKeyPath];
|
var value = [object valueForKeyPath:aKeyPath];
|
||||||
|
|
||||||
if (value === nil || value === undefined)
|
if (value == nil)
|
||||||
value = [CPNull null];
|
value = [CPNull null];
|
||||||
|
|
||||||
newArray.push(value);
|
newArray.push(value);
|
||||||
@@ -518,7 +518,7 @@
|
|||||||
var enumerator = [self objectEnumerator],
|
var enumerator = [self objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
[object setValue:aValue forKey:aKey];
|
[object setValue:aValue forKey:aKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,7 +527,7 @@
|
|||||||
var enumerator = [self objectEnumerator],
|
var enumerator = [self objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
[object setValue:aValue forKeyPath:aKeyPath];
|
[object setValue:aValue forKeyPath:aKeyPath];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -527,10 +527,10 @@ var sortArrayUsingJSDescriptors = function(a, d)
|
|||||||
key = dd.k;
|
key = dd.k;
|
||||||
value1 = C1[key];
|
value1 = C1[key];
|
||||||
value2 = C2[key];
|
value2 = C2[key];
|
||||||
if (value1 === nil || value1 === cpNull)
|
if (value1 == nil || value1 === cpNull)
|
||||||
o = value2 === nil || value2 === cpNull ? CPOrderedSame : CPOrderedAscending;
|
o = value2 == nil || value2 === cpNull ? CPOrderedSame : CPOrderedAscending;
|
||||||
else
|
else
|
||||||
o = value2 === nil || value2 === cpNull ? CPOrderedDescending : value1.isa.objj_msgSend1(value1, dd.s, value2);
|
o = value2 == nil || value2 === cpNull ? CPOrderedDescending : value1.isa.objj_msgSend1(value1, dd.s, value2);
|
||||||
|
|
||||||
if (o && !dd.a)
|
if (o && !dd.a)
|
||||||
o = -o;
|
o = -o;
|
||||||
|
|||||||
@@ -708,7 +708,7 @@ Returns a hash for the object. Unlike Cocoa, the hash value does not take conten
|
|||||||
var count = [self count],
|
var count = [self count],
|
||||||
otherCount = [anArray count];
|
otherCount = [anArray count];
|
||||||
|
|
||||||
if (anArray === nil || count !== otherCount)
|
if (anArray == nil || count !== otherCount)
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
var index = 0;
|
var index = 0;
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ var concat = Array.prototype.concat,
|
|||||||
count = arguments.length;
|
count = arguments.length;
|
||||||
|
|
||||||
for (; index < count; ++index)
|
for (; index < count; ++index)
|
||||||
if (arguments[index] === nil)
|
if (arguments[index] == nil)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
return slice.call(arguments, 2, index);
|
return slice.call(arguments, 2, index);
|
||||||
|
|||||||
@@ -141,7 +141,7 @@
|
|||||||
// private method
|
// private method
|
||||||
- (unsigned)_indexOfEntryWithIndex:(unsigned)anIndex
|
- (unsigned)_indexOfEntryWithIndex:(unsigned)anIndex
|
||||||
{
|
{
|
||||||
if (anIndex < 0 || anIndex > _string.length || anIndex === undefined)
|
if (anIndex < 0 || anIndex > _string.length || anIndex == nil)
|
||||||
return CPNotFound;
|
return CPNotFound;
|
||||||
|
|
||||||
// find the range entry that contains anIndex.
|
// find the range entry that contains anIndex.
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ var CPCharacterSetInvertedKey = @"CPCharacterSetInvertedKey";
|
|||||||
enu = [_ranges objectEnumerator],
|
enu = [_ranges objectEnumerator],
|
||||||
range;
|
range;
|
||||||
|
|
||||||
while ((range = [enu nextObject]) !== nil)
|
while ((range = [enu nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if (CPLocationInRange(c, range))
|
if (CPLocationInRange(c, range))
|
||||||
return !_inverted;
|
return !_inverted;
|
||||||
@@ -265,7 +265,7 @@ var CPCharacterSetInvertedKey = @"CPCharacterSetInvertedKey";
|
|||||||
var enu = [_ranges objectEnumerator],
|
var enu = [_ranges objectEnumerator],
|
||||||
range;
|
range;
|
||||||
|
|
||||||
while ((range = [enu nextObject]) !== nil)
|
while ((range = [enu nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if (!CPEmptyRange(range))
|
if (!CPEmptyRange(range))
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
+10
-10
@@ -127,7 +127,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
|
|
||||||
var value = object[key];
|
var value = object[key];
|
||||||
|
|
||||||
if (value === null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
[dictionary setObject:[CPNull null] forKey:key];
|
[dictionary setObject:[CPNull null] forKey:key];
|
||||||
continue;
|
continue;
|
||||||
@@ -147,7 +147,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
{
|
{
|
||||||
var thisValue = value[i];
|
var thisValue = value[i];
|
||||||
|
|
||||||
if (thisValue === null)
|
if (thisValue == null)
|
||||||
{
|
{
|
||||||
newValue.push([CPNull null]);
|
newValue.push([CPNull null]);
|
||||||
}
|
}
|
||||||
@@ -234,10 +234,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
var value = objects[i],
|
var value = objects[i],
|
||||||
key = keyArray[i];
|
key = keyArray[i];
|
||||||
|
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + i + @"]"];
|
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + i + @"]"];
|
||||||
|
|
||||||
if (key === nil)
|
if (key == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + i + @"]"];
|
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + i + @"]"];
|
||||||
|
|
||||||
[self setObject:value forKey:key];
|
[self setObject:value forKey:key];
|
||||||
@@ -278,10 +278,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
var key = arguments[argCount--],
|
var key = arguments[argCount--],
|
||||||
value = arguments[argCount];
|
value = arguments[argCount];
|
||||||
|
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + ((argCount / 2) - 1) + @"]"];
|
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil object from objects[" + ((argCount / 2) - 1) + @"]"];
|
||||||
|
|
||||||
if (key === nil)
|
if (key == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + ((argCount / 2) - 1) + @"]"];
|
[CPException raise:CPInvalidArgumentException reason:@"Attempt to insert nil key from keys[" + ((argCount / 2) - 1) + @"]"];
|
||||||
|
|
||||||
[self setObject:value forKey:key];
|
[self setObject:value forKey:key];
|
||||||
@@ -593,10 +593,10 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
*/
|
*/
|
||||||
- (void)setObject:(id)anObject forKey:(id)aKey
|
- (void)setObject:(id)anObject forKey:(id)aKey
|
||||||
{
|
{
|
||||||
if (aKey === nil)
|
if (aKey == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"key cannot be nil"];
|
[CPException raise:CPInvalidArgumentException reason:@"key cannot be nil"];
|
||||||
|
|
||||||
if (anObject === nil)
|
if (anObject == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"object cannot be nil (key: " + aKey + @")"];
|
[CPException raise:CPInvalidArgumentException reason:@"object cannot be nil (key: " + aKey + @")"];
|
||||||
|
|
||||||
self.setValueForKey(aKey, anObject);
|
self.setValueForKey(aKey, anObject);
|
||||||
@@ -650,7 +650,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
- (BOOL)containsKey:(id)aKey
|
- (BOOL)containsKey:(id)aKey
|
||||||
{
|
{
|
||||||
var value = [self objectForKey:aKey];
|
var value = [self objectForKey:aKey];
|
||||||
return ((value !== nil) && (value !== undefined));
|
return (value != nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)enumerateKeysAndObjectsUsingBlock:(Function /*(id aKey, id anObject, @ref BOOL stop)*/)aFunction
|
- (void)enumerateKeysAndObjectsUsingBlock:(Function /*(id aKey, id anObject, @ref BOOL stop)*/)aFunction
|
||||||
@@ -730,7 +730,7 @@ var CPDictionaryMaxDescriptionRecursion = 10;
|
|||||||
{
|
{
|
||||||
var key = [_keyEnumerator nextObject];
|
var key = [_keyEnumerator nextObject];
|
||||||
|
|
||||||
if (key === nil)
|
if (key == nil)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
return [_dictionary objectForKey:key];
|
return [_dictionary objectForKey:key];
|
||||||
|
|||||||
@@ -159,7 +159,7 @@
|
|||||||
@deref(aPartialStringRef) = newString;
|
@deref(aPartialStringRef) = newString;
|
||||||
|
|
||||||
// If a new string is passed back, the selection is always put at the end
|
// If a new string is passed back, the selection is always put at the end
|
||||||
if (newString !== nil)
|
if (newString != nil)
|
||||||
@deref(aProposedSelectedRangeRef) = CPMakeRange(newString.length, 0);
|
@deref(aProposedSelectedRangeRef) = CPMakeRange(newString.length, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
|||||||
var key = keys[index],
|
var key = keys[index],
|
||||||
value = [self valueForKey:key];
|
value = [self valueForKey:key];
|
||||||
|
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
[dictionary setObject:[CPNull null] forKey:key];
|
[dictionary setObject:[CPNull null] forKey:key];
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -248,7 +248,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
|||||||
key,
|
key,
|
||||||
keyEnumerator = [keyedValues keyEnumerator];
|
keyEnumerator = [keyedValues keyEnumerator];
|
||||||
|
|
||||||
while ((key = [keyEnumerator nextObject]) !== nil)
|
while ((key = [keyEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
value = [keyedValues objectForKey: key];
|
value = [keyedValues objectForKey: key];
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ var CPObjectAccessorsForClassKey = @"$CPObjectAccessorsForClassKey",
|
|||||||
|
|
||||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||||
{
|
{
|
||||||
if (aValue !== nil)
|
if (aValue != nil)
|
||||||
[self setObject:aValue forKey:aKey];
|
[self setObject:aValue forKey:aKey];
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -923,7 +923,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
|||||||
{
|
{
|
||||||
var oldValue = [_targetObject valueForKey:aKey];
|
var oldValue = [_targetObject valueForKey:aKey];
|
||||||
|
|
||||||
if (oldValue === nil || oldValue === undefined)
|
if (oldValue == nil)
|
||||||
oldValue = [CPNull null];
|
oldValue = [CPNull null];
|
||||||
|
|
||||||
[changes setObject:oldValue forKey:CPKeyValueChangeOldKey];
|
[changes setObject:oldValue forKey:CPKeyValueChangeOldKey];
|
||||||
@@ -1005,7 +1005,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOpti
|
|||||||
{
|
{
|
||||||
var newValue = [_targetObject valueForKey:aKey];
|
var newValue = [_targetObject valueForKey:aKey];
|
||||||
|
|
||||||
if (newValue === nil || newValue === undefined)
|
if (newValue == nil)
|
||||||
newValue = [CPNull null];
|
newValue = [CPNull null];
|
||||||
|
|
||||||
[changes setObject:newValue forKey:CPKeyValueChangeNewKey];
|
[changes setObject:newValue forKey:CPKeyValueChangeNewKey];
|
||||||
|
|||||||
@@ -395,7 +395,7 @@ var _CPKeyedArchiverStringClass = Nil,
|
|||||||
keys = [aDictionary keyEnumerator],
|
keys = [aDictionary keyEnumerator],
|
||||||
references = @{};
|
references = @{};
|
||||||
|
|
||||||
while ((key = [keys nextObject]) !== nil)
|
while ((key = [keys nextObject]) != nil)
|
||||||
[references setObject:_CPKeyedArchiverEncodeObject(self, [aDictionary objectForKey:key], NO) forKey:key];
|
[references setObject:_CPKeyedArchiverEncodeObject(self, [aDictionary objectForKey:key], NO) forKey:key];
|
||||||
|
|
||||||
[_plistObject setObject:references forKey:aKey];
|
[_plistObject setObject:references forKey:aKey];
|
||||||
@@ -471,7 +471,7 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
|||||||
// We wrap primitive JavaScript objects in a unique subclass of CPValue.
|
// We wrap primitive JavaScript objects in a unique subclass of CPValue.
|
||||||
// This way, when we unarchive, we know to unwrap it, since
|
// This way, when we unarchive, we know to unwrap it, since
|
||||||
// _CPKeyedArchiverValue should not be used anywhere else.
|
// _CPKeyedArchiverValue should not be used anywhere else.
|
||||||
if (anObject !== nil && anObject !== undefined && !anObject.isa)
|
if (anObject != nil && !anObject.isa)
|
||||||
anObject = [_CPKeyedArchiverValue valueWithJSObject:anObject];
|
anObject = [_CPKeyedArchiverValue valueWithJSObject:anObject];
|
||||||
|
|
||||||
// Get the proper replacement object
|
// Get the proper replacement object
|
||||||
@@ -479,8 +479,8 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
|||||||
object = [self._replacementObjects objectForKey:GUID];
|
object = [self._replacementObjects objectForKey:GUID];
|
||||||
|
|
||||||
// If a replacement object doesn't exist, then actually ask for one.
|
// If a replacement object doesn't exist, then actually ask for one.
|
||||||
// Explicitly compare to nil because object could be === 0.
|
// Explicitly compare to nil and undefined because object could be === 0.
|
||||||
if (object === nil)
|
if (object == nil)
|
||||||
{
|
{
|
||||||
object = [anObject replacementObjectForKeyedArchiver:self];
|
object = [anObject replacementObjectForKeyedArchiver:self];
|
||||||
|
|
||||||
@@ -507,8 +507,8 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
|||||||
|
|
||||||
// If we still don't have an object by this point, then return a
|
// If we still don't have an object by this point, then return a
|
||||||
// reference to the null object.
|
// reference to the null object.
|
||||||
// Explicitly compare to nil because object could be === 0.
|
// Explicitly compare to nil and undefined because object could be === 0.
|
||||||
if (object === nil)
|
if (object == nil)
|
||||||
return _CPKeyedArchiverNullReference;
|
return _CPKeyedArchiverNullReference;
|
||||||
|
|
||||||
// If not, then grab the object's UID
|
// If not, then grab the object's UID
|
||||||
@@ -517,13 +517,13 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
|||||||
// If this object doesn't have a unique index in the object table yet,
|
// If this object doesn't have a unique index in the object table yet,
|
||||||
// then it also hasn't been properly encoded. We explicitly compare
|
// then it also hasn't been properly encoded. We explicitly compare
|
||||||
// index to nil since it could be 0, which would also evaluate to false.
|
// index to nil since it could be 0, which would also evaluate to false.
|
||||||
if (UID === nil)
|
if (UID == nil)
|
||||||
{
|
{
|
||||||
// If it is being conditionally encoded, then
|
// If it is being conditionally encoded, then
|
||||||
if (isConditional)
|
if (isConditional)
|
||||||
{
|
{
|
||||||
// If we haven't already noted this conditional object...
|
// If we haven't already noted this conditional object...
|
||||||
if ((UID = [self._conditionalUIDs objectForKey:GUID]) === nil)
|
if ((UID = [self._conditionalUIDs objectForKey:GUID]) == nil)
|
||||||
{
|
{
|
||||||
// Use the null object as a placeholder.
|
// Use the null object as a placeholder.
|
||||||
[self._conditionalUIDs setObject:UID = [self._plistObjects count] forKey:GUID];
|
[self._conditionalUIDs setObject:UID = [self._plistObjects count] forKey:GUID];
|
||||||
@@ -581,7 +581,7 @@ var _CPKeyedArchiverEncodeObject = function(self, anObject, isConditional)
|
|||||||
UID = [self._conditionalUIDs objectForKey:GUID];
|
UID = [self._conditionalUIDs objectForKey:GUID];
|
||||||
|
|
||||||
// If this object WAS previously encoded conditionally...
|
// If this object WAS previously encoded conditionally...
|
||||||
if (UID !== nil)
|
if (UID != nil)
|
||||||
{
|
{
|
||||||
[self._UIDs setObject:UID forKey:GUID];
|
[self._UIDs setObject:UID forKey:GUID];
|
||||||
[self._plistObjects replaceObjectAtIndex:UID withObject:plistObject];
|
[self._plistObjects replaceObjectAtIndex:UID withObject:plistObject];
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ var CPArrayClass = Ni
|
|||||||
{
|
{
|
||||||
var f = [self decodeObjectForKey:aKey];
|
var f = [self decodeObjectForKey:aKey];
|
||||||
|
|
||||||
return f === nil ? 0.0 : f;
|
return f == nil ? 0.0 : f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -265,7 +265,7 @@ var CPArrayClass = Ni
|
|||||||
{
|
{
|
||||||
var d = [self decodeObjectForKey:aKey];
|
var d = [self decodeObjectForKey:aKey];
|
||||||
|
|
||||||
return d === nil ? 0.0 : d;
|
return d == nil ? 0.0 : d;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -277,7 +277,7 @@ var CPArrayClass = Ni
|
|||||||
{
|
{
|
||||||
var i = [self decodeObjectForKey:aKey];
|
var i = [self decodeObjectForKey:aKey];
|
||||||
|
|
||||||
return i === nil ? 0 : i;
|
return i == nil ? 0 : i;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ var CPNotificationDefaultCenter = nil;
|
|||||||
var name = nil,
|
var name = nil,
|
||||||
names = [_namedRegistries keyEnumerator];
|
names = [_namedRegistries keyEnumerator];
|
||||||
|
|
||||||
while ((name = [names nextObject]) !== nil)
|
while ((name = [names nextObject]) != nil)
|
||||||
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:nil];
|
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:nil];
|
||||||
|
|
||||||
[_unnamedRegistry removeObserver:anObserver object:nil];
|
[_unnamedRegistry removeObserver:anObserver object:nil];
|
||||||
@@ -155,7 +155,7 @@ var CPNotificationDefaultCenter = nil;
|
|||||||
var name = nil,
|
var name = nil,
|
||||||
names = [_namedRegistries keyEnumerator];
|
names = [_namedRegistries keyEnumerator];
|
||||||
|
|
||||||
while ((name = [names nextObject]) !== nil)
|
while ((name = [names nextObject]) != nil)
|
||||||
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:anObject];
|
[[_namedRegistries objectForKey:name] removeObserver:anObserver object:anObject];
|
||||||
|
|
||||||
[_unnamedRegistry removeObserver:anObserver object:anObject];
|
[_unnamedRegistry removeObserver:anObserver object:anObject];
|
||||||
@@ -258,13 +258,13 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
|||||||
keys = [_objectObservers keyEnumerator];
|
keys = [_objectObservers keyEnumerator];
|
||||||
|
|
||||||
// Iterate through every set of observers
|
// Iterate through every set of observers
|
||||||
while ((key = [keys nextObject]) !== nil)
|
while ((key = [keys nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var observers = [_objectObservers objectForKey:key],
|
var observers = [_objectObservers objectForKey:key],
|
||||||
observer = nil,
|
observer = nil,
|
||||||
observersEnumerator = [observers objectEnumerator];
|
observersEnumerator = [observers objectEnumerator];
|
||||||
|
|
||||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||||
if ([observer observer] == anObserver ||
|
if ([observer observer] == anObserver ||
|
||||||
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
||||||
[observers removeObject:observer];
|
[observers removeObject:observer];
|
||||||
@@ -280,7 +280,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
|||||||
observer = nil,
|
observer = nil,
|
||||||
observersEnumerator = [observers objectEnumerator];
|
observersEnumerator = [observers objectEnumerator];
|
||||||
|
|
||||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||||
if ([observer observer] == anObserver ||
|
if ([observer observer] == anObserver ||
|
||||||
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
([observer block] && [anObserver respondsToSelector:@selector(block)] && [observer block] == [anObserver block]))
|
||||||
[observers removeObject:observer];
|
[observers removeObject:observer];
|
||||||
@@ -311,7 +311,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
|||||||
observer = nil,
|
observer = nil,
|
||||||
observersEnumerator = [observers objectEnumerator];
|
observersEnumerator = [observers objectEnumerator];
|
||||||
|
|
||||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
// CPSet containsObject is N(1) so this is a fast check.
|
// CPSet containsObject is N(1) so this is a fast check.
|
||||||
if ([currentObservers containsObject:observer])
|
if ([currentObservers containsObject:observer])
|
||||||
@@ -328,7 +328,7 @@ var _CPNotificationCenterPostNotification = function(/* CPNotificationCenter */
|
|||||||
var observers = [currentObservers copy],
|
var observers = [currentObservers copy],
|
||||||
observersEnumerator = [observers objectEnumerator];
|
observersEnumerator = [observers objectEnumerator];
|
||||||
|
|
||||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
// CPSet containsObject is N(1) so this is a fast check.
|
// CPSet containsObject is N(1) so this is a fast check.
|
||||||
if ([currentObservers containsObject:observer])
|
if ([currentObservers containsObject:observer])
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ FIXME: Do we need this?
|
|||||||
|
|
||||||
- (CPComparisonResult)compare:(CPNumber)aNumber
|
- (CPComparisonResult)compare:(CPNumber)aNumber
|
||||||
{
|
{
|
||||||
if (aNumber === nil || aNumber['isa'] === CPNull)
|
if (aNumber == nil || aNumber['isa'] === CPNull)
|
||||||
[CPException raise:CPInvalidArgumentException reason:"nil argument"];
|
[CPException raise:CPInvalidArgumentException reason:"nil argument"];
|
||||||
|
|
||||||
if (self > aNumber)
|
if (self > aNumber)
|
||||||
|
|||||||
@@ -205,9 +205,9 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
|||||||
// this will return false if we've received anything but a number, most likely NaN
|
// this will return false if we've received anything but a number, most likely NaN
|
||||||
if (!isFinite(value))
|
if (!isFinite(value))
|
||||||
error = @"Value is not a number";
|
error = @"Value is not a number";
|
||||||
else if (_minimum !== nil && value < _minimum)
|
else if (_minimum != nil && value < _minimum)
|
||||||
error = @"Value is less than the minimum allowed value";
|
error = @"Value is less than the minimum allowed value";
|
||||||
else if (_maximum !== nil && value > _maximum)
|
else if (_maximum != nil && value > _maximum)
|
||||||
error = @"Value is greater than the maximum allowed value";
|
error = @"Value is greater than the maximum allowed value";
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
|||||||
@@ -275,7 +275,7 @@
|
|||||||
if (self === anObject)
|
if (self === anObject)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (anObject === nil || anObject.isa !== self.isa || _modifier !== [anObject comparisonPredicateModifier] || _type !== [anObject predicateOperatorType] || _options !== [anObject options] || _customSelector !== [anObject customSelector] || ![_left isEqual:[anObject leftExpression]] || ![_right isEqual:[anObject rightExpression]])
|
if (anObject == nil || anObject.isa !== self.isa || _modifier !== [anObject comparisonPredicateModifier] || _type !== [anObject predicateOperatorType] || _options !== [anObject options] || _customSelector !== [anObject customSelector] || ![_left isEqual:[anObject leftExpression]] || ![_right isEqual:[anObject rightExpression]])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
result = (_modifier == CPAllPredicateModifier),
|
result = (_modifier == CPAllPredicateModifier),
|
||||||
value;
|
value;
|
||||||
|
|
||||||
while ((value = [e nextObject]) !== nil)
|
while ((value = [e nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var eval = [self _evaluateValue:value rightValue:rightValue];
|
var eval = [self _evaluateValue:value rightValue:rightValue];
|
||||||
|
|
||||||
|
|||||||
@@ -215,7 +215,7 @@
|
|||||||
if (self === anObject)
|
if (self === anObject)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (anObject === nil || anObject.isa !== self.isa || _type !== [anObject compoundPredicateType] || ![_predicates isEqualToArray:[anObject subpredicates]])
|
if (anObject == nil || anObject.isa !== self.isa || _type !== [anObject compoundPredicateType] || ![_predicates isEqualToArray:[anObject subpredicates]])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object collection] isEqual:_aggregate])
|
if (object == nil || object.isa !== self.isa || ![[object collection] isEqual:_aggregate])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (CPString)description
|
- (CPString)description
|
||||||
{
|
{
|
||||||
var descriptions = [_aggregate arrayByApplyingBlock:function(exp)
|
var descriptions = [_aggregate arrayByApplyingBlock:function(exp)
|
||||||
{
|
{
|
||||||
return [exp description];
|
return [exp description];
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || [object expressionBlock] !== _block || ![[object arguments] isEqual:_arguments])
|
if (object == nil || object.isa !== self.isa || [object expressionBlock] !== _block || ![[object arguments] isEqual:_arguments])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object predicate] isEqual:_predicate] || ![[object trueExpression] isEqual:_trueExpression] || ![[object falseExpression] isEqual:_falseExpression])
|
if (object == nil || object.isa !== self.isa || ![[object predicate] isEqual:_predicate] || ![[object trueExpression] isEqual:_trueExpression] || ![[object falseExpression] isEqual:_falseExpression])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object constantValue] isEqual:_value])
|
if (object == nil || object.isa !== self.isa || ![[object constantValue] isEqual:_value])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -72,7 +72,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object _function] isEqual:_selector] || ![[object operand] isEqual:_operand] || ![[object arguments] isEqualToArray:_arguments])
|
if (object == nil || object.isa !== self.isa || ![[object _function] isEqual:_selector] || ![[object operand] isEqual:_operand] || ![[object arguments] isEqualToArray:_arguments])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
if (object === self)
|
if (object === self)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object keyPath] isEqualToString:[self keyPath]])
|
if (object == nil || object.isa !== self.isa || ![[object keyPath] isEqualToString:[self keyPath]])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@
|
|||||||
if (self === anObject)
|
if (self === anObject)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (anObject === nil || self.isa !== anObject.isa || _value !== [anObject evaluateWithObject:nil])
|
if (anObject == nil || self.isa !== anObject.isa || _value !== [anObject evaluateWithObject:nil])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object leftExpression] isEqual:_left] || ![[object rightExpression] isEqual:_right])
|
if (object == nil || object.isa !== self.isa || ![[object leftExpression] isEqual:_left] || ![[object rightExpression] isEqual:_right])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![_collection isEqual:[object collection]] || ![_variableExpression isEqual:[object variableExpression]] || ![_subpredicate isEqual:[object predicate]])
|
if (object == nil || object.isa !== self.isa || ![_collection isEqual:[object collection]] || ![_variableExpression isEqual:[object variableExpression]] || ![_subpredicate isEqual:[object predicate]])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
if (self === object)
|
if (self === object)
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
if (object === nil || object.isa !== self.isa || ![[object variable] isEqual:_variable])
|
if (object == nil || object.isa !== self.isa || ![[object variable] isEqual:_variable])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
|
|||||||
@@ -373,7 +373,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
|||||||
_didAddTimer = NO;
|
_didAddTimer = NO;
|
||||||
|
|
||||||
// Cancel existing window.setTimeout
|
// Cancel existing window.setTimeout
|
||||||
if (_nativeTimersForModes[aMode] !== nil)
|
if (_nativeTimersForModes[aMode] != nil)
|
||||||
{
|
{
|
||||||
window.clearNativeTimeout(_nativeTimersForModes[aMode]);
|
window.clearNativeTimeout(_nativeTimersForModes[aMode]);
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
|||||||
|
|
||||||
// Timer may or may not still be valid
|
// Timer may or may not still be valid
|
||||||
if (timer._isValid)
|
if (timer._isValid)
|
||||||
nextFireDate = (nextFireDate === nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
nextFireDate = (nextFireDate == nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -425,7 +425,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
|||||||
var timer = newTimers[index];
|
var timer = newTimers[index];
|
||||||
|
|
||||||
if ([timer isValid])
|
if ([timer isValid])
|
||||||
nextFireDate = (nextFireDate === nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
nextFireDate = (nextFireDate == nil) ? timer._fireDate : [nextFireDate earlierDate:timer._fireDate];
|
||||||
else
|
else
|
||||||
newTimers.splice(index, 1);
|
newTimers.splice(index, 1);
|
||||||
}
|
}
|
||||||
@@ -438,7 +438,7 @@ var CPRunLoopLastNativeRunLoop = 0;
|
|||||||
_nextTimerFireDatesForModes[aMode] = nextFireDate;
|
_nextTimerFireDatesForModes[aMode] = nextFireDate;
|
||||||
|
|
||||||
//initiate a new window.setTimeout if there are any timers
|
//initiate a new window.setTimeout if there are any timers
|
||||||
if (_nextTimerFireDatesForModes[aMode] !== nil)
|
if (_nextTimerFireDatesForModes[aMode] != nil)
|
||||||
_nativeTimersForModes[aMode] = window.setNativeTimeout(function()
|
_nativeTimersForModes[aMode] = window.setNativeTimeout(function()
|
||||||
{
|
{
|
||||||
_effectiveDate = nextFireDate;
|
_effectiveDate = nextFireDate;
|
||||||
|
|||||||
@@ -221,7 +221,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [objects objectEnumerator];
|
objectEnumerator = [objects objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
_add(_proxyObject, _addSEL, object);
|
_add(_proxyObject, _addSEL, object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -241,7 +241,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [aSet objectEnumerator];
|
objectEnumerator = [aSet objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
_add(_proxyObject, _addSEL, object);
|
_add(_proxyObject, _addSEL, object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -278,7 +278,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [aSet objectEnumerator];
|
objectEnumerator = [aSet objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
_remove(_proxyObject, _removeSEL, object);
|
_remove(_proxyObject, _removeSEL, object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -301,7 +301,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [objects objectEnumerator];
|
objectEnumerator = [objects objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
_remove(_proxyObject, _removeSEL, object);
|
_remove(_proxyObject, _removeSEL, object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -324,7 +324,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
|
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
_remove(_proxyObject, _removeSEL, object);
|
_remove(_proxyObject, _removeSEL, object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -414,11 +414,11 @@
|
|||||||
containedObjectValue,
|
containedObjectValue,
|
||||||
containedObjectEnumerator = [self objectEnumerator];
|
containedObjectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((containedObject = [containedObjectEnumerator nextObject]) !== nil)
|
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
|
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
|
||||||
|
|
||||||
if (containedObjectValue === nil || containedObjectValue === undefined)
|
if (containedObjectValue == nil)
|
||||||
containedObjectValue = [CPNull null];
|
containedObjectValue = [CPNull null];
|
||||||
|
|
||||||
[valuesForKeySet addObject:containedObjectValue];
|
[valuesForKeySet addObject:containedObjectValue];
|
||||||
@@ -433,7 +433,7 @@
|
|||||||
var containedObject,
|
var containedObject,
|
||||||
containedObjectEnumerator = [self objectEnumerator];
|
containedObjectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((containedObject = [containedObjectEnumerator nextObject]) !== nil)
|
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||||
[containedObject setValue:aValue forKey:aKey];
|
[containedObject setValue:aValue forKey:aKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if (![aPredicate evaluateWithObject:object])
|
if (![aPredicate evaluateWithObject:object])
|
||||||
[self removeObject:object];
|
[self removeObject:object];
|
||||||
}
|
}
|
||||||
@@ -72,7 +72,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
[self removeObject:object];
|
[self removeObject:object];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [aSet objectEnumerator];
|
objectEnumerator = [aSet objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
[self addObject:object];
|
[self addObject:object];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [aSet objectEnumerator];
|
objectEnumerator = [aSet objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
[self removeObject:object];
|
[self removeObject:object];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
objectEnumerator = [self objectEnumerator],
|
objectEnumerator = [self objectEnumerator],
|
||||||
objectsToRemove = [];
|
objectsToRemove = [];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if (![aSet containsObject:object])
|
if (![aSet containsObject:object])
|
||||||
objectsToRemove.push(object);
|
objectsToRemove.push(object);
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|||||||
*/
|
*/
|
||||||
- (void)addObject:(id)anObject
|
- (void)addObject:(id)anObject
|
||||||
{
|
{
|
||||||
if (anObject === nil || anObject === undefined)
|
if (anObject == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"attempt to insert nil or undefined"];
|
[CPException raise:CPInvalidArgumentException reason:@"attempt to insert nil or undefined"];
|
||||||
|
|
||||||
if ([self containsObject:anObject])
|
if ([self containsObject:anObject])
|
||||||
@@ -109,14 +109,14 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|||||||
- (void)removeObject:(id)anObject
|
- (void)removeObject:(id)anObject
|
||||||
{
|
{
|
||||||
// Removing nil is an error.
|
// Removing nil is an error.
|
||||||
if (anObject === nil || anObject === undefined)
|
if (anObject == nil)
|
||||||
[CPException raise:CPInvalidArgumentException reason:@"attempt to remove nil or undefined"];
|
[CPException raise:CPInvalidArgumentException reason:@"attempt to remove nil or undefined"];
|
||||||
|
|
||||||
// anObject might be isEqual: another object in the set. We need the exact instance so we can remove it by UID.
|
// anObject might be isEqual: another object in the set. We need the exact instance so we can remove it by UID.
|
||||||
var object = [self member:anObject];
|
var object = [self member:anObject];
|
||||||
|
|
||||||
// ...but removing an object not present in the set is not an error.
|
// ...but removing an object not present in the set is not an error.
|
||||||
if (object !== nil)
|
if (object != nil)
|
||||||
{
|
{
|
||||||
delete _contents[[object UID]];
|
delete _contents[[object UID]];
|
||||||
_count--;
|
_count--;
|
||||||
|
|||||||
@@ -224,7 +224,7 @@
|
|||||||
object,
|
object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
objects.push(object);
|
objects.push(object);
|
||||||
|
|
||||||
return objects;
|
return objects;
|
||||||
@@ -244,7 +244,7 @@
|
|||||||
*/
|
*/
|
||||||
- (BOOL)containsObject:(id)anObject
|
- (BOOL)containsObject:(id)anObject
|
||||||
{
|
{
|
||||||
return [self member:anObject] !== nil;
|
return [self member:anObject] != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -257,7 +257,7 @@
|
|||||||
object,
|
object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if ([aPredicate evaluateWithObject:object])
|
if ([aPredicate evaluateWithObject:object])
|
||||||
objects.push(object);
|
objects.push(object);
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@
|
|||||||
objectEnumerator = [self objectEnumerator],
|
objectEnumerator = [self objectEnumerator],
|
||||||
argumentsArray = [nil, aSelector].concat(objects || []);
|
argumentsArray = [nil, aSelector].concat(objects || []);
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
argumentsArray[0] = object;
|
argumentsArray[0] = object;
|
||||||
objj_msgSend.apply(this, argumentsArray);
|
objj_msgSend.apply(this, argumentsArray);
|
||||||
@@ -342,7 +342,7 @@
|
|||||||
object = nil,
|
object = nil,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if (aFunction(object))
|
if (aFunction(object))
|
||||||
objects.push(object);
|
objects.push(object);
|
||||||
|
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
var object = nil,
|
var object = nil,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if (![aSet containsObject:object])
|
if (![aSet containsObject:object])
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
@@ -378,7 +378,7 @@
|
|||||||
var object = nil,
|
var object = nil,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
if ([aSet containsObject:object])
|
if ([aSet containsObject:object])
|
||||||
return YES;
|
return YES;
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
|||||||
object,
|
object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var value = [object valueForKey:aKey];
|
var value = [object valueForKey:aKey];
|
||||||
|
|
||||||
@@ -492,7 +492,7 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
|||||||
var object,
|
var object,
|
||||||
objectEnumerator = [self objectEnumerator];
|
objectEnumerator = [self objectEnumerator];
|
||||||
|
|
||||||
while ((object = [objectEnumerator nextObject]) !== nil)
|
while ((object = [objectEnumerator nextObject]) != nil)
|
||||||
[object setValue:aValue forKey:aKey];
|
[object setValue:aValue forKey:aKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -515,7 +515,7 @@ var CPStringNull = [CPNull null];
|
|||||||
*/
|
*/
|
||||||
- (CPComparisonResult)compare:(CPString)aString options:(int)aMask
|
- (CPComparisonResult)compare:(CPString)aString options:(int)aMask
|
||||||
{
|
{
|
||||||
if (aString === nil)
|
if (aString == nil)
|
||||||
return CPOrderedDescending;
|
return CPOrderedDescending;
|
||||||
|
|
||||||
if (aString === CPStringNull)
|
if (aString === CPStringNull)
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ var CPURLConnectionDelegate = nil;
|
|||||||
key = nil,
|
key = nil,
|
||||||
keys = [fields keyEnumerator];
|
keys = [fields keyEnumerator];
|
||||||
|
|
||||||
while ((key = [keys nextObject]) !== nil)
|
while ((key = [keys nextObject]) != nil)
|
||||||
aCFHTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
aCFHTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
||||||
|
|
||||||
aCFHTTPRequest.send([aRequest HTTPBody]);
|
aCFHTTPRequest.send([aRequest HTTPBody]);
|
||||||
@@ -259,7 +259,7 @@ var CPURLConnectionDelegate = nil;
|
|||||||
key = nil,
|
key = nil,
|
||||||
keys = [fields keyEnumerator];
|
keys = [fields keyEnumerator];
|
||||||
|
|
||||||
while ((key = [keys nextObject]) !== nil)
|
while ((key = [keys nextObject]) != nil)
|
||||||
_HTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
_HTTPRequest.setRequestHeader(key, [fields objectForKey:key]);
|
||||||
|
|
||||||
_HTTPRequest.send([_request HTTPBody]);
|
_HTTPRequest.send([_request HTTPBody]);
|
||||||
@@ -274,7 +274,7 @@ var CPURLConnectionDelegate = nil;
|
|||||||
{
|
{
|
||||||
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
||||||
[_delegate connection:self didFailWithError:anException];
|
[_delegate connection:self didFailWithError:anException];
|
||||||
else if (_connectionOperation !== nil)
|
else if (_connectionOperation != nil)
|
||||||
[self _connectionOperationDidReceiveResponse:nil data:nil error:anException];
|
[self _connectionOperationDidReceiveResponse:nil data:nil error:anException];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,7 +344,7 @@ var CPURLConnectionDelegate = nil;
|
|||||||
{
|
{
|
||||||
if ([_delegate respondsToSelector:@selector(connection:didReceiveData:)])
|
if ([_delegate respondsToSelector:@selector(connection:didReceiveData:)])
|
||||||
[_delegate connection:self didReceiveData:_HTTPRequest.responseText()];
|
[_delegate connection:self didReceiveData:_HTTPRequest.responseText()];
|
||||||
else if (_connectionOperation !== nil)
|
else if (_connectionOperation != nil)
|
||||||
[self _connectionOperationDidReceiveResponse:response data:_HTTPRequest.responseText() error:nil];
|
[self _connectionOperationDidReceiveResponse:response data:_HTTPRequest.responseText() error:nil];
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:@selector(connectionDidFinishLoading:)])
|
if ([_delegate respondsToSelector:@selector(connectionDidFinishLoading:)])
|
||||||
|
|||||||
@@ -657,7 +657,7 @@ if (_currentGroup == nil)
|
|||||||
*/
|
*/
|
||||||
- (void)setActionName:(CPString)anActionName
|
- (void)setActionName:(CPString)anActionName
|
||||||
{
|
{
|
||||||
if (anActionName !== nil && _currentGrouping)
|
if (anActionName != nil && _currentGrouping)
|
||||||
[_currentGrouping setActionName:anActionName];
|
[_currentGrouping setActionName:anActionName];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +827,7 @@ if (_currentGroup == nil)
|
|||||||
// Don't add no-ops to the undo stack.
|
// Don't add no-ops to the undo stack.
|
||||||
var before = [aChange valueForKey:CPKeyValueChangeOldKey],
|
var before = [aChange valueForKey:CPKeyValueChangeOldKey],
|
||||||
after = [aChange valueForKey:CPKeyValueChangeNewKey];
|
after = [aChange valueForKey:CPKeyValueChangeNewKey];
|
||||||
if (before === after || (before !== nil && before.isa && (after === nil || after.isa) && [before isEqual:after]))
|
if (before === after || (before != nil && before.isa && (after == nil || after.isa) && [before isEqual:after]))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
[[self prepareWithInvocationTarget:anObject]
|
[[self prepareWithInvocationTarget:anObject]
|
||||||
|
|||||||
@@ -342,7 +342,7 @@ var StandardUserDefaults;
|
|||||||
var data = [[self persistentStoreForDomain:aDomain] data],
|
var data = [[self persistentStoreForDomain:aDomain] data],
|
||||||
domain = data ? [CPKeyedUnarchiver unarchiveObjectWithData:data] : nil;
|
domain = data ? [CPKeyedUnarchiver unarchiveObjectWithData:data] : nil;
|
||||||
|
|
||||||
if (domain === nil)
|
if (domain == nil)
|
||||||
[_domains removeObjectForKey:aDomain];
|
[_domains removeObjectForKey:aDomain];
|
||||||
else
|
else
|
||||||
[_domains setObject:domain forKey:aDomain];
|
[_domains setObject:domain forKey:aDomain];
|
||||||
@@ -438,7 +438,7 @@ var StandardUserDefaults;
|
|||||||
- (float)floatForKey:(CPString)aKey
|
- (float)floatForKey:(CPString)aKey
|
||||||
{
|
{
|
||||||
var value = [self objectForKey:aKey];
|
var value = [self objectForKey:aKey];
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ([value respondsToSelector:@selector(floatValue)])
|
if ([value respondsToSelector:@selector(floatValue)])
|
||||||
@@ -453,7 +453,7 @@ var StandardUserDefaults;
|
|||||||
- (int)integerForKey:(CPString)aKey
|
- (int)integerForKey:(CPString)aKey
|
||||||
{
|
{
|
||||||
var value = [self objectForKey:aKey];
|
var value = [self objectForKey:aKey];
|
||||||
if (value === nil)
|
if (value == nil)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ([value respondsToSelector:@selector(intValue)])
|
if ([value respondsToSelector:@selector(intValue)])
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ var transformerMap = @{};
|
|||||||
|
|
||||||
- (id)transformedValue:(id)aValue
|
- (id)transformedValue:(id)aValue
|
||||||
{
|
{
|
||||||
return aValue === nil || aValue === undefined;
|
return aValue == nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -156,7 +156,7 @@ var transformerMap = @{};
|
|||||||
|
|
||||||
- (id)transformedValue:(id)aValue
|
- (id)transformedValue:(id)aValue
|
||||||
{
|
{
|
||||||
return aValue !== nil && aValue !== undefined;
|
return aValue != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ var setURLResourceValuesForKeysFromProperties = function(aURL, keys, properties)
|
|||||||
|
|
||||||
var displayName = [properties objectForKey:@"displayname"];
|
var displayName = [properties objectForKey:@"displayname"];
|
||||||
|
|
||||||
if (displayName !== nil)
|
if (displayName != nil)
|
||||||
{
|
{
|
||||||
[aURL setResourceValue:displayName forKey:CPURLNameKey];
|
[aURL setResourceValue:displayName forKey:CPURLNameKey];
|
||||||
[aURL setResourceValue:displayName forKey:CPURLLocalizedNameKey];
|
[aURL setResourceValue:displayName forKey:CPURLLocalizedNameKey];
|
||||||
@@ -84,7 +84,7 @@ CPWebDAVManagerNonCollectionResourceType = 0;
|
|||||||
URLString = nil,
|
URLString = nil,
|
||||||
URLStrings = [response keyEnumerator];
|
URLStrings = [response keyEnumerator];
|
||||||
|
|
||||||
while ((URLString = [URLStrings nextObject]) !== nil)
|
while ((URLString = [URLStrings nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var URL = [CPURL URLWithString:URLString],
|
var URL = [CPURL URLWithString:URLString],
|
||||||
properties = [response objectForKey:URLString];
|
properties = [response objectForKey:URLString];
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
enumerator = [objects objectEnumerator],
|
enumerator = [objects objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
average += [object doubleValue];
|
average += [object doubleValue];
|
||||||
|
|
||||||
return average / [objects count];
|
return average / [objects count];
|
||||||
@@ -72,7 +72,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
min = [enumerator nextObject],
|
min = [enumerator nextObject],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([min compare:object] > 0)
|
if ([min compare:object] > 0)
|
||||||
min = object;
|
min = object;
|
||||||
@@ -95,7 +95,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
max = [enumerator nextObject],
|
max = [enumerator nextObject],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([max compare:object] < 0)
|
if ([max compare:object] < 0)
|
||||||
max = object;
|
max = object;
|
||||||
@@ -114,7 +114,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
enumerator = [objects objectEnumerator],
|
enumerator = [objects objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
sum += [object doubleValue];
|
sum += [object doubleValue];
|
||||||
|
|
||||||
return sum;
|
return sum;
|
||||||
@@ -148,7 +148,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
enumerator = [objects objectEnumerator],
|
enumerator = [objects objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
||||||
[distinctObjects addObject:object];
|
[distinctObjects addObject:object];
|
||||||
@@ -186,7 +186,7 @@ var _CPCollectionKVCOperatorSimpleRE = new RegExp("^@(avg|count|m(ax|in)|sum|uni
|
|||||||
enumerator = [objects objectEnumerator],
|
enumerator = [objects objectEnumerator],
|
||||||
object;
|
object;
|
||||||
|
|
||||||
while ((object = [enumerator nextObject]) !== nil)
|
while ((object = [enumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
if ([distinctObjects indexOfObject:object] == CPNotFound)
|
||||||
[distinctObjects addObject:object];
|
[distinctObjects addObject:object];
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ DISPLAY_NAME(CFMutableDictionary.prototype.replaceValueForKey);
|
|||||||
|
|
||||||
CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
CFMutableDictionary.prototype.setValueForKey = function(/*String*/ aKey, /*Object*/ aValue)
|
||||||
{
|
{
|
||||||
if (aValue === nil || aValue === undefined)
|
if (aValue == nil)
|
||||||
this.removeValueForKey(aKey);
|
this.removeValueForKey(aKey);
|
||||||
|
|
||||||
else if (this.containsKey(aKey))
|
else if (this.containsKey(aKey))
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
notifications = [],
|
notifications = [],
|
||||||
name;
|
name;
|
||||||
|
|
||||||
while ((name = [names nextObject]) !== nil)
|
while ((name = [names nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var notificationRegistry = [defaultCenter._namedRegistries objectForKey:name],
|
var notificationRegistry = [defaultCenter._namedRegistries objectForKey:name],
|
||||||
objectObservers = notificationRegistry._objectObservers,
|
objectObservers = notificationRegistry._objectObservers,
|
||||||
@@ -19,13 +19,13 @@
|
|||||||
key;
|
key;
|
||||||
|
|
||||||
// Iterate through every set of observers
|
// Iterate through every set of observers
|
||||||
while ((key = [keys nextObject]) !== nil)
|
while ((key = [keys nextObject]) != nil)
|
||||||
{
|
{
|
||||||
var observers = [objectObservers objectForKey:key],
|
var observers = [objectObservers objectForKey:key],
|
||||||
observer = nil,
|
observer = nil,
|
||||||
observersEnumerator = [observers objectEnumerator];
|
observersEnumerator = [observers objectEnumerator];
|
||||||
|
|
||||||
while ((observer = [observersEnumerator nextObject]) !== nil)
|
while ((observer = [observersEnumerator nextObject]) != nil)
|
||||||
{
|
{
|
||||||
if ([observer observer] == anObserver)
|
if ([observer observer] == anObserver)
|
||||||
[notifications addObject:name];
|
[notifications addObject:name];
|
||||||
|
|||||||
Reference in New Issue
Block a user