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
|
|
9 import dstep.foundation.NSObject;
|
|
10 import dstep.objc.bridge.Bridge;
|
|
11 import dstep.objc.objc : id;
|
|
12
|
|
13 alias NSUInteger NSPointerFunctionsOptions;
|
|
14
|
|
15 enum
|
|
16 {
|
|
17 NSPointerFunctionsStrongMemory = (0 << 0),
|
|
18 NSPointerFunctionsZeroingWeakMemory = (1 << 0),
|
|
19 NSPointerFunctionsOpaqueMemory = (2 << 0),
|
|
20 NSPointerFunctionsMallocMemory = (3 << 0),
|
|
21 NSPointerFunctionsMachVirtualMemory = (4 << 0),
|
|
22 NSPointerFunctionsObjectPersonality = (0 << 8),
|
|
23 NSPointerFunctionsOpaquePersonality = (1 << 8),
|
|
24 NSPointerFunctionsObjectPointerPersonality = (2 << 8),
|
|
25 NSPointerFunctionsCStringPersonality = (3 << 8),
|
|
26 NSPointerFunctionsStructPersonality = (4 << 8),
|
|
27 NSPointerFunctionsIntegerPersonality = (5 << 8),
|
|
28 NSPointerFunctionsCopyIn = (1 << 16)
|
|
29 }
|
|
30
|
|
31 class NSPointerFunctions : NSObject, INSCopying
|
|
32 {
|
|
33 mixin ObjcWrap;
|
|
34
|
|
35 Object initWithOptions (uint options)
|
|
36 {
|
|
37 return invokeObjcSelf!(Object, "initWithOptions:", uint)(options);
|
|
38 }
|
|
39
|
|
40 this (uint options)
|
|
41 {
|
|
42 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
43 id result = Bridge.invokeObjcMethod!(id, "initWithOptions:", uint)(objcObject, options);
|
|
44
|
|
45 if (result)
|
|
46 objcObject = ret;
|
|
47
|
|
48 dObject = this;
|
|
49 }
|
|
50
|
|
51 static Object pointerFunctionsWithOptions (uint options)
|
|
52 {
|
|
53 return invokeObjcSelfClass!(Object, "pointerFunctionsWithOptions:", uint)(options);
|
|
54 }
|
|
55
|
|
56 bool usesStrongWriteBarrier ()
|
|
57 {
|
|
58 return invokeObjcSelf!(bool, "usesStrongWriteBarrier");
|
|
59 }
|
|
60
|
|
61 void setUsesStrongWriteBarrier (bool )
|
|
62 {
|
|
63 return invokeObjcSelf!(void, "setUsesStrongWriteBarrier:", bool)();
|
|
64 }
|
|
65
|
|
66 bool usesWeakReadAndWriteBarriers ()
|
|
67 {
|
|
68 return invokeObjcSelf!(bool, "usesWeakReadAndWriteBarriers");
|
|
69 }
|
|
70
|
|
71 void setUsesWeakReadAndWriteBarriers (bool )
|
|
72 {
|
|
73 return invokeObjcSelf!(void, "setUsesWeakReadAndWriteBarriers:", bool)();
|
|
74 }
|
|
75
|
|
76 Object copyWithZone (NSZone* zone)
|
|
77 {
|
|
78 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone);
|
|
79 }
|
|
80 }
|
|
81
|