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;
|
|
14 import dstep.objc.objc : id;
|
|
15
|
|
16 class NSPortCoder : NSCoder
|
|
17 {
|
|
18 mixin ObjcWrap;
|
|
19
|
|
20 bool isBycopy ()
|
|
21 {
|
|
22 return invokeObjcSelf!(bool, "isBycopy");
|
|
23 }
|
|
24
|
|
25 bool isByref ()
|
|
26 {
|
|
27 return invokeObjcSelf!(bool, "isByref");
|
|
28 }
|
|
29
|
|
30 NSConnection connection ()
|
|
31 {
|
|
32 return invokeObjcSelf!(NSConnection, "connection");
|
|
33 }
|
|
34
|
|
35 void encodePortObject (NSPort aport)
|
|
36 {
|
|
37 return invokeObjcSelf!(void, "encodePortObject:", NSPort)(aport);
|
|
38 }
|
|
39
|
|
40 NSPort decodePortObject ()
|
|
41 {
|
|
42 return invokeObjcSelf!(NSPort, "decodePortObject");
|
|
43 }
|
|
44
|
|
45 static Object portCoderWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps)
|
|
46 {
|
|
47 return invokeObjcSelfClass!(Object, "portCoderWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps);
|
|
48 }
|
|
49
|
|
50 Object initWithReceivePort (NSPort rcvPort, NSPort sndPort, NSArray comps)
|
|
51 {
|
|
52 return invokeObjcSelf!(Object, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(rcvPort, sndPort, comps);
|
|
53 }
|
|
54
|
|
55 this (NSPort rcvPort, NSPort sndPort, NSArray comps)
|
|
56 {
|
|
57 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass);
|
|
58 id result = Bridge.invokeObjcMethod!(id, "initWithReceivePort:sendPort:components:", NSPort, NSPort, NSArray)(objcObject, rcvPort, sndPort, comps);
|
|
59
|
|
60 if (result)
|
|
61 objcObject = ret;
|
|
62
|
|
63 dObject = this;
|
|
64 }
|
|
65
|
|
66 void dispatch ()
|
|
67 {
|
|
68 return invokeObjcSelf!(void, "dispatch");
|
|
69 }
|
|
70 }
|
|
71
|
|
72 template TNSDistributedObjects ()
|
|
73 {
|
|
74 Class classForPortCoder ();
|
|
75 Object replacementObjectForPortCoder (NSPortCoder coder);
|
|
76 }
|
|
77
|