Mercurial > projects > dstep
annotate dstep/foundation/NSPointerArray.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.NSPointerArray; | |
8 | |
9 import dstep.foundation.NSArray; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
10 import dstep.foundation.NSCoder; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
11 import dstep.foundation.NSEnumerator; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
12 import dstep.foundation.NSObjCRuntime; |
14 | 13 import dstep.foundation.NSObject; |
14 import dstep.foundation.NSPointerFunctions; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 import dstep.foundation.NSZone; |
14 | 16 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
18 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
19 const TNSArrayConveniences = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 static Object pointerArrayWithStrongObjects () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 return invokeObjcSuperClass!(Object, "pointerArrayWithStrongObjects"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 static Object pointerArrayWithWeakObjects () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 return invokeObjcSuperClass!(Object, "pointerArrayWithWeakObjects"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 NSArray allObjects () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
33 return invokeObjcSelf!(NSArray, "allObjects"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
34 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 `; |
14 | 36 |
37 class NSPointerArray : NSObject, INSFastEnumeration, INSCopying, INSCoding | |
38 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
39 mixin (ObjcWrap); |
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 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
44 } |
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 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
49 } |
14 | 50 |
51 Object initWithOptions (uint options) | |
52 { | |
53 return invokeObjcSelf!(Object, "initWithOptions:", uint)(options); | |
54 } | |
55 | |
56 this (uint options) | |
57 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 typeof(this).alloc.initWithOptions(options); |
14 | 59 } |
60 | |
61 Object initWithPointerFunctions (NSPointerFunctions functions) | |
62 { | |
63 return invokeObjcSelf!(Object, "initWithPointerFunctions:", NSPointerFunctions)(functions); | |
64 } | |
65 | |
66 this (NSPointerFunctions functions) | |
67 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 typeof(this).alloc.initWithPointerFunctions(functions); |
14 | 69 } |
70 | |
71 static Object pointerArrayWithOptions (uint options) | |
72 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 return invokeObjcSuperClass!(Object, "pointerArrayWithOptions:", uint)(options); |
14 | 74 } |
75 | |
76 static Object pointerArrayWithPointerFunctions (NSPointerFunctions functions) | |
77 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
78 return invokeObjcSuperClass!(Object, "pointerArrayWithPointerFunctions:", NSPointerFunctions)(functions); |
14 | 79 } |
80 | |
81 NSPointerFunctions pointerFunctions () | |
82 { | |
83 return invokeObjcSelf!(NSPointerFunctions, "pointerFunctions"); | |
84 } | |
85 | |
86 void* pointerAtIndex (NSUInteger index) | |
87 { | |
88 return invokeObjcSelf!(void*, "pointerAtIndex:", NSUInteger)(index); | |
89 } | |
90 | |
91 void addPointer (void* pointer) | |
92 { | |
93 return invokeObjcSelf!(void, "addPointer:", void*)(pointer); | |
94 } | |
95 | |
96 void removePointerAtIndex (NSUInteger index) | |
97 { | |
98 return invokeObjcSelf!(void, "removePointerAtIndex:", NSUInteger)(index); | |
99 } | |
100 | |
101 void insertPointer (void* item, NSUInteger index) | |
102 { | |
103 return invokeObjcSelf!(void, "insertPointer:atIndex:", void*, NSUInteger)(item, index); | |
104 } | |
105 | |
106 void replacePointerAtIndex (NSUInteger index, void* item) | |
107 { | |
108 return invokeObjcSelf!(void, "replacePointerAtIndex:withPointer:", NSUInteger, void*)(index, item); | |
109 } | |
110 | |
111 void compact () | |
112 { | |
113 return invokeObjcSelf!(void, "compact"); | |
114 } | |
115 | |
116 NSUInteger count () | |
117 { | |
118 return invokeObjcSelf!(NSUInteger, "count"); | |
119 } | |
120 | |
121 void setCount (NSUInteger count) | |
122 { | |
123 return invokeObjcSelf!(void, "setCount:", NSUInteger)(count); | |
124 } | |
125 | |
126 NSUInteger countByEnumeratingWithState (NSFastEnumerationState* state, id* stackbuf, NSUInteger len) | |
127 { | |
128 return invokeObjcSelf!(NSUInteger, "countByEnumeratingWithState:objects:count:", NSFastEnumerationState*, id*, NSUInteger)(state, stackbuf, len); | |
129 } | |
130 | |
131 Object copyWithZone (NSZone* zone) | |
132 { | |
133 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
134 } | |
135 | |
136 void encodeWithCoder (NSCoder aCoder) | |
137 { | |
138 return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); | |
139 } | |
140 | |
141 Object initWithCoder (NSCoder aDecoder) | |
142 { | |
143 return invokeObjcSelf!(Object, "initWithCoder:", NSCoder)(aDecoder); | |
144 } | |
145 | |
146 this (NSCoder aDecoder) | |
147 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
148 typeof(this).alloc.initWithCoder(aDecoder); |
14 | 149 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
150 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
151 // TNSArrayConveniences |
14 | 152 static Object pointerArrayWithStrongObjects () |
153 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
154 return invokeObjcSuperClass!(Object, "pointerArrayWithStrongObjects"); |
14 | 155 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
156 |
14 | 157 static Object pointerArrayWithWeakObjects () |
158 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
159 return invokeObjcSuperClass!(Object, "pointerArrayWithWeakObjects"); |
14 | 160 } |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
161 |
14 | 162 NSArray allObjects () |
163 { | |
164 return invokeObjcSelf!(NSArray, "allObjects"); | |
165 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
166 } |