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