Mercurial > projects > dstep
comparison dstep/foundation/NSComparisonPredicate.d @ 14:89f3c3ef1fd2
Added the Foundation framework
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:23:15 +0200 |
parents | |
children | 19885b43130e |
comparison
equal
deleted
inserted
replaced
13:4f583f7e242e | 14:89f3c3ef1fd2 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSComparisonPredicate; | |
8 | |
9 import dstep.foundation.NSExpression; | |
10 import dstep.foundation.NSPredicate; | |
11 import dstep.foundation.NSPredicateOperator; | |
12 import dstep.objc.bridge.Bridge; | |
13 import dstep.objc.objc : id; | |
14 | |
15 alias NSUInteger NSComparisonPredicateModifier; | |
16 alias NSUInteger NSPredicateOperatorType; | |
17 | |
18 enum | |
19 { | |
20 NSCaseInsensitivePredicateOption = 0x01, | |
21 NSDiacriticInsensitivePredicateOption = 0x02 | |
22 } | |
23 | |
24 enum | |
25 { | |
26 NSDirectPredicateModifier = 0, | |
27 NSAllPredicateModifier, | |
28 NSAnyPredicateModifier | |
29 } | |
30 | |
31 enum | |
32 { | |
33 NSLessThanPredicateOperatorType = 0, | |
34 NSLessThanOrEqualToPredicateOperatorType, | |
35 NSGreaterThanPredicateOperatorType, | |
36 NSGreaterThanOrEqualToPredicateOperatorType, | |
37 NSEqualToPredicateOperatorType, | |
38 NSNotEqualToPredicateOperatorType, | |
39 NSMatchesPredicateOperatorType, | |
40 NSLikePredicateOperatorType, | |
41 NSBeginsWithPredicateOperatorType, | |
42 NSEndsWithPredicateOperatorType, | |
43 NSInPredicateOperatorType, | |
44 NSCustomSelectorPredicateOperatorType, | |
45 NSContainsPredicateOperatorType = 99, | |
46 NSBetweenPredicateOperatorType | |
47 } | |
48 | |
49 class NSComparisonPredicate : NSPredicate | |
50 { | |
51 mixin ObjcWrap; | |
52 | |
53 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) | |
54 { | |
55 return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); | |
56 } | |
57 | |
58 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) | |
59 { | |
60 return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); | |
61 } | |
62 | |
63 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) | |
64 { | |
65 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); | |
66 } | |
67 | |
68 this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) | |
69 { | |
70 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
71 id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(objcObject, lhs, rhs, modifier, type, options); | |
72 | |
73 if (result) | |
74 objcObject = ret; | |
75 | |
76 dObject = this; | |
77 } | |
78 | |
79 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) | |
80 { | |
81 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); | |
82 } | |
83 | |
84 this (NSExpression lhs, NSExpression rhs, SEL selector) | |
85 { | |
86 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
87 id result = Bridge.invokeObjcMethod!(id, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(objcObject, lhs, rhs, selector); | |
88 | |
89 if (result) | |
90 objcObject = ret; | |
91 | |
92 dObject = this; | |
93 } | |
94 | |
95 uint predicateOperatorType () | |
96 { | |
97 return invokeObjcSelf!(uint, "predicateOperatorType"); | |
98 } | |
99 | |
100 uint comparisonPredicateModifier () | |
101 { | |
102 return invokeObjcSelf!(uint, "comparisonPredicateModifier"); | |
103 } | |
104 | |
105 NSExpression leftExpression () | |
106 { | |
107 return invokeObjcSelf!(NSExpression, "leftExpression"); | |
108 } | |
109 | |
110 NSExpression rightExpression () | |
111 { | |
112 return invokeObjcSelf!(NSExpression, "rightExpression"); | |
113 } | |
114 | |
115 SEL customSelector () | |
116 { | |
117 return invokeObjcSelf!(SEL, "customSelector"); | |
118 } | |
119 | |
120 NSUInteger options () | |
121 { | |
122 return invokeObjcSelf!(NSUInteger, "options"); | |
123 } | |
124 } | |
125 |