Mercurial > projects > dstep
comparison dstep/foundation/NSCompoundPredicate.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) |
6 */ | 6 */ |
7 module dstep.foundation.NSCompoundPredicate; | 7 module dstep.foundation.NSCompoundPredicate; |
8 | 8 |
9 import dstep.foundation.NSArray; | 9 import dstep.foundation.NSArray; |
10 import dstep.foundation.NSObjCRuntime; | |
10 import dstep.foundation.NSPredicate; | 11 import dstep.foundation.NSPredicate; |
11 import dstep.objc.bridge.Bridge; | 12 import dstep.objc.bridge.Bridge; |
12 import dstep.objc.objc : id; | 13 import dstep.objc.objc; |
13 | 14 |
14 alias NSUInteger NSCompoundPredicateType; | 15 alias NSUInteger NSCompoundPredicateType; |
15 | 16 |
16 enum | 17 enum |
17 { | 18 { |
20 NSOrPredicateType | 21 NSOrPredicateType |
21 } | 22 } |
22 | 23 |
23 class NSCompoundPredicate : NSPredicate | 24 class NSCompoundPredicate : NSPredicate |
24 { | 25 { |
25 mixin ObjcWrap; | 26 mixin (ObjcWrap); |
27 | |
28 this () | |
29 { | |
30 super(typeof(this).alloc.init.objcObject); | |
31 } | |
32 | |
33 typeof(this) init () | |
34 { | |
35 return invokeObjcSelf!(typeof(this), "init"); | |
36 } | |
26 | 37 |
27 Object initWithType (uint type, NSArray subpredicates) | 38 Object initWithType (uint type, NSArray subpredicates) |
28 { | 39 { |
29 return invokeObjcSelf!(Object, "initWithType:subpredicates:", uint, NSArray)(type, subpredicates); | 40 return invokeObjcSelf!(Object, "initWithType:subpredicates:", uint, NSArray)(type, subpredicates); |
30 } | 41 } |
31 | 42 |
32 this (uint type, NSArray subpredicates) | 43 this (uint type, NSArray subpredicates) |
33 { | 44 { |
34 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 45 typeof(this).alloc.initWithType(type, subpredicates); |
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 } | 46 } |
42 | 47 |
43 uint compoundPredicateType () | 48 uint compoundPredicateType () |
44 { | 49 { |
45 return invokeObjcSelf!(uint, "compoundPredicateType"); | 50 return invokeObjcSelf!(uint, "compoundPredicateType"); |
50 return invokeObjcSelf!(NSArray, "subpredicates"); | 55 return invokeObjcSelf!(NSArray, "subpredicates"); |
51 } | 56 } |
52 | 57 |
53 static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates) | 58 static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates) |
54 { | 59 { |
55 return invokeObjcSelfClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); | 60 return invokeObjcSuperClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates); |
56 } | 61 } |
57 | 62 |
58 static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates) | 63 static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates) |
59 { | 64 { |
60 return invokeObjcSelfClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); | 65 return invokeObjcSuperClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates); |
61 } | 66 } |
62 | 67 |
63 static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate) | 68 static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate) |
64 { | 69 { |
65 return invokeObjcSelfClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); | 70 return invokeObjcSuperClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate); |
66 } | 71 } |
67 } | 72 } |
68 | 73 |