comparison dwt/internal/cocoa/NSSocketPort.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
comparison
equal deleted inserted replaced
0:380af2bdd8e5 1:8b48be5454ce
11 * Port to the D Programming language: 11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSSocketPort; 14 module dwt.internal.cocoa.NSSocketPort;
15 15
16 import dwt.internal.cocoa.id;
16 import dwt.internal.cocoa.NSData; 17 import dwt.internal.cocoa.NSData;
17 import dwt.internal.cocoa.NSPort; 18 import dwt.internal.cocoa.NSPort;
18 import dwt.internal.cocoa.NSString; 19 import dwt.internal.cocoa.NSString;
19 import dwt.internal.cocoa.OS; 20 import dwt.internal.cocoa.OS;
20 import objc = dwt.internal.objc.runtime; 21 import objc = dwt.internal.objc.runtime;
32 super(id); 33 super(id);
33 } 34 }
34 35
35 public NSData address () 36 public NSData address ()
36 { 37 {
37 objc.id result = OS.objc_msgSend(this.id, OS.sel_address); 38 objc.id result = OS.objc_msgSend(this.id_, OS.sel_address);
38 return result !is null ? new NSData(result) : null; 39 return result !is null ? new NSData(result) : null;
39 } 40 }
40 41
41 public id initRemoteWithProtocolFamily (int family, int type, int protocol, NSData address) 42 public id initRemoteWithProtocolFamily (int family, int type, int protocol, NSData address)
42 { 43 {
43 objc.id result = OS.objc_msgSend(this.id, OS.sel_initRemoteWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol, 44 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initRemoteWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol,
44 address !is null ? address.id : null); 45 address !is null ? address.id_ : null);
45 return result !is null ? new id(result) : null; 46 return result !is null ? new id(result) : null;
46 } 47 }
47 48
48 public id initRemoteWithTCPPort (ushort port, NSString hostName) 49 public id initRemoteWithTCPPort (ushort port, NSString hostName)
49 { 50 {
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_initRemoteWithTCPPort_1host_1, port, hostName !is null ? hostName.id : null); 51 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initRemoteWithTCPPort_1host_1, port, hostName !is null ? hostName.id_ : null);
51 return result !is null ? new id(result) : null; 52 return result !is null ? new id(result) : null;
52 } 53 }
53 54
54 public id initWithProtocolFamily_socketType_protocol_address_ (int family, int type, int protocol, NSData address) 55 public id initWithProtocolFamily_socketType_protocol_address_ (int family, int type, int protocol, NSData address)
55 { 56 {
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol, 57 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol,
57 address !is null ? address.id : null); 58 address !is null ? address.id_ : null);
58 return result !is null ? new id(result) : null; 59 return result !is null ? new id(result) : null;
59 } 60 }
60 61
61 public id initWithProtocolFamily_socketType_protocol_socket_ (int family, int type, int protocol, NSSocketNativeHandle sock) 62 public id initWithProtocolFamily_socketType_protocol_socket_ (int family, int type, int protocol, NSSocketNativeHandle sock)
62 { 63 {
63 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithProtocolFamily_1socketType_1protocol_1socket_1, family, type, protocol, sock); 64 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithProtocolFamily_1socketType_1protocol_1socket_1, family, type, protocol, sock);
64 return result !is null ? new id(result) : null; 65 return result !is null ? new id(result) : null;
65 } 66 }
66 67
67 public id initWithTCPPort (short port) 68 public id initWithTCPPort (short port)
68 { 69 {
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTCPPort_1, port); 70 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithTCPPort_1, port);
70 return result !is null ? new id(result) : null; 71 return result !is null ? new id(result) : null;
71 } 72 }
72 73
73 public int protocol () 74 public int protocol ()
74 { 75 {
75 return OS.objc_msgSend(this.id, OS.sel_protocol); 76 return cast(int) OS.objc_msgSend(this.id_, OS.sel_protocol);
76 } 77 }
77 78
78 public int protocolFamily () 79 public int protocolFamily ()
79 { 80 {
80 return OS.objc_msgSend(this.id, OS.sel_protocolFamily); 81 return cast(int) OS.objc_msgSend(this.id_, OS.sel_protocolFamily);
81 } 82 }
82 83
83 public NSSocketNativeHandle socket () 84 public NSSocketNativeHandle socket ()
84 { 85 {
85 return OS.objc_msgSend(this.id, OS.sel_socket); 86 return cast(NSSocketNativeHandle) OS.objc_msgSend(this.id_, OS.sel_socket);
86 } 87 }
87 88
88 public int socketType () 89 public int socketType ()
89 { 90 {
90 return OS.objc_msgSend(this.id, OS.sel_socketType); 91 return cast(int) OS.objc_msgSend(this.id_, OS.sel_socketType);
91 } 92 }
92 93
93 } 94 }