return self;
}
+/* key/value archiving */
+
+- (id)initWithKeyValueUnarchiver:(EOKeyValueUnarchiver *)_unarchiver {
+ id tmp;
+
+ [self release]; self = nil;
+
+ if ((tmp = [_unarchiver decodeObjectForKey:@"constantValue"]) != nil)
+ return [[NSExpression expressionForConstantValue:tmp] retain];
+
+ if ((tmp = [_unarchiver decodeObjectForKey:@"keyPath"]) != nil)
+ return [[NSExpression expressionForKeyPath:tmp] retain];
+
+ if ((tmp = [_unarchiver decodeObjectForKey:@"variable"]) != nil)
+ return [[NSExpression expressionForVariable:tmp] retain];
+
+ if ((tmp = [_unarchiver decodeObjectForKey:@"function"]) != nil) {
+ NSArray *args;
+
+ args = [_unarchiver decodeObjectForKey:@"arguments"];
+ return [[NSExpression expressionForFunction:tmp arguments:args] retain];
+ }
+
+ return [[NSExpression expressionForEvaluatedObject] retain];
+}
+
+- (void)encodeWithKeyValueArchiver:(EOKeyValueArchiver *)_archiver {
+ switch ([self expressionType]) {
+ case NSConstantValueExpressionType:
+ [_archiver encodeObject:[self constantValue] forKey:@"constantValue"];
+ return;
+ case NSEvaluatedObjectExpressionType:
+ /* encode no marker */
+ return;
+ case NSVariableExpressionType:
+ [_archiver encodeObject:[self variable] forKey:@"variable"];
+ return;
+ case NSKeyPathExpressionType:
+ [_archiver encodeObject:[self keyPath] forKey:@"keyPath"];
+ return;
+ case NSFunctionExpressionType:
+ [_archiver encodeObject:[self function] forKey:@"function"];
+ [_archiver encodeObject:[self arguments] forKey:@"arguments"];
+ return;
+
+ default:
+ NSLog(@"WARNING(%s): could not encode NSExpression: %@!",
+ __PRETTY_FUNCTION__, self);
+ }
+}
+
@end /* NSPredicate(EOCoreData) */