Mercurial > projects > dstep
annotate dstep/foundation/NSKeyedArchiver.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 | 89f3c3ef1fd2 |
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.NSKeyedArchiver; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSCoder; | |
11 import dstep.foundation.NSData; | |
12 import dstep.foundation.NSGeometry; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
13 import dstep.foundation.NSObjCRuntime; |
14 | 14 import dstep.foundation.NSPropertyList; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 import dstep.foundation.NSString; |
14 | 16 import dstep.objc.bridge.Bridge; |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 import dstep.objc.objc; |
14 | 18 import bindings = dstep.foundation.NSKeyedArchiver_bindings; |
19 | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 private |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 NSString NSInvalidArchiveOperationException_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 NSString NSInvalidUnarchiveOperationException_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 NSString NSInvalidArchiveOperationException () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 if (NSInvalidArchiveOperationException_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 return NSInvalidArchiveOperationException_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 return NSInvalidArchiveOperationException_ = new NSString(bindings.NSInvalidArchiveOperationException); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
32 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
33 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
34 NSString NSInvalidUnarchiveOperationException () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
35 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
36 if (NSInvalidUnarchiveOperationException_) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
37 return NSInvalidUnarchiveOperationException_; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
38 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
39 return NSInvalidUnarchiveOperationException_ = new NSString(bindings.NSInvalidUnarchiveOperationException); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
40 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
41 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 const TNSKeyedArchiverObjectSubstitution = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
44 Class classForKeyedArchiver () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
45 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
46 return invokeObjcSelf!(Class, "classForKeyedArchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
47 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
48 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
49 Object replacementObjectForKeyedArchiver (NSKeyedArchiver archiver) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
50 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
51 return invokeObjcSelf!(Object, "replacementObjectForKeyedArchiver:", NSKeyedArchiver)(archiver); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
52 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
53 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
54 static NSArray classFallbacksForKeyedArchiver () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
55 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
56 return invokeObjcSelfClass!(NSArray, "classFallbacksForKeyedArchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
57 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
58 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
59 //mixin ObjcBindMethod!(classForKeyedArchiver, "classForKeyedArchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
60 //mixin ObjcBindMethod!(replacementObjectForKeyedArchiver, "replacementObjectForKeyedArchiver:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
61 //mixin ObjcBindClassMethod!(classFallbacksForKeyedArchiver, "classFallbacksForKeyedArchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
62 `; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
63 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
64 const TNSKeyedUnarchiverObjectSubstitution = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
65 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
66 static Class classForKeyedUnarchiver () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
67 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
68 return invokeObjcSelfClass!(Class, "classForKeyedUnarchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
69 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
70 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
71 //mixin ObjcBindClassMethod!(classForKeyedUnarchiver, "classForKeyedUnarchiver"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
72 `; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
74 const TNSKeyedUnarchiverDelegate = ` |
14 | 75 |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
76 Class unarchiver (NSKeyedUnarchiver unarchiver, NSString name, NSArray classNames) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
77 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
78 return invokeObjcSelf!(Class, "unarchiver:cannotDecodeObjectOfClassName:originalClasses:", NSKeyedUnarchiver, NSString, NSArray)(unarchiver, name, classNames); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
79 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
80 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
81 Object unarchiver (NSKeyedUnarchiver unarchiver, Object object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
82 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
83 return invokeObjcSelf!(Object, "unarchiver:didDecodeObject:", NSKeyedUnarchiver, Object)(unarchiver, object); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
84 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
85 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
86 void unarchiver (NSKeyedUnarchiver unarchiver, Object object, Object newObject) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
87 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
88 return invokeObjcSelf!(void, "unarchiver:willReplaceObject:withObject:", NSKeyedUnarchiver, Object, Object)(unarchiver, object, newObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
89 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
90 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
91 void unarchiverWillFinish (NSKeyedUnarchiver unarchiver) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
92 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
93 return invokeObjcSelf!(void, "unarchiverWillFinish:", NSKeyedUnarchiver)(unarchiver); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
94 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
95 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
96 void unarchiverDidFinish (NSKeyedUnarchiver unarchiver) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
97 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
98 return invokeObjcSelf!(void, "unarchiverDidFinish:", NSKeyedUnarchiver)(unarchiver); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
99 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
100 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
101 //mixin ObjcBindMethod!(unarchiver, "unarchiver:cannotDecodeObjectOfClassName:originalClasses:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
102 //mixin ObjcBindMethod!(unarchiver, "unarchiver:didDecodeObject:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
103 //mixin ObjcBindMethod!(unarchiver, "unarchiver:willReplaceObject:withObject:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
104 //mixin ObjcBindMethod!(unarchiverWillFinish, "unarchiverWillFinish:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
105 //mixin ObjcBindMethod!(unarchiverDidFinish, "unarchiverDidFinish:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
106 `; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
107 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
108 const TNSKeyedArchiverDelegate = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
109 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
110 Object archiver (NSKeyedArchiver archiver, Object object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
111 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
112 return invokeObjcSelf!(Object, "archiver:willEncodeObject:", NSKeyedArchiver, Object)(archiver, object); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
113 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
114 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
115 void archiver_didEncodeObject (NSKeyedArchiver archiver, Object object) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
116 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
117 return invokeObjcSelf!(void, "archiver:didEncodeObject:", NSKeyedArchiver, Object)(archiver, object); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
118 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
119 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
120 void archiver (NSKeyedArchiver archiver, Object object, Object newObject) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
121 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
122 return invokeObjcSelf!(void, "archiver:willReplaceObject:withObject:", NSKeyedArchiver, Object, Object)(archiver, object, newObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
123 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
124 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
125 void archiverWillFinish (NSKeyedArchiver archiver) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
126 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
127 return invokeObjcSelf!(void, "archiverWillFinish:", NSKeyedArchiver)(archiver); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
128 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
129 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
130 void archiverDidFinish (NSKeyedArchiver archiver) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
131 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
132 return invokeObjcSelf!(void, "archiverDidFinish:", NSKeyedArchiver)(archiver); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
133 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
134 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
135 //mixin ObjcBindMethod!(archiver, "archiver:willEncodeObject:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
136 //mixin ObjcBindMethod!(archiver_didEncodeObject, "archiver:didEncodeObject:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
137 //mixin ObjcBindMethod!(archiver, "archiver:willReplaceObject:withObject::"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
138 //mixin ObjcBindMethod!(archiverWillFinish, "archiverWillFinish:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
139 //mixin ObjcBindMethod!(archiverDidFinish, "archiverDidFinish:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
140 `; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
141 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
142 const TNSGeometryKeyedCoding = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
143 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
144 void encodePoint (NSPoint point, NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
145 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
146 return invokeObjcSelf!(void, "encodePoint:forKey:", NSPoint, NSString)(point, key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
147 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
148 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
149 void encodeSize (NSSize size, NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
150 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
151 return invokeObjcSelf!(void, "encodeSize:forKey:", NSSize, NSString)(size, key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
152 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
153 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
154 void encodeRect (NSRect rect, NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
155 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
156 return invokeObjcSelf!(void, "encodeRect:forKey:", NSRect, NSString)(rect, key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
157 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
158 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
159 NSPoint decodePointForKey (NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
160 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
161 return invokeObjcSelf!(NSPoint, "decodePointForKey:", NSString)(key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
162 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
163 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
164 NSSize decodeSizeForKey (NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
165 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
166 return invokeObjcSelf!(NSSize, "decodeSizeForKey:", NSString)(key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
167 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
168 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
169 NSRect decodeRectForKey (NSString key) |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
170 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
171 return invokeObjcSelf!(NSRect, "decodeRectForKey:", NSString)(key); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
172 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
173 `; |
14 | 174 |
175 class NSKeyedArchiver : NSCoder | |
176 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
177 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
178 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
179 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
180 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
181 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
182 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
183 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
184 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
185 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
186 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
187 } |
14 | 188 |
189 static NSData archivedDataWithRootObject (Object rootObject) | |
190 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
191 return invokeObjcSuperClass!(NSData, "archivedDataWithRootObject:", Object)(rootObject); |
14 | 192 } |
193 | |
194 static bool archiveRootObject (Object rootObject, NSString path) | |
195 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
196 return invokeObjcSuperClass!(bool, "archiveRootObject:toFile:", Object, NSString)(rootObject, path); |
14 | 197 } |
198 | |
199 Object initForWritingWithMutableData (NSMutableData data) | |
200 { | |
201 return invokeObjcSelf!(Object, "initForWritingWithMutableData:", NSMutableData)(data); | |
202 } | |
203 | |
204 this (NSMutableData data) | |
205 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
206 typeof(this).alloc.initForWritingWithMutableData(data); |
14 | 207 } |
208 | |
209 void setDelegate (Object delegate_) | |
210 { | |
211 return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); | |
212 } | |
213 | |
214 Object delegate_ () | |
215 { | |
216 return invokeObjcSelf!(Object, "delegate"); | |
217 } | |
218 | |
219 void setOutputFormat (uint format) | |
220 { | |
221 return invokeObjcSelf!(void, "setOutputFormat:", uint)(format); | |
222 } | |
223 | |
224 uint outputFormat () | |
225 { | |
226 return invokeObjcSelf!(uint, "outputFormat"); | |
227 } | |
228 | |
229 void finishEncoding () | |
230 { | |
231 return invokeObjcSelf!(void, "finishEncoding"); | |
232 } | |
233 | |
234 static void setClassName (NSString codedName, Class cls) | |
235 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
236 return invokeObjcSuperClass!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); |
14 | 237 } |
238 | |
239 void setClassName (NSString codedName, Class cls) | |
240 { | |
241 return invokeObjcSelf!(void, "setClassName:forClass:", NSString, Class)(codedName, cls); | |
242 } | |
243 | |
244 static NSString classNameForClass (Class cls) | |
245 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
246 return invokeObjcSuperClass!(NSString, "classNameForClass:", Class)(cls); |
14 | 247 } |
248 | |
249 NSString classNameForClass (Class cls) | |
250 { | |
251 return invokeObjcSelf!(NSString, "classNameForClass:", Class)(cls); | |
252 } | |
253 | |
254 void encodeObject (Object objv, NSString key) | |
255 { | |
256 return invokeObjcSelf!(void, "encodeObject:forKey:", Object, NSString)(objv, key); | |
257 } | |
258 | |
259 void encodeConditionalObject (Object objv, NSString key) | |
260 { | |
261 return invokeObjcSelf!(void, "encodeConditionalObject:forKey:", Object, NSString)(objv, key); | |
262 } | |
263 | |
264 void encodeBool (bool boolv, NSString key) | |
265 { | |
266 return invokeObjcSelf!(void, "encodeBool:forKey:", bool, NSString)(boolv, key); | |
267 } | |
268 | |
269 void encodeInt (int intv, NSString key) | |
270 { | |
271 return invokeObjcSelf!(void, "encodeInt:forKey:", int, NSString)(intv, key); | |
272 } | |
273 | |
274 void encodeInt32 (int intv, NSString key) | |
275 { | |
276 return invokeObjcSelf!(void, "encodeInt32:forKey:", int, NSString)(intv, key); | |
277 } | |
278 | |
279 void encodeInt64 (long intv, NSString key) | |
280 { | |
281 return invokeObjcSelf!(void, "encodeInt64:forKey:", long, NSString)(intv, key); | |
282 } | |
283 | |
284 void encodeFloat (float realv, NSString key) | |
285 { | |
286 return invokeObjcSelf!(void, "encodeFloat:forKey:", float, NSString)(realv, key); | |
287 } | |
288 | |
289 void encodeDouble (double realv, NSString key) | |
290 { | |
291 return invokeObjcSelf!(void, "encodeDouble:forKey:", double, NSString)(realv, key); | |
292 } | |
293 | |
294 void encodeBytes (char* bytesp, NSUInteger lenv, NSString key) | |
295 { | |
296 return invokeObjcSelf!(void, "encodeBytes:length:forKey:", char*, NSUInteger, NSString)(bytesp, lenv, key); | |
297 } | |
298 } | |
299 | |
300 class NSKeyedUnarchiver : NSCoder | |
301 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
302 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
303 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
304 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
305 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
306 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
307 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
308 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
309 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
310 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
311 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
312 } |
14 | 313 |
314 static Object unarchiveObjectWithData (NSData data) | |
315 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
316 return invokeObjcSuperClass!(Object, "unarchiveObjectWithData:", NSData)(data); |
14 | 317 } |
318 | |
319 static Object unarchiveObjectWithFile (NSString path) | |
320 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
321 return invokeObjcSuperClass!(Object, "unarchiveObjectWithFile:", NSString)(path); |
14 | 322 } |
323 | |
324 Object initForReadingWithData (NSData data) | |
325 { | |
326 return invokeObjcSelf!(Object, "initForReadingWithData:", NSData)(data); | |
327 } | |
328 | |
329 this (NSData data) | |
330 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
331 typeof(this).alloc.initForReadingWithData(data); |
14 | 332 } |
333 | |
334 void setDelegate (Object delegate_) | |
335 { | |
336 return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_); | |
337 } | |
338 | |
339 Object delegate_ () | |
340 { | |
341 return invokeObjcSelf!(Object, "delegate"); | |
342 } | |
343 | |
344 void finishDecoding () | |
345 { | |
346 return invokeObjcSelf!(void, "finishDecoding"); | |
347 } | |
348 | |
349 static void setClass (Class cls, NSString codedName) | |
350 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
351 return invokeObjcSuperClass!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); |
14 | 352 } |
353 | |
354 void setClass (Class cls, NSString codedName) | |
355 { | |
356 return invokeObjcSelf!(void, "setClass:forClassName:", Class, NSString)(cls, codedName); | |
357 } | |
358 | |
359 static Class classForClassName (NSString codedName) | |
360 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
361 return invokeObjcSuperClass!(Class, "classForClassName:", NSString)(codedName); |
14 | 362 } |
363 | |
364 Class classForClassName (NSString codedName) | |
365 { | |
366 return invokeObjcSelf!(Class, "classForClassName:", NSString)(codedName); | |
367 } | |
368 | |
369 bool containsValueForKey (NSString key) | |
370 { | |
371 return invokeObjcSelf!(bool, "containsValueForKey:", NSString)(key); | |
372 } | |
373 | |
374 Object decodeObjectForKey (NSString key) | |
375 { | |
376 return invokeObjcSelf!(Object, "decodeObjectForKey:", NSString)(key); | |
377 } | |
378 | |
379 bool decodeBoolForKey (NSString key) | |
380 { | |
381 return invokeObjcSelf!(bool, "decodeBoolForKey:", NSString)(key); | |
382 } | |
383 | |
384 int decodeIntForKey (NSString key) | |
385 { | |
386 return invokeObjcSelf!(int, "decodeIntForKey:", NSString)(key); | |
387 } | |
388 | |
389 int decodeInt32ForKey (NSString key) | |
390 { | |
391 return invokeObjcSelf!(int, "decodeInt32ForKey:", NSString)(key); | |
392 } | |
393 | |
394 long decodeInt64ForKey (NSString key) | |
395 { | |
396 return invokeObjcSelf!(long, "decodeInt64ForKey:", NSString)(key); | |
397 } | |
398 | |
399 float decodeFloatForKey (NSString key) | |
400 { | |
401 return invokeObjcSelf!(float, "decodeFloatForKey:", NSString)(key); | |
402 } | |
403 | |
404 double decodeDoubleForKey (NSString key) | |
405 { | |
406 return invokeObjcSelf!(double, "decodeDoubleForKey:", NSString)(key); | |
407 } | |
408 | |
409 char* decodeBytesForKey (NSString key, NSUInteger* lengthp) | |
410 { | |
411 return invokeObjcSelf!(char*, "decodeBytesForKey:returnedLength:", NSString, NSUInteger*)(key, lengthp); | |
412 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
413 } |