comparison dstep/foundation/NSPortMessage.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
6 */ 6 */
7 module dstep.foundation.NSPortMessage; 7 module dstep.foundation.NSPortMessage;
8 8
9 import dstep.foundation.NSArray; 9 import dstep.foundation.NSArray;
10 import dstep.foundation.NSDate; 10 import dstep.foundation.NSDate;
11 import dstep.foundation.NSMutableArray;
12 import dstep.foundation.NSObject; 11 import dstep.foundation.NSObject;
13 import dstep.foundation.NSPort; 12 import dstep.foundation.NSPort;
14 import dstep.objc.bridge.Bridge; 13 import dstep.objc.bridge.Bridge;
15 import dstep.objc.objc : id; 14 import dstep.objc.objc;
16 15
17 class NSPortMessage : NSObject 16 class NSPortMessage : NSObject
18 { 17 {
19 mixin ObjcWrap; 18 mixin (ObjcWrap);
19
20 this ()
21 {
22 super(typeof(this).alloc.init.objcObject);
23 }
24
25 typeof(this) init ()
26 {
27 return invokeObjcSelf!(typeof(this), "init");
28 }
20 29
21 Object initWithSendPort (NSPort sendPort, NSPort replyPort, NSArray components) 30 Object initWithSendPort (NSPort sendPort, NSPort replyPort, NSArray components)
22 { 31 {
23 return invokeObjcSelf!(Object, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(sendPort, replyPort, components); 32 return invokeObjcSelf!(Object, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(sendPort, replyPort, components);
24 } 33 }
25 34
26 this (NSPort sendPort, NSPort replyPort, NSArray components) 35 this (NSPort sendPort, NSPort replyPort, NSArray components)
27 { 36 {
28 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 37 typeof(this).alloc.initWithSendPort(sendPort, replyPort, components);
29 id result = Bridge.invokeObjcMethod!(id, "initWithSendPort:receivePort:components:", NSPort, NSPort, NSArray)(objcObject, sendPort, replyPort, components);
30
31 if (result)
32 objcObject = ret;
33
34 dObject = this;
35 } 38 }
36 39
37 NSArray components () 40 NSArray components ()
38 { 41 {
39 return invokeObjcSelf!(NSArray, "components"); 42 return invokeObjcSelf!(NSArray, "components");