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