Mercurial > projects > dstep
comparison dstep/foundation/NSCompoundPredicate.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.NSCompoundPredicate; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSPredicate; | |
11 import dstep.objc.bridge.Bridge; | |
12 import dstep.objc.objc : id; | |
13 | |
14 alias NSUInteger NSCompoundPredicateType; | |
15 | |
16 enum | |
17 { | |
18 NSNotPredicateType = 0, | |
19 NSAndPredicateType, | |
20 NSOrPredicateType | |
21 } | |
22 | |
23 class NSCompoundPredicate : NSPredicate | |
24 { | |
25 mixin ObjcWrap; | |
26 | |
27 Object initWithType (uint type, NSArray subpredicates) | |
28 { | |
29 return invokeObjcSelf!(Object, "initWithType:subpredicates:", uint, NSArray)(type, subpredicates); | |
30 } | |
31 | |
32 this (uint type, NSArray subpredicates) | |
33 { | |
34 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
35 id result = Bridge.invokeObjcMethod!(id, "initWithType:subpredicates:", uint, NSArray)(objcObject, type, subpredicates); | |
36 | |
37 if (result) | |
38 objcObject = ret; | |
39 | |
40 dObject = this; | |
41 } | |
42 | |
43 uint compoundPredicateType () | |
44 { | |
45 return invokeObjcSelf!(uint, "compoundPredicateType"); | |
46 } | |
47 | |
48 NSArray subpredicates () | |
49 { | |
50 return invokeObjcSelf!(NSArray, "subpredicates"); | |
51 } | |
52 | |
53 static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates) | |
54 { | |
55 return invokeObjcSelfClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); | |
56 } | |
57 | |
58 static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates) | |
59 { | |
60 return invokeObjcSelfClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); | |
61 } | |
62 | |
63 static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate) | |
64 { | |
65 return invokeObjcSelfClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); | |
66 } | |
67 } | |
68 |