Mercurial > projects > dstep
annotate dstep/foundation/NSPortCoder.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.NSPortCoder; | |
8 | |
9 import dstep.foundation.NSArray; | |
10 import dstep.foundation.NSCoder; | |
11 import dstep.foundation.NSConnection; | |
12 import dstep.foundation.NSPort; | |
13 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
14 import dstep.objc.objc; |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
15 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
16 const TNSDistributedObjects = ` |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
17 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
18 Class classForPortCoder () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
19 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 return invokeObjcSelf!(Class, "classForPortCoder"); |
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 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 Object replacementObjectForPortCoder (NSPortCoder coder) |
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 return invokeObjcSelf!(Object, "replacementObjectForPortCoder:", NSPortCoder)(coder); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 } |
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 //mixin ObjcBindMethod!(classForPortCoder, "classForPortCoder"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 //mixin ObjcBindMethod!(replacementObjectForPortCoder, "replacementObjectForPortCoder:"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 `; |
14 | 31 |
32 class NSPortCoder : NSCoder | |
33 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
34 mixin (ObjcWrap); |
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 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
37 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
38 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
39 } |
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 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
42 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
44 } |
14 | 45 |
46 bool isBycopy () | |
47 { | |
48 return invokeObjcSelf!(bool, "isBycopy"); | |
49 } | |
50 | |
51 bool isByref () | |
52 { | |
53 return invokeObjcSelf!(bool, "isByref"); | |
54 } | |
55 | |
56 NSConnection connection () | |
57 { | |
58 return invokeObjcSelf!(NSConnection, "connection"); | |
59 } | |
60 | |
61 void encodePortObject (NSPort aport) | |
62 { | |
63 return invokeObjcSelf!(void, "encodePortObject:", NSPort)(aport); | |
64 } | |
65 | |
66 NSPort decodePortObject () | |
67 { | |
68 return invokeObjcSelf!(NSPort, "decodePortObject"); | |
69 } | |
70 | |
71 static Object portCoderWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) | |
72 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
73 return invokeObjcSuperClass!(Object, "portCoderWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); |
14 | 74 } |
75 | |
76 Object initWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps) | |
77 { | |
78 return invokeObjcSelf!(Object, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps); | |
79 } | |
80 | |
81 this (NSPort rcvPort, NSPort sndPort, NSArray comps) | |
82 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
83 typeof(this).alloc.initWithReceivePort(rcvPort, sndPort, comps); |
14 | 84 } |
85 | |
86 void dispatch () | |
87 { | |
88 return invokeObjcSelf!(void, "dispatch"); | |
89 } | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
90 } |