Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
its been so many weeks I cant remember
- Loading branch information
Showing
13 changed files
with
9,558 additions
and
1,379 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// IGKPredicateEditor.h | ||
// Ingredients | ||
// | ||
// Created by Alex Gordon on 23/03/2010. | ||
// Copyright 2010 Fileability. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
|
||
|
||
@interface IGKPredicateEditor : NSPredicateEditor { | ||
|
||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// IGKPredicateEditor.m | ||
// Ingredients | ||
// | ||
// Created by Alex Gordon on 23/03/2010. | ||
// Copyright 2010 Fileability. All rights reserved. | ||
// | ||
|
||
#import "IGKPredicateEditor.h" | ||
|
||
|
||
@implementation IGKPredicateEditor | ||
|
||
- (NSPredicate *)predicate | ||
{ | ||
//We want to remove any null comparison predicates from our predicate | ||
NSCompoundPredicate *predicate = [super predicate]; | ||
NSLog(@"Pre = %@", predicate); | ||
|
||
if (!predicate) | ||
return nil; | ||
|
||
if ([predicate isKindOfClass:[NSComparisonPredicate class]]) | ||
{ | ||
predicate = [[NSCompoundPredicate alloc] initWithType:NSAndPredicateType subpredicates:[NSArray arrayWithObject:predicate]]; | ||
} | ||
else if (![predicate isKindOfClass:[NSCompoundPredicate class]]) | ||
{ | ||
return predicate; | ||
} | ||
|
||
NSArray *subpredicates = [predicate subpredicates]; | ||
NSMutableArray *newSubpredicates = [[NSMutableArray alloc] initWithCapacity:[subpredicates count]]; | ||
|
||
for (NSComparisonPredicate *cmpP in subpredicates) | ||
{ | ||
NSExpression *right = [cmpP rightExpression]; | ||
if ([right expressionType] != NSConstantValueExpressionType) | ||
{ | ||
[newSubpredicates addObject:cmpP]; | ||
continue; | ||
} | ||
|
||
id cv = [right constantValue]; | ||
|
||
if (cv && (![cv respondsToSelector:@selector(length)] || [cv length] > 0)) | ||
{ | ||
[newSubpredicates addObject:cmpP]; | ||
} | ||
} | ||
|
||
NSLog(@"newSubpredicates = %@", newSubpredicates); | ||
|
||
return [[NSCompoundPredicate alloc] initWithType:[predicate compoundPredicateType] subpredicates:newSubpredicates]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.