comparison dstep/foundation/NSNull.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 7ff919f595d5
children b9de51448c6b
comparison
equal deleted inserted replaced
15:7ff919f595d5 16:19885b43130e
4 * Version: Initial created: Aug 3, 2009 4 * Version: Initial created: Aug 3, 2009
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.NSNull; 7 module dstep.foundation.NSNull;
8 8
9 import dstep.foundation.NSCoder;
9 import dstep.foundation.NSObject; 10 import dstep.foundation.NSObject;
11 import dstep.foundation.NSZone;
10 import dstep.objc.bridge.Bridge; 12 import dstep.objc.bridge.Bridge;
11 import dstep.objc.objc : id; 13 import dstep.objc.objc;
12 14
13 class NSNull : NSObject, INSCopying, INSCoding 15 class NSNull : NSObject, INSCopying, INSCoding
14 { 16 {
15 mixin ObjcWrap; 17 mixin (ObjcWrap);
18
19 this ()
20 {
21 super(typeof(this).alloc.init.objcObject);
22 }
23
24 typeof(this) init ()
25 {
26 return invokeObjcSelf!(typeof(this), "init");
27 }
16 28
17 static NSNull null_ () 29 static NSNull null_ ()
18 { 30 {
19 return invokeObjcSelfClass!(NSNull, "null"); 31 return invokeObjcSuperClass!(NSNull, "null");
20 } 32 }
21 33
22 Object copyWithZone (NSZone* zone) 34 Object copyWithZone (NSZone* zone)
23 { 35 {
24 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); 36 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
34 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); 46 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
35 } 47 }
36 48
37 this (NSCoder aDecoder) 49 this (NSCoder aDecoder)
38 { 50 {
39 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); 51 typeof(this).alloc.initWithCoder(aDecoder);
40 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
41
42 if (result)
43 objcObject = ret;
44
45 dObject = this;
46 } 52 }
47 } 53 }
48 54