Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSAppleEventDescriptor.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSAppleEventDescriptor; | |
15 | |
16 import dwt.internal.c.carboncore.MacTypes : FourCharCode; | |
17 import dwt.internal.cocoa.NSData; | |
18 import dwt.internal.cocoa.NSInteger; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.NSString; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 alias FourCharCode AEKeyword; | |
24 | |
25 public class NSAppleEventDescriptor : NSObject | |
26 { | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public objc.id aeDesc () | |
38 { | |
39 return OS.objc_msgSend(this.id, OS.sel_aeDesc); | |
40 } | |
41 | |
42 public static NSAppleEventDescriptor appleEventWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor, | |
43 short returnID, objc.id transactionID) | |
44 { | |
45 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, | |
46 OS.sel_appleEventWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass, eventID, | |
47 targetDescriptor !is null ? targetDescriptor.id : null, returnID, transactionID); | |
48 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
49 } | |
50 | |
51 public NSAppleEventDescriptor attributeDescriptorForKeyword (objc.id keyword) | |
52 { | |
53 objc.id result = OS.objc_msgSend(this.id, OS.sel_attributeDescriptorForKeyword_1, keyword); | |
54 return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); | |
55 } | |
56 | |
57 public bool boolValue () | |
58 { | |
59 return OS.objc_msgSend(this.id, OS.sel_boolValue) !is null; | |
60 } | |
61 | |
62 public NSAppleEventDescriptor coerceToDescriptorType (objc.id descriptorType) | |
63 { | |
64 objc.id result = OS.objc_msgSend(this.id, OS.sel_coerceToDescriptorType_1, descriptorType); | |
65 return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); | |
66 } | |
67 | |
68 public NSData data () | |
69 { | |
70 objc.id result = OS.objc_msgSend(this.id, OS.sel_data); | |
71 return result !is null ? new NSData(result) : null; | |
72 } | |
73 | |
74 public NSAppleEventDescriptor descriptorAtIndex (NSInteger index) | |
75 { | |
76 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptorAtIndex_1, index); | |
77 return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); | |
78 } | |
79 | |
80 public NSAppleEventDescriptor descriptorForKeyword (objc.id keyword) | |
81 { | |
82 objc.id result = OS.objc_msgSend(this.id, OS.sel_descriptorForKeyword_1, keyword); | |
83 return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); | |
84 } | |
85 | |
86 public objc.id descriptorType () | |
87 { | |
88 return OS.objc_msgSend(this.id, OS.sel_descriptorType); | |
89 } | |
90 | |
91 public static NSAppleEventDescriptor descriptorWithBoolean (bool b) | |
92 { | |
93 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithBoolean_1, b); | |
94 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
95 } | |
96 | |
97 public static NSAppleEventDescriptor static_descriptorWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount) | |
98 { | |
99 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1bytes_1length_1, descriptorType, bytes, | |
100 byteCount); | |
101 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
102 } | |
103 | |
104 public static NSAppleEventDescriptor static_descriptorWithDescriptorType_data_ (objc.id descriptorType, NSData data) | |
105 { | |
106 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithDescriptorType_1data_1, descriptorType, | |
107 data !is null ? data.id : 0); | |
108 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
109 } | |
110 | |
111 public static NSAppleEventDescriptor descriptorWithEnumCode (objc.id enumerator) | |
112 { | |
113 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithEnumCode_1, enumerator); | |
114 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
115 } | |
116 | |
117 public static NSAppleEventDescriptor descriptorWithInt32 (int signedInt) | |
118 { | |
119 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithInt32_1, signedInt); | |
120 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
121 } | |
122 | |
123 public static NSAppleEventDescriptor descriptorWithString (NSString str) | |
124 { | |
125 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithString_1, str !is null ? str.id : 0); | |
126 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
127 } | |
128 | |
129 public static NSAppleEventDescriptor descriptorWithTypeCode (objc.id typeCode) | |
130 { | |
131 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_descriptorWithTypeCode_1, typeCode); | |
132 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
133 } | |
134 | |
135 public objc.id enumCodeValue () | |
136 { | |
137 return OS.objc_msgSend(this.id, OS.sel_enumCodeValue); | |
138 } | |
139 | |
140 public objc.id eventClass () | |
141 { | |
142 return OS.objc_msgSend(this.id, OS.sel_eventClass); | |
143 } | |
144 | |
145 public objc.id eventID () | |
146 { | |
147 return OS.objc_msgSend(this.id, OS.sel_eventID); | |
148 } | |
149 | |
150 public NSAppleEventDescriptor initListDescriptor () | |
151 { | |
152 objc.id result = OS.objc_msgSend(this.id, OS.sel_initListDescriptor); | |
153 return result !is null ? this : null; | |
154 } | |
155 | |
156 public NSAppleEventDescriptor initRecordDescriptor () | |
157 { | |
158 objc.id result = OS.objc_msgSend(this.id, OS.sel_initRecordDescriptor); | |
159 return result !is null ? this : null; | |
160 } | |
161 | |
162 public NSAppleEventDescriptor initWithAEDescNoCopy (objc.id aeDesc) | |
163 { | |
164 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithAEDescNoCopy_1, aeDesc); | |
165 return result !is null ? this : null; | |
166 } | |
167 | |
168 public NSAppleEventDescriptor initWithDescriptorType_bytes_length_ (objc.id descriptorType, /*const*/void* bytes, NSUInteger byteCount) | |
169 { | |
170 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDescriptorType_1bytes_1length_1, descriptorType, bytes, byteCount); | |
171 return result !is null ? this : null; | |
172 } | |
173 | |
174 public NSAppleEventDescriptor initWithDescriptorType_data_ (objc.id descriptorType, NSData data) | |
175 { | |
176 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDescriptorType_1data_1, descriptorType, data !is null ? data.id : null); | |
177 return result !is null ? this : null; | |
178 } | |
179 | |
180 public NSAppleEventDescriptor initWithEventClass (objc.id eventClass, objc.id eventID, NSAppleEventDescriptor targetDescriptor, objc.id returnID, | |
181 objc.id transactionID) | |
182 { | |
183 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithEventClass_1eventID_1targetDescriptor_1returnID_1transactionID_1, eventClass, | |
184 eventID, targetDescriptor !is null ? targetDescriptor.id : null, returnID, transactionID); | |
185 return result !is null ? this : null; | |
186 } | |
187 | |
188 public void insertDescriptor (NSAppleEventDescriptor descriptor, NSInteger index) | |
189 { | |
190 OS.objc_msgSend(this.id, OS.sel_insertDescriptor_1atIndex_1, descriptor !is null ? descriptor.id : null, index); | |
191 } | |
192 | |
193 public int int32Value () | |
194 { | |
195 return cast(int) OS.objc_msgSend(this.id, OS.sel_int32Value); | |
196 } | |
197 | |
198 public AEKeyword keywordForDescriptorAtIndex (NSInteger index) | |
199 { | |
200 return OS.objc_msgSend(this.id, OS.sel_keywordForDescriptorAtIndex_1, index); | |
201 } | |
202 | |
203 public static NSAppleEventDescriptor listDescriptor () | |
204 { | |
205 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_listDescriptor); | |
206 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
207 } | |
208 | |
209 public static NSAppleEventDescriptor nullDescriptor () | |
210 { | |
211 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_nullDescriptor); | |
212 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
213 } | |
214 | |
215 public NSInteger numberOfItems () | |
216 { | |
217 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_numberOfItems); | |
218 } | |
219 | |
220 public NSAppleEventDescriptor paramDescriptorForKeyword (objc.id keyword) | |
221 { | |
222 objc.id result = OS.objc_msgSend(this.id, OS.sel_paramDescriptorForKeyword_1, keyword); | |
223 return result is this.id ? this : (result !is null ? new NSAppleEventDescriptor(result) : null); | |
224 } | |
225 | |
226 public static NSAppleEventDescriptor recordDescriptor () | |
227 { | |
228 objc.id result = OS.objc_msgSend(OS.class_NSAppleEventDescriptor, OS.sel_recordDescriptor); | |
229 return result !is null ? new NSAppleEventDescriptor(result) : null; | |
230 } | |
231 | |
232 public void removeDescriptorAtIndex (NSInteger index) | |
233 { | |
234 OS.objc_msgSend(this.id, OS.sel_removeDescriptorAtIndex_1, index); | |
235 } | |
236 | |
237 public void removeDescriptorWithKeyword (objc.id keyword) | |
238 { | |
239 OS.objc_msgSend(this.id, OS.sel_removeDescriptorWithKeyword_1, keyword); | |
240 } | |
241 | |
242 public void removeParamDescriptorWithKeyword (objc.id keyword) | |
243 { | |
244 OS.objc_msgSend(this.id, OS.sel_removeParamDescriptorWithKeyword_1, keyword); | |
245 } | |
246 | |
247 public short returnID () | |
248 { | |
249 return cast(short) OS.objc_msgSend(this.id, OS.sel_returnID); | |
250 } | |
251 | |
252 public void setAttributeDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) | |
253 { | |
254 OS.objc_msgSend(this.id, OS.sel_setAttributeDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); | |
255 } | |
256 | |
257 public void setDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) | |
258 { | |
259 OS.objc_msgSend(this.id, OS.sel_setDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); | |
260 } | |
261 | |
262 public void setParamDescriptor (NSAppleEventDescriptor descriptor, objc.id keyword) | |
263 { | |
264 OS.objc_msgSend(this.id, OS.sel_setParamDescriptor_1forKeyword_1, descriptor !is null ? descriptor.id : null, keyword); | |
265 } | |
266 | |
267 public NSString StringValue () | |
268 { | |
269 objc.id result = OS.objc_msgSend(this.id, OS.sel_StringValue); | |
270 return result !is null ? new NSString(result) : null; | |
271 } | |
272 | |
273 public objc.id transactionID () | |
274 { | |
275 return OS.objc_msgSend(this.id, OS.sel_transactionID); | |
276 } | |
277 | |
278 public objc.id typeCodeValue () | |
279 { | |
280 return OS.objc_msgSend(this.id, OS.sel_typeCodeValue); | |
281 } | |
282 } |