Mercurial > projects > dstep
comparison dstep/foundation/NSPointerFunctions.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 |
---|---|
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.NSPointerFunctions; | 7 module dstep.foundation.NSPointerFunctions; |
8 | 8 |
9 import dstep.foundation.NSObjCRuntime; | |
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 alias NSUInteger NSPointerFunctionsOptions; | 15 alias NSUInteger NSPointerFunctionsOptions; |
14 | 16 |
15 enum | 17 enum |
16 { | 18 { |
28 NSPointerFunctionsCopyIn = (1 << 16) | 30 NSPointerFunctionsCopyIn = (1 << 16) |
29 } | 31 } |
30 | 32 |
31 class NSPointerFunctions : NSObject, INSCopying | 33 class NSPointerFunctions : NSObject, INSCopying |
32 { | 34 { |
33 mixin ObjcWrap; | 35 mixin (ObjcWrap); |
34 | 36 |
37 this () | |
38 { | |
39 super(typeof(this).alloc.init.objcObject); | |
40 } | |
41 | |
42 typeof(this) init () | |
43 { | |
44 return invokeObjcSelf!(typeof(this), "init"); | |
45 } | |
46 | |
35 Object initWithOptions (uint options) | 47 Object initWithOptions (uint options) |
36 { | 48 { |
37 return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); | 49 return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); |
38 } | 50 } |
39 | 51 |
41 { | 53 { |
42 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | 54 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); |
43 id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); | 55 id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); |
44 | 56 |
45 if (result) | 57 if (result) |
46 objcObject = ret; | 58 objcObject = result; |
47 | 59 |
48 dObject = this; | 60 dObject = this; |
49 } | 61 } |
50 | 62 |
51 static Object pointerFunctionsWithOptions (uint options) | 63 static Object pointerFunctionsWithOptions (uint options) |
52 { | 64 { |
53 return invokeObjcSelfClass!(Object, "pointerFunctionsWithOptions:", uint)(options); | 65 return invokeObjcSuperClass!(Object, "pointerFunctionsWithOptions:", uint)(options); |
54 } | 66 } |
55 | 67 |
56 bool usesStrongWriteBarrier () | 68 bool usesStrongWriteBarrier () |
57 { | 69 { |
58 return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); | 70 return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); |
59 } | 71 } |
60 | 72 |
61 void setUsesStrongWriteBarrier (bool ) | 73 void setUsesStrongWriteBarrier (bool arg) |
62 { | 74 { |
63 return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(); | 75 return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(arg); |
64 } | 76 } |
65 | 77 |
66 bool usesWeakReadAndWriteBarriers () | 78 bool usesWeakReadAndWriteBarriers () |
67 { | 79 { |
68 return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); | 80 return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); |
69 } | 81 } |
70 | 82 |
71 void setUsesWeakReadAndWriteBarriers (bool ) | 83 void setUsesWeakReadAndWriteBarriers (bool arg) |
72 { | 84 { |
73 return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(); | 85 return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(arg); |
74 } | 86 } |
75 | 87 |
76 Object copyWithZone (NSZone* zone) | 88 Object copyWithZone (NSZone* zone) |
77 { | 89 { |
78 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | 90 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); |