mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-06 04:35:32 +00:00
fixed: usage of tab character instead of 4 spaces
This commit is contained in:
1 parent
3b09a5bde6
commit
567ec55875
19 files changed
+749
-749
No files matched your search
@@ -3088,8 +3088,8 @@ var CPTextViewAllowsUndoKey = @"CPTextViewAllowsUndoKey",
|
||||
{
|
||||
var rect = [_textView._layoutManager boundingRectForGlyphRange:CPMakeRange(aLoc, 1) inTextContainer:_textView._textContainer];
|
||||
|
||||
if (aLoc >= [_textView._layoutManager numberOfCharacters])
|
||||
rect.origin.x = CGRectGetMaxX(rect);
|
||||
if (aLoc >= [_textView._layoutManager numberOfCharacters])
|
||||
rect.origin.x = CGRectGetMaxX(rect);
|
||||
|
||||
[self setRect:rect];
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ function _points2twips(a) { return (a) * 20.0; }
|
||||
|
||||
if (!num)
|
||||
[colorDict setObject:num = [CPNumber numberWithInt:[colorDict count] + 1]
|
||||
forKey:[color cssString]];
|
||||
forKey:[color cssString]];
|
||||
|
||||
return [num intValue];
|
||||
}
|
||||
|
||||
@@ -252,8 +252,8 @@ if (Error.prototype._userInfo !== null)
|
||||
|
||||
function _CPMethodCallString(anObject, aSelector)
|
||||
{
|
||||
var prefix = class_isMetaClass(anObject.isa) ? "+" : "-";
|
||||
return prefix + "[" + [anObject className] + " " + aSelector + "]: ";
|
||||
var prefix = class_isMetaClass(anObject.isa) ? "+" : "-";
|
||||
return prefix + "[" + [anObject className] + " " + aSelector + "]: ";
|
||||
}
|
||||
|
||||
function _CPRaiseInvalidAbstractInvocation(anObject, aSelector)
|
||||
|
||||
@@ -231,8 +231,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
_minimumFractionDigits = 0;
|
||||
_maximumFractionDigits = 3;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
break;
|
||||
|
||||
@@ -240,8 +240,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
_minimumFractionDigits = 2;
|
||||
_maximumFractionDigits = 2;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
break;
|
||||
}
|
||||
@@ -251,8 +251,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
{
|
||||
_roundingMode = aRoundingMode;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
}
|
||||
|
||||
@@ -260,8 +260,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
{
|
||||
_minimumFractionDigits = aNumber;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
}
|
||||
|
||||
@@ -269,8 +269,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
{
|
||||
_maximumFractionDigits = aNumber;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
}
|
||||
|
||||
@@ -278,8 +278,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
{
|
||||
_minimum = aNumber;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
{
|
||||
_maximum = aNumber;
|
||||
// Invalidate the cached number handler.
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
// It rebuilds on next use.
|
||||
// Replaces pre-processor directive, which is incompatible with the new compiler
|
||||
_numberHandler = nil;
|
||||
}
|
||||
|
||||
|
||||
+370
-370
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
- (id)initWithCapacity:(unsigned)aCapacity
|
||||
{
|
||||
return [self init];
|
||||
return [self init];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -32,7 +32,7 @@
|
||||
*/
|
||||
+ (id)setWithCapacity:(CPUInteger)aCapacity
|
||||
{
|
||||
return [[self alloc] initWithCapacity:aCapacity];
|
||||
return [[self alloc] initWithCapacity:aCapacity];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -41,16 +41,16 @@
|
||||
*/
|
||||
- (void)filterUsingPredicate:(CPPredicate)aPredicate
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
if (![aPredicate evaluateWithObject:object])
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
if (![aPredicate evaluateWithObject:object])
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -59,7 +59,7 @@
|
||||
*/
|
||||
- (void)removeObject:(id)anObject
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -68,13 +68,13 @@
|
||||
*/
|
||||
- (void)removeObjectsInArray:(CPArray)anArray
|
||||
{
|
||||
var index = 0,
|
||||
count = [anArray count];
|
||||
var index = 0,
|
||||
count = [anArray count];
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
[self removeObject:[anArray objectAtIndex:index]];
|
||||
}
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
[self removeObject:[anArray objectAtIndex:index]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -82,13 +82,13 @@
|
||||
*/
|
||||
- (void)removeAllObjects
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -97,12 +97,12 @@
|
||||
*/
|
||||
- (void)addObjectsFromArray:(CPArray)objects
|
||||
{
|
||||
var count = [objects count];
|
||||
var count = [objects count];
|
||||
|
||||
while (count--)
|
||||
{
|
||||
[self addObject:objects[count]];
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
[self addObject:objects[count]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -111,13 +111,13 @@
|
||||
*/
|
||||
- (void)unionSet:(CPSet)aSet
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self addObject:object];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self addObject:object];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -126,13 +126,13 @@
|
||||
*/
|
||||
- (void)minusSet:(CPSet)aSet
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[self removeObject:object];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -141,24 +141,24 @@
|
||||
*/
|
||||
- (void)intersectSet:(CPSet)aSet
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
objectsToRemove = [];
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
objectsToRemove = [];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
if (![aSet containsObject:object])
|
||||
{
|
||||
objectsToRemove.push(object);
|
||||
}
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
if (![aSet containsObject:object])
|
||||
{
|
||||
objectsToRemove.push(object);
|
||||
}
|
||||
}
|
||||
|
||||
var count = [objectsToRemove count];
|
||||
var count = [objectsToRemove count];
|
||||
|
||||
while (count--)
|
||||
{
|
||||
[self removeObject:objectsToRemove[count]];
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
[self removeObject:objectsToRemove[count]];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -167,8 +167,8 @@
|
||||
*/
|
||||
- (void)setSet:(CPSet)aSet
|
||||
{
|
||||
[self removeAllObjects];
|
||||
[self unionSet:aSet];
|
||||
[self removeAllObjects];
|
||||
[self unionSet:aSet];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -180,69 +180,69 @@
|
||||
|
||||
- (id)valueForKeyPath:(CPString)aKeyPath
|
||||
{
|
||||
if (!aKeyPath)
|
||||
{
|
||||
[self valueForUndefinedKey:@"<empty path>"];
|
||||
}
|
||||
if (!aKeyPath)
|
||||
{
|
||||
[self valueForUndefinedKey:@"<empty path>"];
|
||||
}
|
||||
|
||||
if (aKeyPath.charAt(0) === "@")
|
||||
{
|
||||
var dotIndex = aKeyPath.indexOf("."),
|
||||
operator,
|
||||
parameter;
|
||||
if (aKeyPath.charAt(0) === "@")
|
||||
{
|
||||
var dotIndex = aKeyPath.indexOf("."),
|
||||
operator,
|
||||
parameter;
|
||||
|
||||
if (dotIndex !== -1)
|
||||
{
|
||||
operator = aKeyPath.substring(1, dotIndex);
|
||||
parameter = aKeyPath.substring(dotIndex + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
operator = aKeyPath.substring(1);
|
||||
}
|
||||
if (dotIndex !== -1)
|
||||
{
|
||||
operator = aKeyPath.substring(1, dotIndex);
|
||||
parameter = aKeyPath.substring(dotIndex + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
operator = aKeyPath.substring(1);
|
||||
}
|
||||
|
||||
return [_CPCollectionKVCOperator performOperation:operator withCollection:self propertyPath:parameter];
|
||||
}
|
||||
else
|
||||
{
|
||||
var valuesForKeySet = [CPSet set],
|
||||
containedObject,
|
||||
containedObjectValue,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
return [_CPCollectionKVCOperator performOperation:operator withCollection:self propertyPath:parameter];
|
||||
}
|
||||
else
|
||||
{
|
||||
var valuesForKeySet = [CPSet set],
|
||||
containedObject,
|
||||
containedObjectValue,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
{
|
||||
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
{
|
||||
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
|
||||
|
||||
if (containedObjectValue == nil)
|
||||
{
|
||||
containedObjectValue = [CPNull null];
|
||||
}
|
||||
if (containedObjectValue == nil)
|
||||
{
|
||||
containedObjectValue = [CPNull null];
|
||||
}
|
||||
|
||||
[valuesForKeySet addObject:containedObjectValue];
|
||||
}
|
||||
[valuesForKeySet addObject:containedObjectValue];
|
||||
}
|
||||
|
||||
return valuesForKeySet;
|
||||
}
|
||||
return valuesForKeySet;
|
||||
}
|
||||
}
|
||||
|
||||
- (id)valueForKey:(CPString)aKey
|
||||
{
|
||||
// If the key starts with @, it is an operator path.
|
||||
// If not, it is a property path that we want applied to all members.
|
||||
// In either case, valueForKeyPath: handles both scenarios correctly.
|
||||
return [self valueForKeyPath:aKey];
|
||||
// If the key starts with @, it is an operator path.
|
||||
// If not, it is a property path that we want applied to all members.
|
||||
// In either case, valueForKeyPath: handles both scenarios correctly.
|
||||
return [self valueForKeyPath:aKey];
|
||||
}
|
||||
|
||||
- (void)setValue:(id)aValue forKey:(CPString)aKey
|
||||
{
|
||||
var containedObject,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
var containedObject,
|
||||
containedObjectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[containedObject setValue:aValue forKey:aKey];
|
||||
}
|
||||
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
|
||||
{
|
||||
[containedObject setValue:aValue forKey:aKey];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -254,22 +254,22 @@
|
||||
|
||||
- (id)mutableSetValueForKey:(id)aKey
|
||||
{
|
||||
return [[_CPKVCSet alloc] initWithKey:aKey forProxyObject:self];
|
||||
return [[_CPKVCSet alloc] initWithKey:aKey forProxyObject:self];
|
||||
}
|
||||
|
||||
- (id)mutableSetValueForKeyPath:(id)aKeyPath
|
||||
{
|
||||
var dotIndex = aKeyPath.indexOf(".");
|
||||
var dotIndex = aKeyPath.indexOf(".");
|
||||
|
||||
if (dotIndex < 0)
|
||||
{
|
||||
return [self mutableSetValueForKey:aKeyPath];
|
||||
}
|
||||
if (dotIndex < 0)
|
||||
{
|
||||
return [self mutableSetValueForKey:aKeyPath];
|
||||
}
|
||||
|
||||
var firstPart = aKeyPath.substring(0, dotIndex),
|
||||
lastPart = aKeyPath.substring(dotIndex + 1);
|
||||
var firstPart = aKeyPath.substring(0, dotIndex),
|
||||
lastPart = aKeyPath.substring(dotIndex + 1);
|
||||
|
||||
return [[self valueForKeyPath:firstPart] mutableSetValueForKeyPath:lastPart];
|
||||
return [[self valueForKeyPath:firstPart] mutableSetValueForKeyPath:lastPart];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -279,387 +279,387 @@
|
||||
|
||||
@implementation _CPKVCSet : CPMutableSet
|
||||
{
|
||||
id _proxyObject;
|
||||
id _key;
|
||||
id _proxyObject;
|
||||
id _key;
|
||||
|
||||
SEL _accessSEL;
|
||||
Function _access;
|
||||
SEL _accessSEL;
|
||||
Function _access;
|
||||
|
||||
SEL _setSEL;
|
||||
Function _set;
|
||||
SEL _setSEL;
|
||||
Function _set;
|
||||
|
||||
SEL _countSEL;
|
||||
Function _count;
|
||||
SEL _countSEL;
|
||||
Function _count;
|
||||
|
||||
SEL _enumeratorSEL;
|
||||
Function _enumerator;
|
||||
SEL _enumeratorSEL;
|
||||
Function _enumerator;
|
||||
|
||||
SEL _memberSEL;
|
||||
Function _member;
|
||||
SEL _memberSEL;
|
||||
Function _member;
|
||||
|
||||
SEL _addSEL;
|
||||
Function _add;
|
||||
SEL _addSEL;
|
||||
Function _add;
|
||||
|
||||
SEL _addManySEL;
|
||||
Function _addMany;
|
||||
SEL _addManySEL;
|
||||
Function _addMany;
|
||||
|
||||
SEL _removeSEL;
|
||||
Function _remove;
|
||||
SEL _removeSEL;
|
||||
Function _remove;
|
||||
|
||||
SEL _removeManySEL;
|
||||
Function _removeMany;
|
||||
SEL _removeManySEL;
|
||||
Function _removeMany;
|
||||
|
||||
SEL _intersectSEL;
|
||||
Function _intersect;
|
||||
SEL _intersectSEL;
|
||||
Function _intersect;
|
||||
}
|
||||
|
||||
+ (id)alloc
|
||||
{
|
||||
var set = [CPMutableSet set];
|
||||
var set = [CPMutableSet set];
|
||||
|
||||
set.isa = self;
|
||||
set.isa = self;
|
||||
|
||||
var ivars = class_copyIvarList(self),
|
||||
count = ivars.length;
|
||||
var ivars = class_copyIvarList(self),
|
||||
count = ivars.length;
|
||||
|
||||
while (count--)
|
||||
{
|
||||
set[ivar_getName(ivars[count])] = nil;
|
||||
}
|
||||
while (count--)
|
||||
{
|
||||
set[ivar_getName(ivars[count])] = nil;
|
||||
}
|
||||
|
||||
return set;
|
||||
return set;
|
||||
}
|
||||
|
||||
- (id)initWithKey:(id)aKey forProxyObject:(id)anObject
|
||||
{
|
||||
self = [super init];
|
||||
self = [super init];
|
||||
|
||||
_key = aKey;
|
||||
_proxyObject = anObject;
|
||||
_key = aKey;
|
||||
_proxyObject = anObject;
|
||||
|
||||
var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
|
||||
var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
|
||||
|
||||
_accessSEL = sel_getName(_key);
|
||||
if ([_proxyObject respondsToSelector:_accessSEL])
|
||||
{
|
||||
_access = [_proxyObject methodForSelector:_accessSEL];
|
||||
}
|
||||
_accessSEL = sel_getName(_key);
|
||||
if ([_proxyObject respondsToSelector:_accessSEL])
|
||||
{
|
||||
_access = [_proxyObject methodForSelector:_accessSEL];
|
||||
}
|
||||
|
||||
_setSEL = sel_getName(@"set" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_setSEL])
|
||||
{
|
||||
_set = [_proxyObject methodForSelector:_setSEL];
|
||||
}
|
||||
_setSEL = sel_getName(@"set" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_setSEL])
|
||||
{
|
||||
_set = [_proxyObject methodForSelector:_setSEL];
|
||||
}
|
||||
|
||||
_countSEL = sel_getName(@"countOf" + capitalizedKey);
|
||||
if ([_proxyObject respondsToSelector:_countSEL])
|
||||
{
|
||||
_count = [_proxyObject methodForSelector:_countSEL];
|
||||
}
|
||||
_countSEL = sel_getName(@"countOf" + capitalizedKey);
|
||||
if ([_proxyObject respondsToSelector:_countSEL])
|
||||
{
|
||||
_count = [_proxyObject methodForSelector:_countSEL];
|
||||
}
|
||||
|
||||
_enumeratorSEL = sel_getName(@"enumeratorOf" + capitalizedKey);
|
||||
if ([_proxyObject respondsToSelector:_enumeratorSEL])
|
||||
{
|
||||
_enumerator = [_proxyObject methodForSelector:_enumeratorSEL];
|
||||
}
|
||||
_enumeratorSEL = sel_getName(@"enumeratorOf" + capitalizedKey);
|
||||
if ([_proxyObject respondsToSelector:_enumeratorSEL])
|
||||
{
|
||||
_enumerator = [_proxyObject methodForSelector:_enumeratorSEL];
|
||||
}
|
||||
|
||||
_memberSEL = sel_getName(@"memberOf" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_memberSEL])
|
||||
{
|
||||
_member = [_proxyObject methodForSelector:_memberSEL];
|
||||
}
|
||||
_memberSEL = sel_getName(@"memberOf" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_memberSEL])
|
||||
{
|
||||
_member = [_proxyObject methodForSelector:_memberSEL];
|
||||
}
|
||||
|
||||
_addSEL = sel_getName(@"add" + capitalizedKey + "Object:");
|
||||
if ([_proxyObject respondsToSelector:_addSEL])
|
||||
{
|
||||
_add = [_proxyObject methodForSelector:_addSEL];
|
||||
}
|
||||
_addSEL = sel_getName(@"add" + capitalizedKey + "Object:");
|
||||
if ([_proxyObject respondsToSelector:_addSEL])
|
||||
{
|
||||
_add = [_proxyObject methodForSelector:_addSEL];
|
||||
}
|
||||
|
||||
_addManySEL = sel_getName(@"add" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_addManySEL])
|
||||
{
|
||||
_addMany = [_proxyObject methodForSelector:_addManySEL];
|
||||
}
|
||||
_addManySEL = sel_getName(@"add" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_addManySEL])
|
||||
{
|
||||
_addMany = [_proxyObject methodForSelector:_addManySEL];
|
||||
}
|
||||
|
||||
_removeSEL = sel_getName(@"remove" + capitalizedKey + "Object:");
|
||||
if ([_proxyObject respondsToSelector:_removeSEL])
|
||||
{
|
||||
_remove = [_proxyObject methodForSelector:_removeSEL];
|
||||
}
|
||||
_removeSEL = sel_getName(@"remove" + capitalizedKey + "Object:");
|
||||
if ([_proxyObject respondsToSelector:_removeSEL])
|
||||
{
|
||||
_remove = [_proxyObject methodForSelector:_removeSEL];
|
||||
}
|
||||
|
||||
_removeManySEL = sel_getName(@"remove" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_removeManySEL])
|
||||
{
|
||||
_removeMany = [_proxyObject methodForSelector:_removeManySEL];
|
||||
}
|
||||
_removeManySEL = sel_getName(@"remove" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_removeManySEL])
|
||||
{
|
||||
_removeMany = [_proxyObject methodForSelector:_removeManySEL];
|
||||
}
|
||||
|
||||
_intersectSEL = sel_getName(@"intersect" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_intersectSEL])
|
||||
{
|
||||
_intersect = [_proxyObject methodForSelector:_intersectSEL];
|
||||
}
|
||||
_intersectSEL = sel_getName(@"intersect" + capitalizedKey + ":");
|
||||
if ([_proxyObject respondsToSelector:_intersectSEL])
|
||||
{
|
||||
_intersect = [_proxyObject methodForSelector:_intersectSEL];
|
||||
}
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)_representedObject
|
||||
{
|
||||
if (_access)
|
||||
{
|
||||
return _access(_proxyObject, _accessSEL);
|
||||
}
|
||||
if (_access)
|
||||
{
|
||||
return _access(_proxyObject, _accessSEL);
|
||||
}
|
||||
|
||||
return [_proxyObject valueForKey:_key];
|
||||
return [_proxyObject valueForKey:_key];
|
||||
}
|
||||
|
||||
- (void)_setRepresentedObject:(id)anObject
|
||||
{
|
||||
if (_set)
|
||||
{
|
||||
return _set(_proxyObject, _setSEL, anObject);
|
||||
}
|
||||
if (_set)
|
||||
{
|
||||
return _set(_proxyObject, _setSEL, anObject);
|
||||
}
|
||||
|
||||
[_proxyObject setValue:anObject forKey:_key];
|
||||
[_proxyObject setValue:anObject forKey:_key];
|
||||
}
|
||||
|
||||
- (CPUInteger)count
|
||||
{
|
||||
if (_count)
|
||||
{
|
||||
return _count(_proxyObject, _countSEL);
|
||||
}
|
||||
if (_count)
|
||||
{
|
||||
return _count(_proxyObject, _countSEL);
|
||||
}
|
||||
|
||||
return [[self _representedObject] count];
|
||||
return [[self _representedObject] count];
|
||||
}
|
||||
|
||||
- (CPEnumerator)objectEnumerator
|
||||
{
|
||||
if (_enumerator)
|
||||
{
|
||||
return _enumerator(_proxyObject, _enumeratorSEL);
|
||||
}
|
||||
if (_enumerator)
|
||||
{
|
||||
return _enumerator(_proxyObject, _enumeratorSEL);
|
||||
}
|
||||
|
||||
return [[self _representedObject] objectEnumerator];
|
||||
return [[self _representedObject] objectEnumerator];
|
||||
}
|
||||
|
||||
- (id)member:(id)anObject
|
||||
{
|
||||
if (_member)
|
||||
{
|
||||
return _member(_proxyObject, _memberSEL, anObject);
|
||||
}
|
||||
if (_member)
|
||||
{
|
||||
return _member(_proxyObject, _memberSEL, anObject);
|
||||
}
|
||||
|
||||
return [[self _representedObject] member:anObject];
|
||||
return [[self _representedObject] member:anObject];
|
||||
}
|
||||
|
||||
- (void)addObject:(id)anObject
|
||||
{
|
||||
if (_add)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, anObject);
|
||||
}
|
||||
else if (_addMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithObject:anObject];
|
||||
_addMany(_proxyObject, _addManySEL, objectSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target addObject:anObject];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
if (_add)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, anObject);
|
||||
}
|
||||
else if (_addMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithObject:anObject];
|
||||
_addMany(_proxyObject, _addManySEL, objectSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target addObject:anObject];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)addObjectsFromArray:(CPArray)objects
|
||||
{
|
||||
if (_addMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithArray:objects];
|
||||
_addMany(_proxyObject, _addManySEL, objectSet);
|
||||
}
|
||||
else if (_add)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
if (_addMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithArray:objects];
|
||||
_addMany(_proxyObject, _addManySEL, objectSet);
|
||||
}
|
||||
else if (_add)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target addObjectsFromArray:objects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target addObjectsFromArray:objects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)unionSet:(CPSet)aSet
|
||||
{
|
||||
if (_addMany)
|
||||
{
|
||||
_addMany(_proxyObject, _addManySEL, aSet);
|
||||
}
|
||||
else if (_add)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
if (_addMany)
|
||||
{
|
||||
_addMany(_proxyObject, _addManySEL, aSet);
|
||||
}
|
||||
else if (_add)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target unionSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_add(_proxyObject, _addSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target unionSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeObject:(id)anObject
|
||||
{
|
||||
if (_remove)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, anObject);
|
||||
}
|
||||
else if (_removeMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithObject:anObject];
|
||||
_removeMany(_proxyObject, _removeManySEL, objectSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeObject:anObject];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
if (_remove)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, anObject);
|
||||
}
|
||||
else if (_removeMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithObject:anObject];
|
||||
_removeMany(_proxyObject, _removeManySEL, objectSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeObject:anObject];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)minusSet:(CPSet)aSet
|
||||
{
|
||||
if (_removeMany)
|
||||
{
|
||||
_removeMany(_proxyObject, _removeManySEL, aSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
if (_removeMany)
|
||||
{
|
||||
_removeMany(_proxyObject, _removeManySEL, aSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [aSet objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target minusSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target minusSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeObjectsInArray:(CPArray)objects
|
||||
{
|
||||
if (_removeMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithArray:objects];
|
||||
_removeMany(_proxyObject, _removeManySEL, objectSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
if (_removeMany)
|
||||
{
|
||||
var objectSet = [CPSet setWithArray:objects];
|
||||
_removeMany(_proxyObject, _removeManySEL, objectSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [objects objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeObjectsInArray:objects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeObjectsInArray:objects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeAllObjects
|
||||
{
|
||||
if (_removeMany)
|
||||
{
|
||||
var allObjectsSet = [[self _representedObject] copy];
|
||||
_removeMany(_proxyObject, _removeManySEL, allObjectsSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
|
||||
if (_removeMany)
|
||||
{
|
||||
var allObjectsSet = [[self _representedObject] copy];
|
||||
_removeMany(_proxyObject, _removeManySEL, allObjectsSet);
|
||||
}
|
||||
else if (_remove)
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeAllObjects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
_remove(_proxyObject, _removeSEL, object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target removeAllObjects];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)intersectSet:(CPSet)aSet
|
||||
{
|
||||
if (_intersect)
|
||||
{
|
||||
_intersect(_proxyObject, _intersectSEL, aSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target intersectSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
if (_intersect)
|
||||
{
|
||||
_intersect(_proxyObject, _intersectSEL, aSet);
|
||||
}
|
||||
else
|
||||
{
|
||||
var target = [[self _representedObject] copy];
|
||||
[target intersectSet:aSet];
|
||||
[self _setRepresentedObject:target];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSet:(CPSet)set
|
||||
{
|
||||
[self _setRepresentedObject:set];
|
||||
[self _setRepresentedObject:set];
|
||||
}
|
||||
|
||||
- (CPArray)allObjects
|
||||
{
|
||||
return [[self _representedObject] allObjects];
|
||||
return [[self _representedObject] allObjects];
|
||||
}
|
||||
|
||||
- (id)anyObject
|
||||
{
|
||||
return [[self _representedObject] anyObject];
|
||||
return [[self _representedObject] anyObject];
|
||||
}
|
||||
|
||||
- (BOOL)containsObject:(id)anObject
|
||||
{
|
||||
return [[self _representedObject] containsObject:anObject];
|
||||
return [[self _representedObject] containsObject:anObject];
|
||||
}
|
||||
|
||||
- (BOOL)intersectsSet:(CPSet)aSet
|
||||
{
|
||||
return [[self _representedObject] intersectsSet:aSet];
|
||||
return [[self _representedObject] intersectsSet:aSet];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToSet:(CPSet)aSet
|
||||
{
|
||||
return [[self _representedObject] isEqualToSet:aSet];
|
||||
return [[self _representedObject] isEqualToSet:aSet];
|
||||
}
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return [[self _representedObject] copy];
|
||||
return [[self _representedObject] copy];
|
||||
}
|
||||
|
||||
@end
|
||||
+110
-110
@@ -34,263 +34,263 @@
|
||||
|
||||
+ (id)alloc
|
||||
{
|
||||
if (self === [CPSet class] || self === [CPMutableSet class])
|
||||
return [_CPPlaceholderSet alloc];
|
||||
if (self === [CPSet class] || self === [CPMutableSet class])
|
||||
return [_CPPlaceholderSet alloc];
|
||||
|
||||
return [super alloc];
|
||||
return [super alloc];
|
||||
}
|
||||
|
||||
+ (id)set
|
||||
{
|
||||
return [[self alloc] init];
|
||||
return [[self alloc] init];
|
||||
}
|
||||
|
||||
+ (id)setWithArray:(CPArray)anArray
|
||||
{
|
||||
return [[self alloc] initWithArray:anArray];
|
||||
return [[self alloc] initWithArray:anArray];
|
||||
}
|
||||
|
||||
+ (id)setWithObject:(id)anObject
|
||||
{
|
||||
return [[self alloc] initWithObjects:anObject];
|
||||
return [[self alloc] initWithObjects:anObject];
|
||||
}
|
||||
|
||||
+ (id)setWithObjects:(id)objects count:(CPUInteger)count
|
||||
{
|
||||
return [[self alloc] initWithObjects:objects count:count];
|
||||
return [[self alloc] initWithObjects:objects count:count];
|
||||
}
|
||||
|
||||
+ (id)setWithObjects:(id)anObject, ...
|
||||
{
|
||||
var argumentsArray = Array.prototype.slice.apply(arguments);
|
||||
var argumentsArray = Array.prototype.slice.apply(arguments);
|
||||
|
||||
argumentsArray[0] = [self alloc];
|
||||
argumentsArray[1] = @selector(initWithObjects:);
|
||||
argumentsArray[0] = [self alloc];
|
||||
argumentsArray[1] = @selector(initWithObjects:);
|
||||
|
||||
return objj_msgSend.apply(this, argumentsArray);
|
||||
return objj_msgSend.apply(this, argumentsArray);
|
||||
}
|
||||
|
||||
+ (id)setWithSet:(CPSet)set
|
||||
{
|
||||
return [[self alloc] initWithSet:set];
|
||||
return [[self alloc] initWithSet:set];
|
||||
}
|
||||
|
||||
- (id)setByAddingObject:(id)anObject
|
||||
{
|
||||
return [[self class] setWithArray:[[self allObjects] arrayByAddingObject:anObject]];
|
||||
return [[self class] setWithArray:[[self allObjects] arrayByAddingObject:anObject]];
|
||||
}
|
||||
|
||||
- (id)setByAddingObjectsFromSet:(CPSet)aSet
|
||||
{
|
||||
return [self setByAddingObjectsFromArray:[aSet allObjects]];
|
||||
return [self setByAddingObjectsFromArray:[aSet allObjects]];
|
||||
}
|
||||
|
||||
- (id)setByAddingObjectsFromArray:(CPArray)anArray
|
||||
{
|
||||
return [[self class] setWithArray:[[self allObjects] arrayByAddingObjectsFromArray:anArray]];
|
||||
return [[self class] setWithArray:[[self allObjects] arrayByAddingObjectsFromArray:anArray]];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
return [self initWithObjects:nil count:0];
|
||||
return [self initWithObjects:nil count:0];
|
||||
}
|
||||
|
||||
- (id)initWithArray:(CPArray)anArray
|
||||
{
|
||||
return [self initWithObjects:anArray count:[anArray count]];
|
||||
return [self initWithObjects:anArray count:[anArray count]];
|
||||
}
|
||||
|
||||
- (id)initWithObjects:(id)anObject, ...
|
||||
{
|
||||
var index = 2,
|
||||
count = arguments.length;
|
||||
var index = 2,
|
||||
count = arguments.length;
|
||||
|
||||
for (; index < count; ++index)
|
||||
if (arguments[index] === nil)
|
||||
break;
|
||||
for (; index < count; ++index)
|
||||
if (arguments[index] === nil)
|
||||
break;
|
||||
|
||||
return [self initWithObjects:Array.prototype.slice.call(arguments, 2, index) count:index - 2];
|
||||
return [self initWithObjects:Array.prototype.slice.call(arguments, 2, index) count:index - 2];
|
||||
}
|
||||
|
||||
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
|
||||
{
|
||||
if (self === _CPSharedPlaceholderSet)
|
||||
return [[_CPConcreteMutableSet alloc] initWithObjects:objects count:aCount];
|
||||
if (self === _CPSharedPlaceholderSet)
|
||||
return [[_CPConcreteMutableSet alloc] initWithObjects:objects count:aCount];
|
||||
|
||||
return [super init];
|
||||
return [super init];
|
||||
}
|
||||
|
||||
- (id)initWithSet:(CPSet)aSet
|
||||
{
|
||||
return [self initWithArray:[aSet allObjects]];
|
||||
return [self initWithArray:[aSet allObjects]];
|
||||
}
|
||||
|
||||
- (id)initWithSet:(CPSet)aSet copyItems:(BOOL)shouldCopyItems
|
||||
{
|
||||
if (shouldCopyItems)
|
||||
return [aSet valueForKey:@"copy"];
|
||||
if (shouldCopyItems)
|
||||
return [aSet valueForKey:@"copy"];
|
||||
|
||||
return [self initWithSet:aSet];
|
||||
return [self initWithSet:aSet];
|
||||
}
|
||||
|
||||
- (CPUInteger)count
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
|
||||
- (CPArray)allObjects
|
||||
{
|
||||
var objects = [],
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var objects = [],
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
objects.push(object);
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
objects.push(object);
|
||||
|
||||
return objects;
|
||||
return objects;
|
||||
}
|
||||
|
||||
- (id)anyObject
|
||||
{
|
||||
return [[self objectEnumerator] nextObject];
|
||||
return [[self objectEnumerator] nextObject];
|
||||
}
|
||||
|
||||
- (BOOL)containsObject:(id)anObject
|
||||
{
|
||||
return [self member:anObject] != nil;
|
||||
return [self member:anObject] != nil;
|
||||
}
|
||||
|
||||
- (CPSet)filteredSetUsingPredicate:(CPPredicate)aPredicate
|
||||
{
|
||||
var objects = [],
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var objects = [],
|
||||
object,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aPredicate evaluateWithObject:object])
|
||||
objects.push(object);
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aPredicate evaluateWithObject:object])
|
||||
objects.push(object);
|
||||
|
||||
return [[[self class] alloc] initWithArray:objects];
|
||||
return [[[self class] alloc] initWithArray:objects];
|
||||
}
|
||||
|
||||
- (void)makeObjectsPerformSelector:(SEL)aSelector
|
||||
{
|
||||
[self makeObjectsPerformSelector:aSelector withObjects:nil];
|
||||
[self makeObjectsPerformSelector:aSelector withObjects:nil];
|
||||
}
|
||||
|
||||
- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject
|
||||
{
|
||||
[self makeObjectsPerformSelector:aSelector withObjects:[anObject]];
|
||||
[self makeObjectsPerformSelector:aSelector withObjects:[anObject]];
|
||||
}
|
||||
|
||||
- (void)makeObjectsPerformSelector:(SEL)aSelector withObjects:(CPArray)objects
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
argumentsArray = [nil, aSelector].concat(objects || []);
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
argumentsArray = [nil, aSelector].concat(objects || []);
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
argumentsArray[0] = object;
|
||||
objj_msgSend.apply(this, argumentsArray);
|
||||
}
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
{
|
||||
argumentsArray[0] = object;
|
||||
objj_msgSend.apply(this, argumentsArray);
|
||||
}
|
||||
}
|
||||
|
||||
- (id)member:(id)anObject
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
|
||||
- (CPEnumerator)objectEnumerator
|
||||
{
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
_CPRaiseInvalidAbstractInvocation(self, _cmd);
|
||||
}
|
||||
|
||||
- (void)enumerateObjectsUsingBlock:(Function)aFunction
|
||||
{
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
shouldStop = NO;
|
||||
var object,
|
||||
objectEnumerator = [self objectEnumerator],
|
||||
shouldStop = NO;
|
||||
|
||||
while (!shouldStop && (object = [objectEnumerator nextObject]) != nil) {
|
||||
if (aFunction(object, @ref(shouldStop)) !== undefined) {
|
||||
throw "DEPRECATED: The method enumerateObjectsUsingBlock: does not support returning a value in the block to stop the iteration.";
|
||||
}
|
||||
}
|
||||
while (!shouldStop && (object = [objectEnumerator nextObject]) != nil) {
|
||||
if (aFunction(object, @ref(shouldStop)) !== undefined) {
|
||||
throw "DEPRECATED: The method enumerateObjectsUsingBlock: does not support returning a value in the block to stop the iteration.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CPSet)objectsPassingTest:(Function)aFunction
|
||||
{
|
||||
var objects = [],
|
||||
object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var objects = [],
|
||||
object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (aFunction(object))
|
||||
objects.push(object);
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (aFunction(object))
|
||||
objects.push(object);
|
||||
|
||||
return [[[self class] alloc] initWithArray:objects];
|
||||
return [[[self class] alloc] initWithArray:objects];
|
||||
}
|
||||
|
||||
- (BOOL)isSubsetOfSet:(CPSet)aSet
|
||||
{
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (![aSet containsObject:object])
|
||||
return NO;
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if (![aSet containsObject:object])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)intersectsSet:(CPSet)aSet
|
||||
{
|
||||
if (self === aSet)
|
||||
return [self count] > 0;
|
||||
if (self === aSet)
|
||||
return [self count] > 0;
|
||||
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
var object = nil,
|
||||
objectEnumerator = [self objectEnumerator];
|
||||
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aSet containsObject:object])
|
||||
return YES;
|
||||
while ((object = [objectEnumerator nextObject]) != nil)
|
||||
if ([aSet containsObject:object])
|
||||
return YES;
|
||||
|
||||
return NO;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPArray)sortedArrayUsingDescriptors:(CPArray)someSortDescriptors
|
||||
{
|
||||
return [[self allObjects] sortedArrayUsingDescriptors:someSortDescriptors];
|
||||
return [[self allObjects] sortedArrayUsingDescriptors:someSortDescriptors];
|
||||
}
|
||||
|
||||
- (BOOL)isEqualToSet:(CPSet)aSet
|
||||
{
|
||||
return [self isEqual:aSet];
|
||||
return [self isEqual:aSet];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(CPSet)aSet
|
||||
{
|
||||
return self === aSet ||
|
||||
[aSet isKindOfClass:[CPSet class]] &&
|
||||
([self count] === [aSet count] &&
|
||||
[aSet isSubsetOfSet:self]);
|
||||
return self === aSet ||
|
||||
[aSet isKindOfClass:[CPSet class]] &&
|
||||
([self count] === [aSet count] &&
|
||||
[aSet isSubsetOfSet:self]);
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
var string = "{(\n",
|
||||
objects = [self allObjects],
|
||||
index = 0,
|
||||
count = [objects count];
|
||||
var string = "{(\n",
|
||||
objects = [self allObjects],
|
||||
index = 0,
|
||||
count = [objects count];
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var object = objects[index];
|
||||
string += "\t" + String(object).split('\n').join("\n\t") + "\n";
|
||||
}
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var object = objects[index];
|
||||
string += "\t" + String(object).split('\n').join("\n\t") + "\n";
|
||||
}
|
||||
|
||||
return string + ")}";
|
||||
return string + ")}";
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -302,12 +302,12 @@
|
||||
|
||||
- (id)copy
|
||||
{
|
||||
return [[self class] setWithSet:self];
|
||||
return [[self class] setWithSet:self];
|
||||
}
|
||||
|
||||
- (id)mutableCopy
|
||||
{
|
||||
return [self copy];
|
||||
return [self copy];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -321,12 +321,12 @@ var CPSetObjectsKey = @"CPSetObjectsKey";
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
return [self initWithArray:[aCoder decodeObjectForKey:CPSetObjectsKey]];
|
||||
return [self initWithArray:[aCoder decodeObjectForKey:CPSetObjectsKey]];
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:[self allObjects] forKey:CPSetObjectsKey];
|
||||
[aCoder encodeObject:[self allObjects] forKey:CPSetObjectsKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -342,10 +342,10 @@ var _CPSharedPlaceholderSet = nil;
|
||||
|
||||
+ (id)alloc
|
||||
{
|
||||
if (!_CPSharedPlaceholderSet)
|
||||
_CPSharedPlaceholderSet = [super alloc];
|
||||
if (!_CPSharedPlaceholderSet)
|
||||
_CPSharedPlaceholderSet = [super alloc];
|
||||
|
||||
return _CPSharedPlaceholderSet;
|
||||
return _CPSharedPlaceholderSet;
|
||||
}
|
||||
|
||||
@end
|
||||
+115
-115
@@ -36,14 +36,14 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
@implementation CPTimer : CPObject
|
||||
{
|
||||
CPTimeInterval _timeInterval;
|
||||
CPInvocation _invocation;
|
||||
Function _callback;
|
||||
CPTimeInterval _timeInterval;
|
||||
CPInvocation _invocation;
|
||||
Function _callback;
|
||||
|
||||
BOOL _repeats;
|
||||
BOOL _isValid;
|
||||
CPDate _fireDate;
|
||||
id _userInfo;
|
||||
BOOL _repeats;
|
||||
BOOL _isValid;
|
||||
CPDate _fireDate;
|
||||
id _userInfo;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -51,11 +51,11 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds invocation:(CPInvocation)anInvocation repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
|
||||
return timer;
|
||||
return timer;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -63,11 +63,11 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat];
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat];
|
||||
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
|
||||
return timer;
|
||||
return timer;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -75,11 +75,11 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)scheduledTimerWithTimeInterval:(CPTimeInterval)seconds callback:(Function)aFunction repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
const timer = [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
[[CPRunLoop currentRunLoop] addTimer:timer forMode:CPDefaultRunLoopMode];
|
||||
|
||||
return timer;
|
||||
return timer;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -87,7 +87,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds invocation:(CPInvocation)anInvocation repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds invocation:anInvocation repeats:shouldRepeat];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -95,7 +95,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat];
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds target:aTarget selector:aSelector userInfo:userInfo repeats:shouldRepeat];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -103,7 +103,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
+ (CPTimer)timerWithTimeInterval:(CPTimeInterval)seconds callback:(Function)aFunction repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
return [[self alloc] initWithFireDate:[CPDate dateWithTimeIntervalSinceNow:seconds] interval:seconds callback:aFunction repeats:shouldRepeat];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -111,18 +111,18 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (id)initWithFireDate:(CPDate)aDate interval:(CPTimeInterval)seconds invocation:(CPInvocation)anInvocation repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
self = [super init];
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_timeInterval = (seconds <= 0) ? CPTimerDefaultTimeInterval : seconds;
|
||||
_invocation = anInvocation;
|
||||
_repeats = shouldRepeat;
|
||||
_isValid = YES;
|
||||
_fireDate = aDate;
|
||||
}
|
||||
if (self)
|
||||
{
|
||||
_timeInterval = (seconds <= 0) ? CPTimerDefaultTimeInterval : seconds;
|
||||
_invocation = anInvocation;
|
||||
_repeats = shouldRepeat;
|
||||
_isValid = YES;
|
||||
_fireDate = aDate;
|
||||
}
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -130,18 +130,18 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (id)initWithFireDate:(CPDate)aDate interval:(CPTimeInterval)seconds target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
const invocation = [CPInvocation invocationWithMethodSignature:1];
|
||||
const invocation = [CPInvocation invocationWithMethodSignature:1];
|
||||
|
||||
[invocation setTarget:aTarget];
|
||||
[invocation setSelector:aSelector];
|
||||
[invocation setArgument:self atIndex:2];
|
||||
[invocation setTarget:aTarget];
|
||||
[invocation setSelector:aSelector];
|
||||
[invocation setArgument:self atIndex:2];
|
||||
|
||||
self = [self initWithFireDate:aDate interval:seconds invocation:invocation repeats:shouldRepeat];
|
||||
self = [self initWithFireDate:aDate interval:seconds invocation:invocation repeats:shouldRepeat];
|
||||
|
||||
if (self)
|
||||
_userInfo = userInfo;
|
||||
if (self)
|
||||
_userInfo = userInfo;
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -149,18 +149,18 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (id)initWithFireDate:(CPDate)aDate interval:(CPTimeInterval)seconds callback:(Function)aFunction repeats:(BOOL)shouldRepeat
|
||||
{
|
||||
self = [super init];
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_timeInterval = (seconds <= 0) ? CPTimerDefaultTimeInterval : seconds;
|
||||
_callback = aFunction;
|
||||
_repeats = shouldRepeat;
|
||||
_isValid = YES;
|
||||
_fireDate = aDate;
|
||||
}
|
||||
if (self)
|
||||
{
|
||||
_timeInterval = (seconds <= 0) ? CPTimerDefaultTimeInterval : seconds;
|
||||
_callback = aFunction;
|
||||
_repeats = shouldRepeat;
|
||||
_isValid = YES;
|
||||
_fireDate = aDate;
|
||||
}
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -168,7 +168,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (CPTimeInterval)timeInterval
|
||||
{
|
||||
return _timeInterval;
|
||||
return _timeInterval;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -176,7 +176,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (CPDate)fireDate
|
||||
{
|
||||
return _fireDate;
|
||||
return _fireDate;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -184,7 +184,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (void)setFireDate:(CPDate)aDate
|
||||
{
|
||||
_fireDate = aDate;
|
||||
_fireDate = aDate;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -192,21 +192,21 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (void)fire
|
||||
{
|
||||
if (!_isValid)
|
||||
return;
|
||||
if (!_isValid)
|
||||
return;
|
||||
|
||||
if (_callback)
|
||||
_callback();
|
||||
else
|
||||
[_invocation invoke];
|
||||
if (_callback)
|
||||
_callback();
|
||||
else
|
||||
[_invocation invoke];
|
||||
|
||||
if (!_isValid)
|
||||
return;
|
||||
if (!_isValid)
|
||||
return;
|
||||
|
||||
if (_repeats)
|
||||
_fireDate = [CPDate dateWithTimeIntervalSinceNow:_timeInterval];
|
||||
else
|
||||
[self invalidate];
|
||||
if (_repeats)
|
||||
_fireDate = [CPDate dateWithTimeIntervalSinceNow:_timeInterval];
|
||||
else
|
||||
[self invalidate];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -214,7 +214,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (BOOL)isValid
|
||||
{
|
||||
return _isValid;
|
||||
return _isValid;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -222,10 +222,10 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (void)invalidate
|
||||
{
|
||||
_isValid = NO;
|
||||
_userInfo = nil;
|
||||
_invocation = nil;
|
||||
_callback = nil;
|
||||
_isValid = NO;
|
||||
_userInfo = nil;
|
||||
_invocation = nil;
|
||||
_callback = nil;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -233,7 +233,7 @@ const CPTimerDefaultTimeInterval = 0.1;
|
||||
*/
|
||||
- (id)userInfo
|
||||
{
|
||||
return _userInfo;
|
||||
return _userInfo;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -250,68 +250,68 @@ const CPTimersForTimeoutIDs = {};
|
||||
|
||||
const _CPTimerBridgeTimer = function(codeOrFunction, aDelay, shouldRepeat, functionArgs)
|
||||
{
|
||||
const timeoutID = CPTimersTimeoutID++;
|
||||
let theFunction = nil;
|
||||
const timeoutID = CPTimersTimeoutID++;
|
||||
let theFunction = nil;
|
||||
|
||||
if (typeof codeOrFunction === "string")
|
||||
{
|
||||
// FIXME: Anti-pattern: Dynamic Evaluation. Evaluating string payloads via `new Function`
|
||||
// is a strict Content Security Policy (CSP) violation.
|
||||
theFunction = function()
|
||||
{
|
||||
new Function(codeOrFunction)();
|
||||
if (typeof codeOrFunction === "string")
|
||||
{
|
||||
// FIXME: Anti-pattern: Dynamic Evaluation. Evaluating string payloads via `new Function`
|
||||
// is a strict Content Security Policy (CSP) violation.
|
||||
theFunction = function()
|
||||
{
|
||||
new Function(codeOrFunction)();
|
||||
|
||||
if (!shouldRepeat)
|
||||
delete CPTimersForTimeoutIDs[timeoutID];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!functionArgs)
|
||||
functionArgs = [];
|
||||
if (!shouldRepeat)
|
||||
delete CPTimersForTimeoutIDs[timeoutID];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!functionArgs)
|
||||
functionArgs = [];
|
||||
|
||||
theFunction = function()
|
||||
{
|
||||
codeOrFunction.apply(window, functionArgs);
|
||||
theFunction = function()
|
||||
{
|
||||
codeOrFunction.apply(window, functionArgs);
|
||||
|
||||
if (!shouldRepeat)
|
||||
delete CPTimersForTimeoutIDs[timeoutID];
|
||||
}
|
||||
}
|
||||
if (!shouldRepeat)
|
||||
delete CPTimersForTimeoutIDs[timeoutID];
|
||||
}
|
||||
}
|
||||
|
||||
// A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we.
|
||||
aDelay = aDelay | 0.0;
|
||||
// A call such as setTimeout(f) is technically invalid but browsers seem to treat it as setTimeout(f, 0), so so will we.
|
||||
aDelay = aDelay | 0.0;
|
||||
|
||||
CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat];
|
||||
CPTimersForTimeoutIDs[timeoutID] = [CPTimer scheduledTimerWithTimeInterval:aDelay / 1000 callback:theFunction repeats:shouldRepeat];
|
||||
|
||||
return timeoutID;
|
||||
return timeoutID;
|
||||
};
|
||||
|
||||
// Avoid "TypeError: Result of expression 'window' [undefined] is not an object" when running unit tests.
|
||||
if (typeof(window) !== 'undefined')
|
||||
{
|
||||
window.setTimeout = function(codeOrFunction, aDelay)
|
||||
{
|
||||
return _CPTimerBridgeTimer(codeOrFunction, aDelay, NO, Array.prototype.slice.apply(arguments, [2]));
|
||||
};
|
||||
window.setTimeout = function(codeOrFunction, aDelay)
|
||||
{
|
||||
return _CPTimerBridgeTimer(codeOrFunction, aDelay, NO, Array.prototype.slice.apply(arguments, [2]));
|
||||
};
|
||||
|
||||
window.clearTimeout = function(aTimeoutID)
|
||||
{
|
||||
const timer = CPTimersForTimeoutIDs[aTimeoutID];
|
||||
window.clearTimeout = function(aTimeoutID)
|
||||
{
|
||||
const timer = CPTimersForTimeoutIDs[aTimeoutID];
|
||||
|
||||
if (timer)
|
||||
[timer invalidate];
|
||||
if (timer)
|
||||
[timer invalidate];
|
||||
|
||||
delete CPTimersForTimeoutIDs[aTimeoutID];
|
||||
};
|
||||
delete CPTimersForTimeoutIDs[aTimeoutID];
|
||||
};
|
||||
|
||||
window.setInterval = function(codeOrFunction, aDelay, functionArgs)
|
||||
{
|
||||
return _CPTimerBridgeTimer(codeOrFunction, aDelay, YES, Array.prototype.slice.apply(arguments, [2]));
|
||||
};
|
||||
window.setInterval = function(codeOrFunction, aDelay, functionArgs)
|
||||
{
|
||||
return _CPTimerBridgeTimer(codeOrFunction, aDelay, YES, Array.prototype.slice.apply(arguments, [2]));
|
||||
};
|
||||
|
||||
window.clearInterval = function(aTimeoutID)
|
||||
{
|
||||
window.clearTimeout(aTimeoutID);
|
||||
};
|
||||
window.clearInterval = function(aTimeoutID)
|
||||
{
|
||||
window.clearTimeout(aTimeoutID);
|
||||
};
|
||||
}
|
||||
@@ -161,14 +161,14 @@ var CPURLConnectionDelegate = nil;
|
||||
|
||||
Typical use can be like this:
|
||||
|
||||
- (async @action)doAction:(id)sender {
|
||||
const { response, data, error } = await [CPURLConnection sendAsynchronousRequest:[CPURLRequest requestWithURL:@"http://cappuccino.dev"]];
|
||||
if (error == nil) {
|
||||
//do the stuff...
|
||||
} else {
|
||||
// Handle errors
|
||||
}
|
||||
}
|
||||
- (async @action)doAction:(id)sender {
|
||||
const { response, data, error } = await [CPURLConnection sendAsynchronousRequest:[CPURLRequest requestWithURL:@"http://cappuccino.dev"]];
|
||||
if (error == nil) {
|
||||
//do the stuff...
|
||||
} else {
|
||||
// Handle errors
|
||||
}
|
||||
}
|
||||
*/
|
||||
+ (async JSObject /* { response: CPURLResponse, data: CPData, error: CPError } */)sendAsynchronousRequest:(CPURLRequest)aRequest
|
||||
{
|
||||
@@ -218,15 +218,15 @@ var CPURLConnectionDelegate = nil;
|
||||
|
||||
- (void)_initWithRequest:(CPURLRequest)aRequest
|
||||
{
|
||||
_request = aRequest;
|
||||
_request = aRequest;
|
||||
_originalRequest = [aRequest copy];
|
||||
_isCanceled = NO;
|
||||
_isCanceled = NO;
|
||||
|
||||
var URL = [_request URL],
|
||||
scheme = [URL scheme];
|
||||
var URL = [_request URL],
|
||||
scheme = [URL scheme];
|
||||
|
||||
// Browsers use "file:", Titanium uses "app:"
|
||||
_isLocalFileConnection = scheme === "file" ||
|
||||
// Browsers use "file:", Titanium uses "app:"
|
||||
_isLocalFileConnection = scheme === "file" ||
|
||||
((scheme === "http" || scheme === "https") &&
|
||||
window.location &&
|
||||
(window.location.protocol === "file:" || window.location.protocol === "app:"));
|
||||
|
||||
@@ -12,18 +12,18 @@
|
||||
*/
|
||||
@implementation _MockColorPicker : CPObject
|
||||
{
|
||||
CPArray _receivedColors;
|
||||
CPView _view;
|
||||
CPArray _receivedColors;
|
||||
CPView _view;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_receivedColors = [];
|
||||
_view = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
}
|
||||
return self;
|
||||
if (self = [super init])
|
||||
{
|
||||
_receivedColors = [];
|
||||
_view = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setColor:(CPColor)aColor
|
||||
@@ -33,32 +33,32 @@
|
||||
|
||||
- (CPArray)receivedColors
|
||||
{
|
||||
return _receivedColors;
|
||||
return _receivedColors;
|
||||
}
|
||||
|
||||
- (CPView)provideNewView:(BOOL)initial
|
||||
{
|
||||
return _view;
|
||||
return _view;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPColorPanelTest : OJTestCase
|
||||
{
|
||||
CPColorPanel _panel;
|
||||
CPColorPanel _panel;
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// Get shared panel and ensure it's initialized
|
||||
_panel = [CPColorPanel sharedColorPanel];
|
||||
[_panel _loadContentsIfNecessary];
|
||||
// Get shared panel and ensure it's initialized
|
||||
_panel = [CPColorPanel sharedColorPanel];
|
||||
[_panel _loadContentsIfNecessary];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
{
|
||||
// Reset panel state between tests
|
||||
[_panel setColor:[CPColor whiteColor]];
|
||||
// Reset panel state between tests
|
||||
[_panel setColor:[CPColor whiteColor]];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -67,10 +67,10 @@
|
||||
*/
|
||||
- (void)testSetColorUpdatesOpacitySlider
|
||||
{
|
||||
var initialColor = [CPColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.5];[_panel setColor:initialColor];
|
||||
var initialColor = [CPColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.5];[_panel setColor:initialColor];
|
||||
|
||||
[self assert:0.5 equals:[_panel._opacitySlider floatValue]
|
||||
message:"Opacity slider should match the color's alpha component"];
|
||||
[self assert:0.5 equals:[_panel._opacitySlider floatValue]
|
||||
message:"Opacity slider should match the color's alpha component"];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -78,19 +78,19 @@
|
||||
*/
|
||||
- (void)testOpacityChangeUpdatesColorAlpha
|
||||
{
|
||||
var initialColor = [CPColor colorWithRed:0.5 green:0.5 blue:1.0 alpha:1.0];
|
||||
[_panel setColor:initialColor];[_panel._opacitySlider setFloatValue:0.3];
|
||||
[_panel setOpacity:_panel._opacitySlider];
|
||||
var initialColor = [CPColor colorWithRed:0.5 green:0.5 blue:1.0 alpha:1.0];
|
||||
[_panel setColor:initialColor];[_panel._opacitySlider setFloatValue:0.3];
|
||||
[_panel setOpacity:_panel._opacitySlider];
|
||||
|
||||
var newColor = [_panel color];
|
||||
[self assert:0.3 equals:[newColor alphaComponent]
|
||||
message:"Color's alpha should match slider value"];
|
||||
var newColor = [_panel color];
|
||||
[self assert:0.3 equals:[newColor alphaComponent]
|
||||
message:"Color's alpha should match slider value"];
|
||||
|
||||
// RGB components should remain unchanged
|
||||
var components = [newColor components];
|
||||
[self assert:0.5 equals:components[0] message:"Red component should be unchanged"];
|
||||
[self assert:0.5 equals:components[1] message:"Green component should be unchanged"];
|
||||
[self assert:1.0 equals:components[2] message:"Blue component should be unchanged"];
|
||||
// RGB components should remain unchanged
|
||||
var components = [newColor components];
|
||||
[self assert:0.5 equals:components[0] message:"Red component should be unchanged"];
|
||||
[self assert:0.5 equals:components[1] message:"Green component should be unchanged"];
|
||||
[self assert:1.0 equals:components[2] message:"Blue component should be unchanged"];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -99,20 +99,20 @@
|
||||
*/
|
||||
- (void)testActivePickerNotifiedOfColorChanges
|
||||
{
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._activePicker = mockPicker;
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._activePicker = mockPicker;
|
||||
|
||||
var color1 = [CPColor redColor];
|
||||
var color2 = [CPColor blueColor];
|
||||
var color1 = [CPColor redColor];
|
||||
var color2 = [CPColor blueColor];
|
||||
|
||||
[_panel setColor:color1];
|
||||
[_panel setColor:color2];
|
||||
[_panel setColor:color1];
|
||||
[_panel setColor:color2];
|
||||
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:2 equals:[receivedColors count]
|
||||
message:"Active picker should receive setColor for each color change"];
|
||||
[self assert:color1 same:receivedColors[0]];
|
||||
[self assert:color2 same:receivedColors[1]];
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:2 equals:[receivedColors count]
|
||||
message:"Active picker should receive setColor for each color change"];
|
||||
[self assert:color1 same:receivedColors[0]];
|
||||
[self assert:color2 same:receivedColors[1]];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -121,21 +121,21 @@
|
||||
*/
|
||||
- (void)testPickerNotifiedOnActivation
|
||||
{
|
||||
var testColor = [CPColor colorWithRed:0.5 green:0.5 blue:1.0 alpha:1.0];
|
||||
[_panel setColor:testColor];
|
||||
var testColor = [CPColor colorWithRed:0.5 green:0.5 blue:1.0 alpha:1.0];
|
||||
[_panel setColor:testColor];
|
||||
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._colorPickers = [mockPicker];
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._colorPickers = [mockPicker];
|
||||
|
||||
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
||||
[button setTag:0];
|
||||
var button = [[CPButton alloc] initWithFrame:CGRectMake(0, 0, 32, 32)];
|
||||
[button setTag:0];
|
||||
|
||||
[_panel _setPicker:button];
|
||||
[_panel _setPicker:button];
|
||||
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:1 equals:[receivedColors count]
|
||||
message:"Picker should receive setColor when activated"];
|
||||
[self assert:testColor same:receivedColors[0]];
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:1 equals:[receivedColors count]
|
||||
message:"Picker should receive setColor when activated"];
|
||||
[self assert:testColor same:receivedColors[0]];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -143,11 +143,11 @@
|
||||
*/
|
||||
- (void)testOpacityMethodReturnsAlpha
|
||||
{
|
||||
var testColor = [CPColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.42];
|
||||
[_panel setColor:testColor];
|
||||
var testColor = [CPColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.42];
|
||||
[_panel setColor:testColor];
|
||||
|
||||
[self assert:0.42 equals:[_panel opacity]
|
||||
message:"opacity method should return color's alpha component"];
|
||||
[self assert:0.42 equals:[_panel opacity]
|
||||
message:"opacity method should return color's alpha component"];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -156,18 +156,18 @@
|
||||
*/
|
||||
- (void)testSetColorWithEqualColorDoesNothing
|
||||
{
|
||||
var testColor = [CPColor colorWithRed:1.0 green:0.5 blue:0.0 alpha:0.7];
|
||||
[_panel setColor:testColor];
|
||||
var testColor = [CPColor colorWithRed:1.0 green:0.5 blue:0.0 alpha:0.7];
|
||||
[_panel setColor:testColor];
|
||||
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._activePicker = mockPicker;
|
||||
var mockPicker = [[_MockColorPicker alloc] init];
|
||||
_panel._activePicker = mockPicker;
|
||||
|
||||
// Set same color again
|
||||
[_panel setColor:testColor];
|
||||
// Set same color again
|
||||
[_panel setColor:testColor];
|
||||
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:0 equals:[receivedColors count]
|
||||
message:"Setting equal color should not trigger picker update"];
|
||||
var receivedColors = [mockPicker receivedColors];
|
||||
[self assert:0 equals:[receivedColors count]
|
||||
message:"Setting equal color should not trigger picker update"];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -175,10 +175,10 @@
|
||||
*/
|
||||
- (void)testColorMethodReturnsCurrentColor
|
||||
{
|
||||
var testColor = [CPColor colorWithRed:0.2 green:0.4 blue:0.6 alpha:0.8];[_panel setColor:testColor];
|
||||
var testColor = [CPColor colorWithRed:0.2 green:0.4 blue:0.6 alpha:0.8];[_panel setColor:testColor];
|
||||
|
||||
[self assert:testColor same:[_panel color]
|
||||
message:"color method should return current color"];
|
||||
[self assert:testColor same:[_panel color]
|
||||
message:"color method should return current color"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -14,6 +14,6 @@
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPLogRegister(CPLogDefault);
|
||||
CPLogRegister(CPLogDefault);
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -62,9 +62,9 @@
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
|
||||
[theWindow setAcceptsMouseMovedEvents:YES];
|
||||
var contentView = [theWindow contentView],
|
||||
x = 20,
|
||||
y = 20,
|
||||
yInc = 25,
|
||||
x = 20,
|
||||
y = 20,
|
||||
yInc = 25,
|
||||
imageCursorTester = [[CursorTester alloc] initWithText:@"Image cursor"
|
||||
origin:CGPointMake(x, y)
|
||||
cursor:[[CPCursor alloc] initWithImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle mainBundle] resourcePath] + @"spinner.gif"]
|
||||
@@ -83,7 +83,7 @@
|
||||
cursor:[CPCursor pointingHandCursor]],
|
||||
resizeDownCursorTester = [[CursorTester alloc] initWithText:@"Resize down cursor"
|
||||
origin:CGPointMake(x, y+=yInc)
|
||||
cursor:[CPCursor resizeDownCursor]],
|
||||
cursor:[CPCursor resizeDownCursor]],
|
||||
resizeUpCursorTester = [[CursorTester alloc] initWithText:@"Resize up cursor"
|
||||
origin:CGPointMake(x, y+=yInc)
|
||||
cursor:[CPCursor resizeUpCursor]],
|
||||
@@ -119,7 +119,7 @@
|
||||
cursor:[CPCursor closedHandCursor]],
|
||||
disappearingItemCursorTester = [[CursorTester alloc] initWithText:@"Disappearing item cursor"
|
||||
origin:CGPointMake(x, y+=yInc)
|
||||
cursor:[CPCursor disappearingItemCursor]],
|
||||
cursor:[CPCursor disappearingItemCursor]],
|
||||
verticalTextCursorTester = [[CursorTester alloc] initWithText:@"Vertical text cursor"
|
||||
origin:CGPointMake(x, y+=yInc)
|
||||
cursor:[CPCursor IBeamCursorForVerticalLayout]];
|
||||
|
||||
@@ -106,7 +106,7 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass";
|
||||
{
|
||||
var compound_type = [criterion objectForKey:CPRuleEditorPredicateCompoundType];
|
||||
if (compound_type != nil)
|
||||
[predicatePartsForCriterion setObject:compound_type forKey:CPRuleEditorPredicateCompoundType];
|
||||
[predicatePartsForCriterion setObject:compound_type forKey:CPRuleEditorPredicateCompoundType];
|
||||
return predicatePartsForCriterion;
|
||||
}
|
||||
|
||||
@@ -131,8 +131,8 @@ var CPRuleEditorCustomControlClass = @"CPRuleEditorCustomControlClass";
|
||||
predicatePart = [CPExpression expressionForConstantValue:transformedValue];
|
||||
}
|
||||
else if ([key isEqualToString:CPRuleEditorPredicateOperatorType] ||
|
||||
[key isEqualToString:CPRuleEditorPredicateCustomSelector] ||
|
||||
[key isEqualToString:CPRuleEditorPredicateOptions])
|
||||
[key isEqualToString:CPRuleEditorPredicateCustomSelector] ||
|
||||
[key isEqualToString:CPRuleEditorPredicateOptions])
|
||||
{
|
||||
var value = [criterion objectForKey:key];
|
||||
if (value != nil) predicatePart = value;
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
*/
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPButton unhideHtmlButton;
|
||||
CPButton unhideUrlButton;
|
||||
CPWebView webview;
|
||||
CPWebView webview2;
|
||||
CPButton unhideHtmlButton;
|
||||
CPButton unhideUrlButton;
|
||||
CPWebView webview;
|
||||
CPWebView webview2;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
@@ -24,31 +24,31 @@
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
unhideHtmlButton = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
|
||||
[unhideHtmlButton setTitle:"Unhide (loadHTMLString)"];
|
||||
[unhideHtmlButton sizeToFit];
|
||||
[unhideHtmlButton setTarget:self];
|
||||
[unhideHtmlButton setAction:@selector(unhideHtmlButtonClicked:)];
|
||||
[contentView addSubview:unhideHtmlButton];
|
||||
unhideHtmlButton = [[CPButton alloc] initWithFrame:CGRectMakeZero()];
|
||||
[unhideHtmlButton setTitle:"Unhide (loadHTMLString)"];
|
||||
[unhideHtmlButton sizeToFit];
|
||||
[unhideHtmlButton setTarget:self];
|
||||
[unhideHtmlButton setAction:@selector(unhideHtmlButtonClicked:)];
|
||||
[contentView addSubview:unhideHtmlButton];
|
||||
|
||||
unhideUrlButton = [[CPButton alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 0, 0, 0)];
|
||||
[unhideUrlButton setTitle:"Unhide (URL)"];
|
||||
[unhideUrlButton sizeToFit];
|
||||
[unhideUrlButton setTarget:self];
|
||||
[unhideUrlButton setAction:@selector(unhideUrlButtonClicked:)];
|
||||
[contentView addSubview:unhideUrlButton];
|
||||
unhideUrlButton = [[CPButton alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 0, 0, 0)];
|
||||
[unhideUrlButton setTitle:"Unhide (URL)"];
|
||||
[unhideUrlButton sizeToFit];
|
||||
[unhideUrlButton setTarget:self];
|
||||
[unhideUrlButton setAction:@selector(unhideUrlButtonClicked:)];
|
||||
[contentView addSubview:unhideUrlButton];
|
||||
|
||||
webview = [[CPWebView alloc] initWithFrame:CGRectMake(0, 40, [contentView frameSize].width / 2 - 10, [contentView frameSize].height - 40)];
|
||||
[webview setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview setHidden:YES];
|
||||
[webview loadHTMLString:"<html><body><font size='8'> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</font></body></html>"];
|
||||
[contentView addSubview:webview];
|
||||
[webview setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview setHidden:YES];
|
||||
[webview loadHTMLString:"<html><body><font size='8'> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</font></body></html>"];
|
||||
[contentView addSubview:webview];
|
||||
|
||||
webview2 = [[CPWebView alloc] initWithFrame:CGRectMake([contentView frameSize].width / 2 + 10, 40, [contentView frameSize].width / 2 - 10, [contentView frameSize].height - 40)];
|
||||
[webview2 setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview2 setHidden:YES];
|
||||
[webview2 setMainFrameURL:"http://www.cappuccino-project.org"];
|
||||
[contentView addSubview:webview2];
|
||||
[webview2 setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[webview2 setHidden:YES];
|
||||
[webview2 setMainFrameURL:"http://www.cappuccino-project.org"];
|
||||
[contentView addSubview:webview2];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
|
||||
- (void)unhideHtmlButtonClicked:(id)sender
|
||||
{
|
||||
[webview setHidden:NO];
|
||||
[webview setHidden:NO];
|
||||
}
|
||||
|
||||
- (void)unhideUrlButtonClicked:(id)sender
|
||||
{
|
||||
[webview2 setHidden:NO];
|
||||
[webview2 setHidden:NO];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -15,14 +15,14 @@ END_EXPECTED
|
||||
|
||||
@implementation MySuperclass : CPObject
|
||||
{
|
||||
int myIvar;
|
||||
int myIvar;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MySubclass : MySuperclass
|
||||
{
|
||||
int myIvar;
|
||||
int myIvar;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
- (IBAction)bringWindow2Front:(id)sender
|
||||
{
|
||||
[window2 orderFront:self];
|
||||
[window2 orderFront:self];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -12,9 +12,9 @@
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPWindow theWindow;
|
||||
@outlet CPButton clearButton;
|
||||
@outlet CPButton escButton;
|
||||
@outlet CPTextField wasPressedLabel;
|
||||
@outlet CPButton clearButton;
|
||||
@outlet CPButton escButton;
|
||||
@outlet CPTextField wasPressedLabel;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
@@ -33,11 +33,11 @@
|
||||
}
|
||||
|
||||
- (@action)clearButtonPressed:(id)sender {
|
||||
[wasPressedLabel setStringValue:@"No"];
|
||||
[wasPressedLabel setStringValue:@"No"];
|
||||
}
|
||||
|
||||
- (@action)escButtonPressed:(id)sender {
|
||||
[wasPressedLabel setStringValue:@"Yes"];
|
||||
[wasPressedLabel setStringValue:@"Yes"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
- (IBAction)closeSheet:(idf)sender
|
||||
{
|
||||
[CPApp endSheet:sheetWindow];
|
||||
[CPApp endSheet:sheetWindow];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -63,8 +63,8 @@ var rootItems = [CPArray arrayWithObject:[CPDictionary dictionaryWithObjectsAndK
|
||||
|
||||
- (void)_saveSmartFolders
|
||||
{
|
||||
var defaults = [CPUserDefaults standardUserDefaults];
|
||||
[defaults setObject:smartFolders forKey:@"SmartFolders"];
|
||||
var defaults = [CPUserDefaults standardUserDefaults];
|
||||
[defaults setObject:smartFolders forKey:@"SmartFolders"];
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
@@ -204,7 +204,7 @@ var rootItems = [CPArray arrayWithObject:[CPDictionary dictionaryWithObjectsAndK
|
||||
- (IBAction)closeSheet:(id)sender
|
||||
{
|
||||
if ([sender tag] == CPOKButton)
|
||||
[predicateEditor reloadPredicate];
|
||||
[predicateEditor reloadPredicate];
|
||||
|
||||
[CPApp endSheet:predicateSheet returnCode:[sender tag]];
|
||||
}
|
||||
@@ -218,13 +218,13 @@ var rootItems = [CPArray arrayWithObject:[CPDictionary dictionaryWithObjectsAndK
|
||||
var predicate = [predicateEditor objectValue];
|
||||
[self setFilterPredicate:predicate];
|
||||
|
||||
[folder setObject:predicate forKey:@"predicate"];
|
||||
[folder setObject:name forKey:@"name"];
|
||||
[folder setObject:predicate forKey:@"predicate"];
|
||||
[folder setObject:name forKey:@"name"];
|
||||
[folder setObject:[[tableController arrangedObjects] count] forKey:@"count"];
|
||||
[smartOutlineView reloadData];
|
||||
[smartOutlineView reloadData];
|
||||
|
||||
[self saveSmartFolders];
|
||||
[aSheet orderOut:nil];
|
||||
[self saveSmartFolders];
|
||||
[aSheet orderOut:nil];
|
||||
}
|
||||
}
|
||||
// convenience method
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
- (void)xxxx:(id)argument
|
||||
{
|
||||
[super xxxx:argument];
|
||||
[super xxxx:argument];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user