comparison dwt/internal/cocoa/NSKeyedArchiver.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.NSKeyedArchiver;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSCoder;
18 import dwt.internal.cocoa.NSData;
19 import dwt.internal.cocoa.NSInteger;
20 import dwt.internal.cocoa.NSMutableData;
21 import dwt.internal.cocoa.NSPropertyListFormat;
22 import dwt.internal.cocoa.NSString;
23 import dwt.internal.cocoa.OS;
24 import objc = dwt.internal.objc.runtime;
25
26 public class NSKeyedArchiver : NSCoder
27 {
28
29 public this ()
30 {
31 super();
32 }
33
34 public this (objc.id id)
35 {
36 super(id);
37 }
38
39 public static bool archiveRootObject (id rootObject, NSString path)
40 {
41 return OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_archiveRootObject_1toFile_1, rootObject !is null ? rootObject.id : null,
42 path !is null ? path.id : null) !is null;
43 }
44
45 public static NSData archivedDataWithRootObject (id rootObject)
46 {
47 objc.id result = OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_archivedDataWithRootObject_1, rootObject !is null ? rootObject.id : null);
48 return result !is null ? new NSData(result) : null;
49 }
50
51 public NSString classNameForClass_ (objc.Class cls)
52 {
53 objc.id result = OS.objc_msgSend(this.id, OS.sel_classNameForClass_1, cls);
54 return result !is null ? new NSString(result) : null;
55 }
56
57 public static NSString static_classNameForClass_ (objc.Class cls)
58 {
59 objc.id result = OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_classNameForClass_1, cls);
60 return result !is null ? new NSString(result) : null;
61 }
62
63 public id delegatee ()
64 {
65 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
66 return result !is null ? new id(result) : null;
67 }
68
69 public void encodeBool (bool boolv, NSString key)
70 {
71 OS.objc_msgSend(this.id, OS.sel_encodeBool_1forKey_1, boolv, key !is null ? key.id : null);
72 }
73
74 public void encodeBytes (/*const*/ubyte* bytesp, NSUInteger lenv, NSString key)
75 {
76 OS.objc_msgSend(this.id, OS.sel_encodeBytes_1length_1forKey_1, bytesp, lenv, key !is null ? key.id : null);
77 }
78
79 public void encodeConditionalObject (id objv, NSString key)
80 {
81 OS.objc_msgSend(this.id, OS.sel_encodeConditionalObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
82 }
83
84 public void encodeDouble (double realv, NSString key)
85 {
86 OS.objc_msgSend(this.id, OS.sel_encodeDouble_1forKey_1, realv, key !is null ? key.id : null);
87 }
88
89 public void encodeFloat (float realv, NSString key)
90 {
91 OS.objc_msgSend(this.id, OS.sel_encodeFloat_1forKey_1, realv, key !is null ? key.id : null);
92 }
93
94 public void encodeInt32 (int intv, NSString key)
95 {
96 OS.objc_msgSend(this.id, OS.sel_encodeInt32_1forKey_1, intv, key !is null ? key.id : null);
97 }
98
99 public void encodeInt64 (long intv, NSString key)
100 {
101 OS.objc_msgSend(this.id, OS.sel_encodeInt64_1forKey_1, intv, key !is null ? key.id : null);
102 }
103
104 public void encodeInt (int intv, NSString key)
105 {
106 OS.objc_msgSend(this.id, OS.sel_encodeInt_1forKey_1, intv, key !is null ? key.id : null);
107 }
108
109 public void encodeObject (id objv, NSString key)
110 {
111 OS.objc_msgSend(this.id, OS.sel_encodeObject_1forKey_1, objv !is null ? objv.id : null, key !is null ? key.id : null);
112 }
113
114 public void finishEncoding ()
115 {
116 OS.objc_msgSend(this.id, OS.sel_finishEncoding);
117 }
118
119 public id initForWritingWithMutableData (NSMutableData data)
120 {
121 objc.id result = OS.objc_msgSend(this.id, OS.sel_initForWritingWithMutableData_1, data !is null ? data.id : null);
122 return result !is null ? new id(result) : null;
123 }
124
125 public NSPropertyListFormat outputFormat ()
126 {
127 return OS.objc_msgSend(this.id, OS.sel_outputFormat);
128 }
129
130 public static void static_setClassName_forClass_ (NSString codedName, objc.Class cls)
131 {
132 OS.objc_msgSend(OS.class_NSKeyedArchiver, OS.sel_setClassName_1forClass_1, codedName !is null ? codedName.id : null, cls);
133 }
134
135 public void setClassName_forClass_ (NSString codedName, objc.Class cls)
136 {
137 OS.objc_msgSend(this.id, OS.sel_setClassName_1forClass_1, codedName !is null ? codedName.id : null, cls);
138 }
139
140 public void setDelegate (id delegatee)
141 {
142 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
143 }
144
145 public void setOutputFormat (NSPropertyListFormat format)
146 {
147 OS.objc_msgSend(this.id, OS.sel_setOutputFormat_1, format);
148 }
149
150 }