comparison dstep/foundation/NSProxy.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.NSProxy; 7 module dstep.foundation.NSProxy;
8 8
9 import dstep.foundation.NSInvocation; 9 import dstep.foundation.NSInvocation;
10 import dstep.foundation.NSMethodSignature; 10 import dstep.foundation.NSMethodSignature;
11 import dstep.foundation.NSObjCRuntime;
11 import dstep.foundation.NSObject; 12 import dstep.foundation.NSObject;
13 import dstep.foundation.NSString;
14 import dstep.foundation.NSZone;
12 import dstep.objc.bridge.Bridge; 15 import dstep.objc.bridge.Bridge;
13 import dstep.objc.objc : id; 16 import dstep.objc.bridge.Wrapper;
17 import dstep.objc.objc;
18 import dstep.objc.runtime;
14 19
15 class NSProxy : INSObject 20 class NSProxy : ObjcWrapper, INSObject
16 { 21 {
17 mixin ObjcWrap; 22 mixin (ObjcWrap);
23
24 this ()
25 {
26 super(typeof(this).alloc.init.objcObject);
27 }
18 28
19 static Object alloc () 29 typeof(this) init ()
20 { 30 {
21 return invokeObjcSelfClass!(Object, "alloc"); 31 return invokeObjcSelf!(typeof(this), "init");
22 } 32 }
23 33
24 static Object allocWithZone (NSZone* zone) 34 static Object allocWithZone (NSZone* zone)
25 { 35 {
26 return invokeObjcSelfClass!(Object, "allocWithZone:", NSZone*)(zone); 36 return invokeObjcSuperClass!(Object, "allocWithZone:", NSZone*)(zone);
27 } 37 }
28 38
29 static Class class_ () 39 static Class class_static ()
30 { 40 {
31 return invokeObjcSelfClass!(Class, "class"); 41 return invokeObjcSuperClass!(Class, "class");
32 } 42 }
33 43
34 void forwardInvocation (NSInvocation invocation) 44 void forwardInvocation (NSInvocation invocation)
35 { 45 {
36 return invokeObjcSelf!(void, "forwardInvocation:", NSInvocation)(invocation); 46 return invokeObjcSelf!(void, "forwardInvocation:", NSInvocation)(invocation);
56 return invokeObjcSelf!(NSString, "description"); 66 return invokeObjcSelf!(NSString, "description");
57 } 67 }
58 68
59 static bool respondsToSelector (SEL aSelector) 69 static bool respondsToSelector (SEL aSelector)
60 { 70 {
61 return invokeObjcSelfClass!(bool, "respondsToSelector:", SEL)(aSelector); 71 return invokeObjcSuperClass!(bool, "respondsToSelector:", SEL)(aSelector);
62 } 72 }
63 73
64 bool isEqual (Object object) 74 bool isEqual (Object object)
65 { 75 {
66 return invokeObjcSelf!(bool, "isEqual:", Object)(object); 76 return invokeObjcSelf!(bool, "isEqual:", Object)(object);
148 158
149 NSUInteger retainCount () 159 NSUInteger retainCount ()
150 { 160 {
151 return invokeObjcSelf!(NSUInteger, "retainCount"); 161 return invokeObjcSelf!(NSUInteger, "retainCount");
152 } 162 }
153
154 NSString description ()
155 {
156 return invokeObjcSelf!(NSString, "description");
157 }
158 } 163 }
159 164