Mercurial > projects > dstep
annotate dstep/foundation/NSAppleEventDescriptor.d @ 15:7ff919f595d5
Added the Foundation framework, again
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Mon, 03 Aug 2009 15:31:48 +0200 |
parents | 89f3c3ef1fd2 |
children | 19885b43130e |
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.NSAppleEventDescriptor; | |
8 | |
9 import dstep.applicationservices.ApplicationServices; | |
10 import dstep.foundation.NSData; | |
11 import dstep.foundation.NSObject; | |
12 import dstep.objc.bridge.Bridge; | |
13 import dstep.objc.objc : id; | |
14 | |
15 class NSAppleEventDescriptor : NSObject, INSCopying | |
16 { | |
17 mixin ObjcWrap; | |
18 | |
19 static NSAppleEventDescriptor nullDescriptor () | |
20 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 return invokeObjcSelfClass!(NSAppleEventDescriptor, "nullDescriptor"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 } |
14 | 23 |
24 static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) | |
25 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 } |
14 | 28 |
29 static NSAppleEventDescriptor descriptorWithDescriptorType (uint descriptorType, NSData data) | |
30 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithDescriptorType:data:", uint, NSData)(descriptorType, data); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 } |
14 | 33 |
34 static NSAppleEventDescriptor descriptorWithBoolean (ubyte boolean) | |
35 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
36 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithBoolean:", ubyte)(boolean); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
37 } |
14 | 38 |
39 static NSAppleEventDescriptor descriptorWithEnumCode (uint enumerator) | |
40 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
41 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithEnumCode:", uint)(enumerator); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 } |
14 | 43 |
44 static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) | |
45 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithInt32:", int)(signedInt); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 } |
14 | 48 |
49 static NSAppleEventDescriptor descriptorWithTypeCode (uint typeCode) | |
50 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
51 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithTypeCode:", uint)(typeCode); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
52 } |
14 | 53 |
54 static NSAppleEventDescriptor descriptorWithString (NSString string) | |
55 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
56 return invokeObjcSelfClass!(NSAppleEventDescriptor, "descriptorWithString:", NSString)(string); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
57 } |
14 | 58 |
59 static NSAppleEventDescriptor appleEventWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) | |
60 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 return invokeObjcSelfClass!(NSAppleEventDescriptor, "appleEventWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionID); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
62 } |
14 | 63 |
64 static NSAppleEventDescriptor listDescriptor () | |
65 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
66 return invokeObjcSelfClass!(NSAppleEventDescriptor, "listDescriptor"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
67 } |
14 | 68 |
69 static NSAppleEventDescriptor recordDescriptor () | |
70 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
71 return invokeObjcSelfClass!(NSAppleEventDescriptor, "recordDescriptor"); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
72 } |
14 | 73 |
74 Object initWithAEDescNoCopy (AEDesc* aeDesc) | |
75 { | |
76 return invokeObjcSelf!(Object, "initWithAEDescNoCopy:", AEDesc*)(aeDesc); | |
77 } | |
78 | |
79 this (AEDesc* aeDesc) | |
80 { | |
81 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
82 id result = Bridge.invokeObjcMethod!(id, "initWithAEDescNoCopy:", AEDesc*)(objcObject, aeDesc); | |
83 | |
84 if (result) | |
85 objcObject = ret; | |
86 | |
87 dObject = this; | |
88 } | |
89 | |
90 Object initWithDescriptorType (uint descriptorType, void* bytes, NSUInteger byteCount) | |
91 { | |
92 return invokeObjcSelf!(Object, "initWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(descriptorType, bytes, byteCount); | |
93 } | |
94 | |
95 this (uint descriptorType, void* bytes, NSUInteger byteCount) | |
96 { | |
97 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
98 id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:bytes:length:", uint, void*, NSUInteger)(objcObject, descriptorType, bytes, byteCount); | |
99 | |
100 if (result) | |
101 objcObject = ret; | |
102 | |
103 dObject = this; | |
104 } | |
105 | |
106 Object initWithDescriptorType (uint descriptorType, NSData data) | |
107 { | |
108 return invokeObjcSelf!(Object, "initWithDescriptorType:data:", uint, NSData)(descriptorType, data); | |
109 } | |
110 | |
111 this (uint descriptorType, NSData data) | |
112 { | |
113 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
114 id result = Bridge.invokeObjcMethod!(id, "initWithDescriptorType:data:", uint, NSData)(objcObject, descriptorType, data); | |
115 | |
116 if (result) | |
117 objcObject = ret; | |
118 | |
119 dObject = this; | |
120 } | |
121 | |
122 Object initWithEventClass (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) | |
123 { | |
124 return invokeObjcSelf!(Object, "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(eventClass, eventID, targetDescriptor, returnID, transactionID); | |
125 } | |
126 | |
127 this (uint eventClass, uint eventID, NSAppleEventDescriptor targetDescriptor, short returnID, int transactionID) | |
128 { | |
129 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
130 id result = Bridge.invokeObjcMethod!(id, "initWithEventClass:eventID:targetDescriptor:returnID:transactionID:", uint, uint, NSAppleEventDescriptor, short, int)(objcObject, eventClass, eventID, targetDescriptor, returnID, transactionID); | |
131 | |
132 if (result) | |
133 objcObject = ret; | |
134 | |
135 dObject = this; | |
136 } | |
137 | |
138 Object initListDescriptor () | |
139 { | |
140 return invokeObjcSelf!(Object, "initListDescriptor"); | |
141 } | |
142 | |
143 this () | |
144 { | |
145 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
146 id result = Bridge.invokeObjcMethod!(id, "initListDescriptor")(objcObject); | |
147 | |
148 if (result) | |
149 objcObject = ret; | |
150 | |
151 dObject = this; | |
152 } | |
153 | |
154 Object initRecordDescriptor () | |
155 { | |
156 return invokeObjcSelf!(Object, "initRecordDescriptor"); | |
157 } | |
158 | |
159 this () | |
160 { | |
161 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
162 id result = Bridge.invokeObjcMethod!(id, "initRecordDescriptor")(objcObject); | |
163 | |
164 if (result) | |
165 objcObject = ret; | |
166 | |
167 dObject = this; | |
168 } | |
169 | |
170 AEDesc* aeDesc () | |
171 { | |
172 return invokeObjcSelf!(AEDesc*, "aeDesc"); | |
173 } | |
174 | |
175 uint descriptorType () | |
176 { | |
177 return invokeObjcSelf!(uint, "descriptorType"); | |
178 } | |
179 | |
180 NSData data () | |
181 { | |
182 return invokeObjcSelf!(NSData, "data"); | |
183 } | |
184 | |
185 ubyte booleanValue () | |
186 { | |
187 return invokeObjcSelf!(ubyte, "booleanValue"); | |
188 } | |
189 | |
190 uint enumCodeValue () | |
191 { | |
192 return invokeObjcSelf!(uint, "enumCodeValue"); | |
193 } | |
194 | |
195 int int32Value () | |
196 { | |
197 return invokeObjcSelf!(int, "int32Value"); | |
198 } | |
199 | |
200 uint typeCodeValue () | |
201 { | |
202 return invokeObjcSelf!(uint, "typeCodeValue"); | |
203 } | |
204 | |
205 NSString stringValue () | |
206 { | |
207 return invokeObjcSelf!(NSString, "stringValue"); | |
208 } | |
209 | |
210 uint eventClass () | |
211 { | |
212 return invokeObjcSelf!(uint, "eventClass"); | |
213 } | |
214 | |
215 uint eventID () | |
216 { | |
217 return invokeObjcSelf!(uint, "eventID"); | |
218 } | |
219 | |
220 short returnID () | |
221 { | |
222 return invokeObjcSelf!(short, "returnID"); | |
223 } | |
224 | |
225 int transactionID () | |
226 { | |
227 return invokeObjcSelf!(int, "transactionID"); | |
228 } | |
229 | |
230 void setParamDescriptor (NSAppleEventDescriptor descriptor, uint keyword) | |
231 { | |
232 return invokeObjcSelf!(void, "setParamDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); | |
233 } | |
234 | |
235 NSAppleEventDescriptor paramDescriptorForKeyword (uint keyword) | |
236 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
237 id result = invokeObjcSelf!(id, "paramDescriptorForKeyword:", uint)(keyword); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
238 return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
239 } |
14 | 240 |
241 void removeParamDescriptorWithKeyword (uint keyword) | |
242 { | |
243 return invokeObjcSelf!(void, "removeParamDescriptorWithKeyword:", uint)(keyword); | |
244 } | |
245 | |
246 void setAttributeDescriptor (NSAppleEventDescriptor descriptor, uint keyword) | |
247 { | |
248 return invokeObjcSelf!(void, "setAttributeDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); | |
249 } | |
250 | |
251 NSAppleEventDescriptor attributeDescriptorForKeyword (uint keyword) | |
252 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
253 id result = invokeObjcSelf!(id, "attributeDescriptorForKeyword:", uint)(keyword); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
254 return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
255 } |
14 | 256 |
257 NSInteger numberOfItems () | |
258 { | |
259 return invokeObjcSelf!(NSInteger, "numberOfItems"); | |
260 } | |
261 | |
262 void insertDescriptor (NSAppleEventDescriptor descriptor, NSInteger index) | |
263 { | |
264 return invokeObjcSelf!(void, "insertDescriptor:atIndex:", NSAppleEventDescriptor, NSInteger)(descriptor, index); | |
265 } | |
266 | |
267 NSAppleEventDescriptor descriptorAtIndex (NSInteger index) | |
268 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
269 id result = invokeObjcSelf!(id, "descriptorAtIndex:", NSInteger)(index); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
270 return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
271 } |
14 | 272 |
273 void removeDescriptorAtIndex (NSInteger index) | |
274 { | |
275 return invokeObjcSelf!(void, "removeDescriptorAtIndex:", NSInteger)(index); | |
276 } | |
277 | |
278 void setDescriptor (NSAppleEventDescriptor descriptor, uint keyword) | |
279 { | |
280 return invokeObjcSelf!(void, "setDescriptor:forKeyword:", NSAppleEventDescriptor, uint)(descriptor, keyword); | |
281 } | |
282 | |
283 NSAppleEventDescriptor descriptorForKeyword (uint keyword) | |
284 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
285 id result = invokeObjcSelf!(id, "descriptorForKeyword:", uint)(keyword); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
286 return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
287 } |
14 | 288 |
289 void removeDescriptorWithKeyword (uint keyword) | |
290 { | |
291 return invokeObjcSelf!(void, "removeDescriptorWithKeyword:", uint)(keyword); | |
292 } | |
293 | |
294 uint keywordForDescriptorAtIndex (NSInteger index) | |
295 { | |
296 return invokeObjcSelf!(uint, "keywordForDescriptorAtIndex:", NSInteger)(index); | |
297 } | |
298 | |
299 NSAppleEventDescriptor coerceToDescriptorType (uint descriptorType) | |
300 { | |
15
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
301 id result = invokeObjcSelf!(id, "coerceToDescriptorType:", uint)(descriptorType); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
302 return result is this.objcObject ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); |
7ff919f595d5
Added the Foundation framework, again
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
303 } |
14 | 304 |
305 Object copyWithZone (NSZone* zone) | |
306 { | |
307 return invokeObjcSelf!(Object, "copyWithZone:", NSZone*)(zone); | |
308 } | |
309 } | |
310 |