comparison dstep/foundation/NSNull.d @ 14:89f3c3ef1fd2

Added the Foundation framework
author Jacob Carlborg <doob@me.com>
date Mon, 03 Aug 2009 15:23:15 +0200
parents
children 7ff919f595d5
comparison
equal deleted inserted replaced
13:4f583f7e242e 14:89f3c3ef1fd2
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Aug 3, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.foundation.NSNull;
8
9 import dstep.foundation.NSObject;
10 import dstep.objc.bridge.Bridge;
11 import dstep.objc.objc : id;
12
13 class NSNull : NSObject, INSCopying, INSCoding
14 {
15 mixin ObjcWrap;
16
17 static NSNull null_ ()
18 {
19 return invokeObjcSelfClass!(NSNull, "null"return result is this.objcObject ? this : (result !is null ? new NSNull(result) : null); }
20
21 Object copyWithZone (NSZone* zone)
22 {
23 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
24 }
25
26 void encodeWithCoder (NSCoder aCoder)
27 {
28 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder);
29 }
30
31 Object initWithCoder (NSCoder aDecoder)
32 {
33 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder);
34 }
35
36 this (NSCoder aDecoder)
37 {
38 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
39 id result = Bridge.invokeObjcMethod!(id, "initWithCoder:", NSCoder)(objcObject, aDecoder);
40
41 if (result)
42 objcObject = ret;
43
44 dObject = this;
45 }
46 }
47