Mercurial > projects > dstep
annotate 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 |
rev | line source |
---|---|
14 | 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.NSPointerFunctions; | |
8 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
9 import dstep.foundation.NSObjCRuntime; |
14 | 10 import dstep.foundation.NSObject; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
11 import dstep.foundation.NSZone; |
14 | 12 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.objc.objc; |
14 | 14 |
15 alias NSUInteger NSPointerFunctionsOptions; | |
16 | |
17 enum | |
18 { | |
19 NSPointerFunctionsStrongMemory = (0 << 0), | |
20 NSPointerFunctionsZeroingWeakMemory = (1 << 0), | |
21 NSPointerFunctionsOpaqueMemory = (2 << 0), | |
22 NSPointerFunctionsMallocMemory = (3 << 0), | |
23 NSPointerFunctionsMachVirtualMemory = (4 << 0), | |
24 NSPointerFunctionsObjectPersonality = (0 << 8), | |
25 NSPointerFunctionsOpaquePersonality = (1 << 8), | |
26 NSPointerFunctionsObjectPointerPersonality = (2 << 8), | |
27 NSPointerFunctionsCStringPersonality = (3 << 8), | |
28 NSPointerFunctionsStructPersonality = (4 << 8), | |
29 NSPointerFunctionsIntegerPersonality = (5 << 8), | |
30 NSPointerFunctionsCopyIn = (1 << 16) | |
31 } | |
32 | |
33 class NSPointerFunctions : NSObject, INSCopying | |
34 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 mixin (ObjcWrap); |
14 | 36 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
37 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
38 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
39 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
40 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
41 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
44 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
45 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 |
14 | 47 Object initWithOptions (uint options) |
48 { | |
49 return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); | |
50 } | |
51 | |
52 this (uint options) | |
53 { | |
54 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
55 id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options); | |
56 | |
57 if (result) | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 objcObject = result; |
14 | 59 |
60 dObject = this; | |
61 } | |
62 | |
63 static Object pointerFunctionsWithOptions (uint options) | |
64 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
65 return invokeObjcSuperClass!(Object, "pointerFunctionsWithOptions:", uint)(options); |
14 | 66 } |
67 | |
68 bool usesStrongWriteBarrier () | |
69 { | |
70 return invokeObjcSelf!(bool, "usesStrongWriteBarrier"); | |
71 } | |
72 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 void setUsesStrongWriteBarrier (bool arg) |
14 | 74 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
75 return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)(arg); |
14 | 76 } |
77 | |
78 bool usesWeakReadAndWriteBarriers () | |
79 { | |
80 return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers"); | |
81 } | |
82 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
83 void setUsesWeakReadAndWriteBarriers (bool arg) |
14 | 84 { |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
85 return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)(arg); |
14 | 86 } |
87 | |
88 Object copyWithZone (NSZone* zone) | |
89 { | |
90 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
91 } | |
92 } | |
93 |