comparison dwt/internal/cocoa/NSCoder.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.NSCoder;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSData;
18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSObject;
20 import dwt.internal.cocoa.NSPoint;
21 import dwt.internal.cocoa.NSRect;
22 import dwt.internal.cocoa.NSSize;
23 import dwt.internal.cocoa.NSString;
24 import dwt.internal.cocoa.OS;
25 import objc = dwt.internal.objc.runtime;
26
27 public class NSCoder : NSObject
28 {
29 public this ()
30 {
31 super();
32 }
33
34 public this (objc.id id)
35 {
36 super(id);
37 }
38
39 public bool allowsKeyedCoding ()
40 {
41 return OS.objc_msgSend(this.id, OS.sel_allowsKeyedCoding) !is null;
42 }
43
44 public bool containsValueForKey (NSString key)
45 {
46 return OS.objc_msgSend(this.id, OS.sel_containsValueForKey_1, key !is null ? key.id : null) !is null;
47 }
48
49 public void decodeArrayOfObjCType (/*const*/char* itemType, NSUInteger count, void* array)
50 {
51 OS.objc_msgSend(this.id, OS.sel_decodeArrayOfObjCType_1count_1at_1, itemType, count, array);
52 }
53
54 public bool decodeBoolForKey (NSString key)
55 {
56 return OS.objc_msgSend(this.id, OS.sel_decodeBoolForKey_1, key !is null ? key.id : null) !is null;
57 }
58
59 public byte* decodeBytesForKey (NSString key, NSUInteger lengthp)
60 {
61 return OS.objc_msgSend(this.id, OS.sel_decodeBytesForKey_1returnedLength_1, key !is null ? key.id : null, lengthp);
62 }
63
64 public void* decodeBytesWithReturnedLength (NSUInteger lengthp)
65 {
66 return OS.objc_msgSend(this.id, OS.sel_decodeBytesWithReturnedLength_1, lengthp);
67 }
68
69 public NSData decodeDataObject ()
70 {
71 objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeDataObject);
72 return result !is null ? new NSData(result) : null;
73 }
74
75 public double decodeDoubleForKey (NSString key)
76 {
77 return OS.objc_msgSend_fpret(this.id, OS.sel_decodeDoubleForKey_1, key !is null ? key.id : null);
78 }
79
80 public float decodeFloatForKey (NSString key)
81 {
82 return cast(float) OS.objc_msgSend_fpret(this.id, OS.sel_decodeFloatForKey_1, key !is null ? key.id : null);
83 }
84
85 public int decodeInt32ForKey (NSString key)
86 {
87 return OS.objc_msgSend(this.id, OS.sel_decodeInt32ForKey_1, key !is null ? key.id : null);
88 }
89
90 public long decodeInt64ForKey (NSString key)
91 {
92 return cast(long) OS.objc_msgSend(this.id, OS.sel_decodeInt64ForKey_1, key !is null ? key.id : null);
93 }
94
95 public int decodeIntForKey (NSString key)
96 {
97 return OS.objc_msgSend(this.id, OS.sel_decodeIntForKey_1, key !is null ? key.id : null);
98 }
99
100 public int decodeIntegerForKey (NSString key)
101 {
102 return OS.objc_msgSend(this.id, OS.sel_decodeIntegerForKey_1, key !is null ? key.id : null);
103 }
104
105 public id decodeNXObject ()
106 {
107 objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeNXObject);
108 return result !is null ? new id(result) : null;
109 }
110
111 public id decodeObject ()
112 {
113 objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeObject);
114 return result !is null ? new id(result) : null;
115 }
116
117 public id decodeObjectForKey (NSString key)
118 {
119 objc.id result = OS.objc_msgSend(this.id, OS.sel_decodeObjectForKey_1, key !is null ? key.id : null);
120 return result !is null ? new id(result) : null;
121 }
122
123 public NSPoint decodePoint ()
124 {
125 NSPoint result;
126 OS.objc_msgSend_stret(result, this.id, OS.sel_decodePoint);
127 return result;
128 }
129
130 public NSPoint decodePointForKey (NSString key)
131 {
132 NSPoint result;
133 OS.objc_msgSend_stret(result, this.id, OS.sel_decodePointForKey_1, key !is null ? key.id : null);
134 return result;
135 }
136
137 public id decodePropertyList ()
138 {
139 objc.id result = OS.objc_msgSend(this.id, OS.sel_decodePropertyList);
140 return result !is null ? new id(result) : null;
141 }
142
143 public NSRect decodeRect ()
144 {
145 NSRect result;
146 OS.objc_msgSend_stret(result, this.id, OS.sel_decodeRect);
147 return result;
148 }
149
150 public NSRect decodeRectForKey (NSString key)
151 {
152 NSRect result;
153 OS.objc_msgSend_stret(result, this.id, OS.sel_decodeRectForKey_1, key !is null ? key.id : null);
154 return result;
155 }
156
157 public NSSize decodeSize ()
158 {
159 NSSize result;
160 OS.objc_msgSend_stret(result, this.id, OS.sel_decodeSize);
161 return result;
162 }
163
164 public NSSize decodeSizeForKey (NSString key)
165 {
166 NSSize result;
167 OS.objc_msgSend_stret(result, this.id, OS.sel_decodeSizeForKey_1, key !is null ? key.id : null);
168 return result;
169 }
170
171 public void decodeValueOfObjCType (/*const*/char* type, void* data)
172 {
173 OS.objc_msgSend(this.id, OS.sel_decodeValueOfObjCType_1at_1, type, data);
174 }
175
176 public void decodeValuesOfObjCTypes (/*const*/char* decodeValuesOfObjCTypes)
177 {
178 OS.objc_msgSend(this.id, OS.sel_decodeValuesOfObjCTypes_1, decodeValuesOfObjCTypes);
179 }
180
181 public void encodeArrayOfObjCType (/*const*/char* type, NSUInteger count, void* array)
182 {
183 OS.objc_msgSend(this.id, OS.sel_encodeArrayOfObjCType_1count_1at_1, type, count, array);
184 }
185
186 public void encodeBool (bool boolv, NSString key)
187 {
188 OS.objc_msgSend(this.id, OS.sel_encodeBool_1forKey_1, boolv, key !is null ? key.id : null);
189 }
190
191 public void encodeBycopyObject (id anObject)
192 {
193 OS.objc_msgSend(this.id, OS.sel_encodeBycopyObject_1, anObject !is null ? anObject.id : null);
194 }
195
196 public void encodeByrefObject (id anObject)
197 {
198 OS.objc_msgSend(this.id, OS.sel_encodeByrefObject_1, anObject !is null ? anObject.id : null);
199 }
200
201 public void encodeBytes_length_ (void* byteaddr, NSUInteger length)
202 {
203 OS.objc_msgSend(this.id, OS.sel_encodeBytes_1length_1, byteaddr.ptr, length);
204 }
205
206 public void encodeBytes_length_forKey_ (byte* bytesp, NSUInteger lenv, NSString key)
207 {
208 OS.objc_msgSend(this.id, OS.sel_encodeBytes_1length_1forKey_1, bytesp, lenv, key !is null ? key.id : null);
209 }
210
211 public void encodeConditionalObject_ (id object)
212 {
213 OS.objc_msgSend(this.id, OS.sel_encodeConditionalObject_1, object !is null ? object.id : null);
214 }
215
216 public void encodeConditionalObject_forKey_ (id objv, NSString key)
217 {
218 OS.objc_msgSend(this.id, OS.sel_encodeConditionalObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
219 }
220
221 public void encodeDataObject (NSData data)
222 {
223 OS.objc_msgSend(this.id, OS.sel_encodeDataObject_1, data !is null ? data.id : null);
224 }
225
226 public void encodeDouble (double realv, NSString key)
227 {
228 OS.objc_msgSend(this.id, OS.sel_encodeDouble_1forKey_1, realv, key !is null ? key.id : null);
229 }
230
231 public void encodeFloat (float realv, NSString key)
232 {
233 OS.objc_msgSend(this.id, OS.sel_encodeFloat_1forKey_1, realv, key !is null ? key.id : null);
234 }
235
236 public void encodeInt32 (int intv, NSString key)
237 {
238 OS.objc_msgSend(this.id, OS.sel_encodeInt32_1forKey_1, intv, key !is null ? key.id : null);
239 }
240
241 public void encodeInt64 (long intv, NSString key)
242 {
243 OS.objc_msgSend(this.id, OS.sel_encodeInt64_1forKey_1, intv, key !is null ? key.id : null);
244 }
245
246 public void encodeInt (int intv, NSString key)
247 {
248 OS.objc_msgSend(this.id, OS.sel_encodeInt_1forKey_1, intv, key !is null ? key.id : null);
249 }
250
251 public void encodeInteger (int intv, NSString key)
252 {
253 OS.objc_msgSend(this.id, OS.sel_encodeInteger_1forKey_1, intv, key !is null ? key.id : null);
254 }
255
256 public void encodeNXObject (id object)
257 {
258 OS.objc_msgSend(this.id, OS.sel_encodeNXObject_1, object !is null ? object.id : null);
259 }
260
261 public void encodeObject_ (id object)
262 {
263 OS.objc_msgSend(this.id, OS.sel_encodeObject_1, object !is null ? object.id : null);
264 }
265
266 public void encodeObject_forKey_ (id objv, NSString key)
267 {
268 OS.objc_msgSend(this.id, OS.sel_encodeObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
269 }
270
271 public void encodePoint_ (NSPoint point)
272 {
273 OS.objc_msgSend(this.id, OS.sel_encodePoint_1, point);
274 }
275
276 public void encodePoint_forKey_ (NSPoint point, NSString key)
277 {
278 OS.objc_msgSend(this.id, OS.sel_encodePoint_1forKey_1, point, key !is null ? key.id : null);
279 }
280
281 public void encodePropertyList (id aPropertyList)
282 {
283 OS.objc_msgSend(this.id, OS.sel_encodePropertyList_1, aPropertyList !is null ? aPropertyList.id : null);
284 }
285
286 public void encodeRect_ (NSRect rect)
287 {
288 OS.objc_msgSend(this.id, OS.sel_encodeRect_1, rect);
289 }
290
291 public void encodeRect_forKey_ (NSRect rect, NSString key)
292 {
293 OS.objc_msgSend(this.id, OS.sel_encodeRect_1forKey_1, rect, key !is null ? key.id : null);
294 }
295
296 public void encodeRootObject (id rootObject)
297 {
298 OS.objc_msgSend(this.id, OS.sel_encodeRootObject_1, rootObject !is null ? rootObject.id : null);
299 }
300
301 public void encodeSize_ (NSSize size)
302 {
303 OS.objc_msgSend(this.id, OS.sel_encodeSize_1, size);
304 }
305
306 public void encodeSize_forKey_ (NSSize size, NSString key)
307 {
308 OS.objc_msgSend(this.id, OS.sel_encodeSize_1forKey_1, size, key !is null ? key.id : null);
309 }
310
311 public void encodeValueOfObjCType (/*const*/char* type, void* addr)
312 {
313 OS.objc_msgSend(this.id, OS.sel_encodeValueOfObjCType_1at_1, type, addr);
314 }
315
316 public void encodeValuesOfObjCTypes (/*const*/char* encodeValuesOfObjCTypes)
317 {
318 OS.objc_msgSend(this.id, OS.sel_encodeValuesOfObjCTypes_1, encodeValuesOfObjCTypes);
319 }
320
321 public objc.id objectZone ()
322 {
323 return OS.objc_msgSend(this.id, OS.sel_objectZone);
324 }
325
326 public void setObjectZone (objc.id zone)
327 {
328 OS.objc_msgSend(this.id, OS.sel_setObjectZone_1, zone);
329 }
330
331 public uint systemVersion ()
332 {
333 return OS.objc_msgSend(this.id, OS.sel_systemVersion);
334 }
335
336 public NSInteger versionForClassName (NSString className)
337 {
338 return OS.objc_msgSend(this.id, OS.sel_versionForClassName_1, className !is null ? className.id : null);
339 }
340 }