Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSUnarchiver.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.NSUnarchiver; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSCoder; | |
18 import dwt.internal.cocoa.NSData; | |
19 import dwt.internal.cocoa.NSString; | |
20 import dwt.internal.cocoa.NSZone; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSUnarchiver : NSCoder | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public static NSString static_classNameDecodedForArchiveClassName_ (NSString inArchiveName) | |
38 { | |
39 objc.id result = OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_classNameDecodedForArchiveClassName_1, | |
40 inArchiveName !is null ? inArchiveName.id : null); | |
41 return result !is null ? new NSString(result) : null; | |
42 } | |
43 | |
44 public NSString classNameDecodedForArchiveClassName_ (NSString inArchiveName) | |
45 { | |
46 objc.id result = OS.objc_msgSend(this.id, OS.sel_classNameDecodedForArchiveClassName_1, inArchiveName !is null ? inArchiveName.id : null); | |
47 return result !is null ? new NSString(result) : null; | |
48 } | |
49 | |
50 public void decodeClassName_asClassName_ (NSString inArchiveName, NSString trueName) | |
51 { | |
52 OS.objc_msgSend(this.id, OS.sel_decodeClassName_1asClassName_1, inArchiveName !is null ? inArchiveName.id : null, | |
53 trueName !is null ? trueName.id : null); | |
54 } | |
55 | |
56 public static void static_decodeClassName_asClassName_ (NSString inArchiveName, NSString trueName) | |
57 { | |
58 OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_decodeClassName_1asClassName_1, inArchiveName !is null ? inArchiveName.id : null, | |
59 trueName !is null ? trueName.id : null); | |
60 } | |
61 | |
62 public id initForReadingWithData (NSData data) | |
63 { | |
64 objc.id result = OS.objc_msgSend(this.id, OS.sel_initForReadingWithData_1, data !is null ? data.id : null); | |
65 return result !is null ? new id(result) : null; | |
66 } | |
67 | |
68 public bool isAtEnd () | |
69 { | |
70 return OS.objc_msgSend(this.id, OS.sel_isAtEnd) !is null; | |
71 } | |
72 | |
73 public NSZone* objectZone () | |
74 { | |
75 return OS.objc_msgSend(this.id, OS.sel_objectZone); | |
76 } | |
77 | |
78 public void replaceObject (id object, id newObject) | |
79 { | |
80 OS.objc_msgSend(this.id, OS.sel_replaceObject_1withObject_1, object !is null ? object.id : null, newObject !is null ? newObject.id : null); | |
81 } | |
82 | |
83 public void setObjectZone (NSZone* zone) | |
84 { | |
85 OS.objc_msgSend(this.id, OS.sel_setObjectZone_1, zone); | |
86 } | |
87 | |
88 public uint systemVersion () | |
89 { | |
90 return cast(uint) OS.objc_msgSend(this.id, OS.sel_systemVersion); | |
91 } | |
92 | |
93 public static id unarchiveObjectWithData (NSData data) | |
94 { | |
95 objc.id result = OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_unarchiveObjectWithData_1, data !is null ? data.id : null); | |
96 return result !is null ? new id(result) : null; | |
97 } | |
98 | |
99 public static id unarchiveObjectWithFile (NSString path) | |
100 { | |
101 objc.id result = OS.objc_msgSend(OS.class_NSUnarchiver, OS.sel_unarchiveObjectWithFile_1, path !is null ? path.id : null); | |
102 return result !is null ? new id(result) : null; | |
103 } | |
104 | |
105 } |