]> err.no Git - sope/blob - sope-core/EOCoreData/EOQualifier+CoreData.h
improved qualifier=>predicate conversion
[sope] / sope-core / EOCoreData / EOQualifier+CoreData.h
1 /*
2   Copyright (C) 2005 SKYRIX Software AG
3   
4   This file is part of SOPE.
5
6   SOPE is free software; you can redistribute it and/or modify it under
7   the terms of the GNU Lesser General Public License as published by the
8   Free Software Foundation; either version 2, or (at your option) any
9   later version.
10
11   SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
12   WARRANTY; without even the implied warranty of MERCHANTABILITY or
13   FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14   License for more details.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __EOQualifier_CoreData_H__
23 #define __EOQualifier_CoreData_H__
24
25 #import <Foundation/NSPredicate.h>
26 #import <Foundation/NSComparisonPredicate.h>
27 #include <EOControl/EOQualifier.h>
28
29 /*
30   EOQualifier(CoreData)
31   
32   Convert an libEOControl EOQualifier to a CoreData compliant NSPredicate
33   object.
34 */
35
36 @class NSArray;
37 @class NSPredicate, NSExpression, NSComparisonPredicate, NSCompoundPredicate;
38
39 @interface EOQualifier(CoreData)
40
41 + (EOQualifier *)qualifierForPredicate:(NSPredicate *)_predicate;
42 - (NSPredicate *)asPredicate;
43 - (NSExpression *)asExpression;
44
45 /* support methods */
46
47 + (SEL)eoSelectorForForComparisonPredicate:(NSComparisonPredicate *)_p;
48 + (NSPredicateOperatorType)predicateOperatorTypeForEOSelector:(SEL)_sel;
49
50 - (NSPredicate *)predicateWithLeftExpression:(NSExpression *)_lhs
51   rightExpression:(NSExpression *)_rhs
52   eoSelector:(SEL)_selector;
53
54 /* CoreData compatibility */
55
56 + (NSPredicate *)andPredicateWithSubpredicates:(NSArray *)_sub;
57 + (NSPredicate *)orPredicateWithSubpredicates:(NSArray *)_sub;
58 + (NSPredicate *)notPredicateWithSubpredicate:(id)_predicate;
59
60 @end
61
62 #import <Foundation/Foundation.h>
63
64
65 /* compound qualifiers */
66
67 @interface EOAndQualifier(CoreData)
68 - (NSCompoundPredicateType)compoundPredicateType;
69 @end
70
71 @interface EOOrQualifier(CoreData)
72 - (NSCompoundPredicateType)compoundPredicateType;
73 @end
74
75 @interface EONotQualifier(CoreData)
76 - (NSCompoundPredicateType)compoundPredicateType;
77 @end
78
79
80 /* comparison qualifiers */
81
82 @interface EOKeyValueQualifier(CoreData)
83 + (EOQualifier *)qualifierForComparisonPredicate:(NSComparisonPredicate *)_p;
84 - (NSComparisonPredicateModifier)comparisonPredicateModifier;
85 - (NSPredicateOperatorType)predicateOperatorType;
86 - (SEL)customSelector;
87 - (unsigned)options;
88 @end
89
90 @interface EOKeyComparisonQualifier(CoreData)
91 + (EOQualifier *)qualifierForComparisonPredicate:(NSComparisonPredicate *)_p;
92 - (NSComparisonPredicateModifier)comparisonPredicateModifier;
93 - (NSPredicateOperatorType)predicateOperatorType;
94 - (SEL)customSelector;
95 - (unsigned)options;
96 @end
97
98 #endif /* __EOQualifier_CoreData_H__ */