diff 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
line wrap: on
line diff
--- a/dstep/foundation/NSCompoundPredicate.d	Mon Aug 03 15:31:48 2009 +0200
+++ b/dstep/foundation/NSCompoundPredicate.d	Sun Jan 03 22:06:11 2010 +0100
@@ -7,9 +7,10 @@
 module dstep.foundation.NSCompoundPredicate;
 
 import dstep.foundation.NSArray;
+import dstep.foundation.NSObjCRuntime;
 import dstep.foundation.NSPredicate;
 import dstep.objc.bridge.Bridge;
-import dstep.objc.objc : id;
+import dstep.objc.objc;
 
 alias NSUInteger NSCompoundPredicateType;
 
@@ -22,7 +23,17 @@
 
 class NSCompoundPredicate : NSPredicate
 {
-	mixin ObjcWrap;
+	mixin (ObjcWrap);
+	
+	this ()
+	{
+		super(typeof(this).alloc.init.objcObject);
+	}
+	
+	typeof(this) init ()
+	{
+		return invokeObjcSelf!(typeof(this), "init");
+	}
 
 	Object initWithType (uint type, NSArray subpredicates)
 	{
@@ -31,13 +42,7 @@
 
 	this (uint type, NSArray subpredicates)
 	{
-		objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
-		id result = Bridge.invokeObjcMethod!(id, "initWithType:subpredicates:", uint, NSArray)(objcObject, type, subpredicates);
-
-		if (result)
-			objcObject = ret;
-
-		dObject = this;
+		typeof(this).alloc.initWithType(type, subpredicates);
 	}
 
 	uint compoundPredicateType ()
@@ -52,17 +57,17 @@
 
 	static NSPredicate andPredicateWithSubpredicates (NSArray subpredicates)
 	{
-		return invokeObjcSelfClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates);
+		return invokeObjcSuperClass!(NSPredicate, "andPredicateWithSubpredicates:", NSArray)(subpredicates);
 	}
 
 	static NSPredicate orPredicateWithSubpredicates (NSArray subpredicates)
 	{
-		return invokeObjcSelfClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates);
+		return invokeObjcSuperClass!(NSPredicate, "orPredicateWithSubpredicates:", NSArray)(subpredicates);
 	}
 
 	static NSPredicate notPredicateWithSubpredicate (NSPredicate predicate)
 	{
-		return invokeObjcSelfClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate);
+		return invokeObjcSuperClass!(NSPredicate, "notPredicateWithSubpredicate:", NSPredicate)(predicate);
 	}
 }