comparison dstep/foundation/NSComparisonPredicate.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.NSComparisonPredicate; 7 module dstep.foundation.NSComparisonPredicate;
8 8
9 import dstep.foundation.NSExpression; 9 import dstep.foundation.NSExpression;
10 import dstep.foundation.NSObjCRuntime;
10 import dstep.foundation.NSPredicate; 11 import dstep.foundation.NSPredicate;
11 import dstep.foundation.NSPredicateOperator;
12 import dstep.objc.bridge.Bridge; 12 import dstep.objc.bridge.Bridge;
13 import dstep.objc.objc : id; 13 import dstep.objc.objc;
14 14
15 alias NSUInteger NSComparisonPredicateModifier; 15 alias NSUInteger NSComparisonPredicateModifier;
16 alias NSUInteger NSPredicateOperatorType; 16 alias NSUInteger NSPredicateOperatorType;
17 17
18 enum 18 enum
46 NSBetweenPredicateOperatorType 46 NSBetweenPredicateOperatorType
47 } 47 }
48 48
49 class NSComparisonPredicate : NSPredicate 49 class NSComparisonPredicate : NSPredicate
50 { 50 {
51 mixin ObjcWrap; 51 mixin (ObjcWrap);
52
53 this ()
54 {
55 super(typeof(this).alloc.init.objcObject);
56 }
57
58 typeof(this) init ()
59 {
60 return invokeObjcSelf!(typeof(this), "init");
61 }
52 62
53 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) 63 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
54 { 64 {
55 return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); 65 return invokeObjcSuperClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options);
56 } 66 }
57 67
58 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) 68 static NSPredicate predicateWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector)
59 { 69 {
60 return invokeObjcSelfClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); 70 return invokeObjcSuperClass!(NSPredicate, "predicateWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector);
61 } 71 }
62 72
63 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) 73 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
64 { 74 {
65 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options); 75 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:modifier:type:options:", NSExpression, NSExpression, uint, uint, NSUInteger)(lhs, rhs, modifier, type, options);
66 } 76 }
67 77
68 this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options) 78 this (NSExpression lhs, NSExpression rhs, uint modifier, uint type, NSUInteger options)
69 { 79 {
70 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 80 typeof(this).alloc.initWithLeftExpression(lhs, rhs, modifier, type, options);
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 } 81 }
78 82
79 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector) 83 Object initWithLeftExpression (NSExpression lhs, NSExpression rhs, SEL selector)
80 { 84 {
81 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector); 85 return invokeObjcSelf!(Object, "initWithLeftExpression:rightExpression:customSelector:", NSExpression, NSExpression, SEL)(lhs, rhs, selector);
82 } 86 }
83 87
84 this (NSExpression lhs, NSExpression rhs, SEL selector) 88 this (NSExpression lhs, NSExpression rhs, SEL selector)
85 { 89 {
86 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 90 typeof(this).alloc.initWithLeftExpression(lhs, rhs, selector);
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 } 91 }
94 92
95 uint predicateOperatorType () 93 uint predicateOperatorType ()
96 { 94 {
97 return invokeObjcSelf!(uint, "predicateOperatorType"); 95 return invokeObjcSelf!(uint, "predicateOperatorType");