![]() |
API
0.9.6
|
The CPPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering. More...
#import <CPPredicate.h>
Inheritance diagram for CPPredicate:Class Methods | |
| (CPPredicate) | + predicateWithFormat: |
| (CPPredicate) | + predicateWithFormat:argumentArray: |
| (CPPredicate) | + predicateWithFormat:arguments: |
| (CPPredicate) | + predicateWithValue: |
Class Methods inherited from CPObject | |
| (BOOL) | + accessInstanceVariablesDirectly |
| (id) | + alloc |
| (id) | + allocWithCoder: |
| (BOOL) | + automaticallyNotifiesObserversForKey: |
| (Class) | + class |
| (void) | + exposeBinding: |
| (void) | + initialize |
| (IMP) | + instanceMethodForSelector: |
| (BOOL) | + instancesRespondToSelector: |
| (BOOL) | + isSubclassOfClass: |
| (CPSet) | + keyPathsForValuesAffectingValueForKey: |
| (void) | + load |
| (id) | + new |
| (void) | + setVersion: |
| (Class) | + superclass |
| (int) | + version |
Additional Inherited Members | |
Instance Variables inherited from CPObject | |
| Class | isa |
The CPPredicate class is used to define logical conditions used to constrain a search either for a fetch or for in-memory filtering.
You use predicates to represent logical conditions, used for describing objects in persistent stores and in-memory filtering of objects. Although it is common to create predicates directly from instances of CPComparisonPredicate, CPCompoundPredicate, and CPExpression, you often create predicates from a format string which is parsed by the class methods on CPPredicate. Examples of predicate format strings include:
grade == "7" or firstName like "Shaffiq"name contains[cd] "itroen"(firstName like "Mark") OR (lastName like "Adderley")date between {$YESTERDAY, $TOMORROW}.You can create predicates for relationships, such as:
group.name like "work*"ALL children.age > 12ANY children.age > 12You can create predicates for operations, such as @sum.items.price < 1000.
You can also create predicates that include variables, so that the predicate can be pre-defined before substituting concrete values at runtime with the evaluateWithObject:substitutionVariables: method.
Definition at line 2 of file CPPredicate.h.
|
implementation |
Returns a human readable string describing the receiver
Reimplemented from CPObject.
Definition at line 153 of file CPPredicate.j.
|
implementation |
Returns a Boolean value that indicates whether a given object matches the conditions specified by the receiver.
| object | The object against which to evaluate the receiver. |
Reimplemented in CPComparisonPredicate, and CPCompoundPredicate.
Definition at line 127 of file CPPredicate.j.
|
implementation |
Returns a Boolean value that indicates whether a given object matches the conditions specified by the receiver after substituting in the values in a given variables dictionary.
| object | The object against which to evaluate the receiver. |
| variables | The substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver. |
Reimplemented in CPComparisonPredicate, and CPCompoundPredicate.
Definition at line 138 of file CPPredicate.j.
|
implementation |
Returns the receiver’s format string.
Reimplemented in CPComparisonPredicate, CPCompoundPredicate, and CPPredicate_BOOL.
Definition at line 148 of file CPPredicate.j.
|
implementation |
Creates and returns a new predicate formed by creating a new string with a given format and parsing the result.
| format | The format string for the new predicate. |
| … | A comma-separated list of arguments to substitute into format. |
Definition at line 63 of file CPPredicate.j.
|
implementation |
Creates and returns a new predicate by substituting the values in a given array into a format string and parsing the result.
| format | The format string for the new predicate. |
| arguments | The arguments to substitute into predicateFormat. Values are substituted into predicateFormat in the order they appear in the array. |
Definition at line 78 of file CPPredicate.j.
|
implementation |
Creates and returns a new predicate by substituting the values in an argument list into a format string and parsing the result.
| format | The format string for the new predicate. |
| argList | The arguments to substitute into predicateFormat. Values are substituted into predicateFormat in the order they appear in the argument list. |
Definition at line 95 of file CPPredicate.j.
|
implementation |
Returns a copy of the receiver with the receiver’s variables substituted by values specified in a given substitution variables dictionary.
| variables | The substitution variables dictionary. The dictionary must contain key-value pairs for all variables in the receiver. |
Reimplemented in CPComparisonPredicate, and CPCompoundPredicate.
Definition at line 106 of file CPPredicate.j.
|
implementation |
Creates and returns a predicate that always evaluates to a given value.
| value | The value to which the new predicate should evaluate. |
Definition at line 116 of file CPPredicate.j.