Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSConnection.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.NSConnection; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSConnection; | |
19 import dwt.internal.cocoa.NSDictionary; | |
20 import dwt.internal.cocoa.NSDistantObject; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSPort; | |
23 import dwt.internal.cocoa.NSPortNameServer; | |
24 import dwt.internal.cocoa.NSRunLoop; | |
25 import dwt.internal.cocoa.NSString; | |
26 import dwt.internal.cocoa.OS; | |
27 import objc = dwt.internal.objc.runtime; | |
28 | |
29 public class NSConnection : NSObject | |
30 { | |
31 | |
32 public this () | |
33 { | |
34 super(); | |
35 } | |
36 | |
37 public this (objc.id id) | |
38 { | |
39 super(id); | |
40 } | |
41 | |
42 public void addRequestMode (NSString rmode) | |
43 { | |
44 OS.objc_msgSend(this.id, OS.sel_addRequestMode_1, rmode !is null ? rmode.id : null); | |
45 } | |
46 | |
47 public void addRunLoop (NSRunLoop runloop) | |
48 { | |
49 OS.objc_msgSend(this.id, OS.sel_addRunLoop_1, runloop !is null ? runloop.id : null); | |
50 } | |
51 | |
52 public static NSArray allConnections () | |
53 { | |
54 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_allConnections); | |
55 return result !is null ? new NSArray(result) : null; | |
56 } | |
57 | |
58 public static id connectionWithReceivePort (NSPort receivePort, NSPort sendPort) | |
59 { | |
60 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithReceivePort_1sendPort_1, | |
61 receivePort !is null ? receivePort.id : null, sendPort !is null ? sendPort.id : null); | |
62 return result !is null ? new id(result) : null; | |
63 } | |
64 | |
65 public static id static_connectionWithRegisteredName_host_ (NSString name, NSString hostName) | |
66 { | |
67 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithRegisteredName_1host_1, name !is null ? name.id : null, | |
68 hostName !is null ? hostName.id : null); | |
69 return result !is null ? new id(result) : null; | |
70 } | |
71 | |
72 public static id static_connectionWithRegisteredName_host_usingNameServer_ (NSString name, NSString hostName, NSPortNameServer server) | |
73 { | |
74 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithRegisteredName_1host_1usingNameServer_1, | |
75 name !is null ? name.id : null, hostName !is null ? hostName.id : null, server !is null ? server.id : null); | |
76 return result !is null ? new id(result) : null; | |
77 } | |
78 | |
79 public static id currentConversation () | |
80 { | |
81 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_currentConversation); | |
82 return result !is null ? new id(result) : null; | |
83 } | |
84 | |
85 public static NSConnection defaultConnection () | |
86 { | |
87 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_defaultConnection); | |
88 return result !is null ? new NSConnection(result) : null; | |
89 } | |
90 | |
91 public id delegatee () | |
92 { | |
93 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); | |
94 return result !is null ? new id(result) : null; | |
95 } | |
96 | |
97 public void enableMultipleThreads () | |
98 { | |
99 OS.objc_msgSend(this.id, OS.sel_enableMultipleThreads); | |
100 } | |
101 | |
102 public bool independentConversationQueueing () | |
103 { | |
104 return OS.objc_msgSend(this.id, OS.sel_independentConversationQueueing) !is null; | |
105 } | |
106 | |
107 public id initWithReceivePort (NSPort receivePort, NSPort sendPort) | |
108 { | |
109 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithReceivePort_1sendPort_1, receivePort !is null ? receivePort.id : null, | |
110 sendPort !is null ? sendPort.id : null); | |
111 return result !is null ? new id(result) : null; | |
112 } | |
113 | |
114 public void invalidate () | |
115 { | |
116 OS.objc_msgSend(this.id, OS.sel_invalidate); | |
117 } | |
118 | |
119 public bool isValid () | |
120 { | |
121 return OS.objc_msgSend(this.id, OS.sel_isValid) !is null; | |
122 } | |
123 | |
124 public NSArray localObjects () | |
125 { | |
126 objc.id result = OS.objc_msgSend(this.id, OS.sel_localObjects); | |
127 return result !is null ? new NSArray(result) : null; | |
128 } | |
129 | |
130 public bool multipleThreadsEnabled () | |
131 { | |
132 return OS.objc_msgSend(this.id, OS.sel_multipleThreadsEnabled) !is null; | |
133 } | |
134 | |
135 public NSPort receivePort () | |
136 { | |
137 objc.id result = OS.objc_msgSend(this.id, OS.sel_receivePort); | |
138 return result !is null ? new NSPort(result) : null; | |
139 } | |
140 | |
141 public bool registerName_ (NSString name) | |
142 { | |
143 return OS.objc_msgSend(this.id, OS.sel_registerName_1, name !is null ? name.id : null) !is null; | |
144 } | |
145 | |
146 public bool registerName_withNameServer_ (NSString name, NSPortNameServer server) | |
147 { | |
148 return OS.objc_msgSend(this.id, OS.sel_registerName_1withNameServer_1, name !is null ? name.id : null, server !is null ? server.id : null) !is null; | |
149 } | |
150 | |
151 public NSArray remoteObjects () | |
152 { | |
153 objc.id result = OS.objc_msgSend(this.id, OS.sel_remoteObjects); | |
154 return result !is null ? new NSArray(result) : null; | |
155 } | |
156 | |
157 public void removeRequestMode (NSString rmode) | |
158 { | |
159 OS.objc_msgSend(this.id, OS.sel_removeRequestMode_1, rmode !is null ? rmode.id : null); | |
160 } | |
161 | |
162 public void removeRunLoop (NSRunLoop runloop) | |
163 { | |
164 OS.objc_msgSend(this.id, OS.sel_removeRunLoop_1, runloop !is null ? runloop.id : null); | |
165 } | |
166 | |
167 public double replyTimeout () | |
168 { | |
169 return OS.objc_msgSend_fpret(this.id, OS.sel_replyTimeout); | |
170 } | |
171 | |
172 public NSArray requestModes () | |
173 { | |
174 objc.id result = OS.objc_msgSend(this.id, OS.sel_requestModes); | |
175 return result !is null ? new NSArray(result) : null; | |
176 } | |
177 | |
178 public double requestTimeout () | |
179 { | |
180 return OS.objc_msgSend_fpret(this.id, OS.sel_requestTimeout); | |
181 } | |
182 | |
183 public id rootObject () | |
184 { | |
185 objc.id result = OS.objc_msgSend(this.id, OS.sel_rootObject); | |
186 return result !is null ? new id(result) : null; | |
187 } | |
188 | |
189 public NSDistantObject rootProxy () | |
190 { | |
191 objc.id result = OS.objc_msgSend(this.id, OS.sel_rootProxy); | |
192 return result !is null ? new NSDistantObject(result) : null; | |
193 } | |
194 | |
195 public static NSDistantObject static_rootProxyForConnectionWithRegisteredName_host_ (NSString name, NSString hostName) | |
196 { | |
197 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_rootProxyForConnectionWithRegisteredName_1host_1, | |
198 name !is null ? name.id : null, hostName !is null ? hostName.id : null); | |
199 return result !is null ? new NSDistantObject(result) : null; | |
200 } | |
201 | |
202 public static NSDistantObject static_rootProxyForConnectionWithRegisteredName_host_usingNameServer_ (NSString name, NSString hostName, | |
203 NSPortNameServer server) | |
204 { | |
205 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_rootProxyForConnectionWithRegisteredName_1host_1usingNameServer_1, | |
206 name !is null ? name.id : null, hostName !is null ? hostName.id : null, server !is null ? server.id : null); | |
207 return result !is null ? new NSDistantObject(result) : null; | |
208 } | |
209 | |
210 public void runInNewThread () | |
211 { | |
212 OS.objc_msgSend(this.id, OS.sel_runInNewThread); | |
213 } | |
214 | |
215 public NSPort sendPort () | |
216 { | |
217 objc.id result = OS.objc_msgSend(this.id, OS.sel_sendPort); | |
218 return result !is null ? new NSPort(result) : null; | |
219 } | |
220 | |
221 public static id static_serviceConnectionWithName_rootObject_ (NSString name, id root) | |
222 { | |
223 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_serviceConnectionWithName_1rootObject_1, name !is null ? name.id : null, | |
224 root !is null ? root.id : null); | |
225 return result !is null ? new id(result) : null; | |
226 } | |
227 | |
228 public static id static_serviceConnectionWithName_rootObject_usingNameServer_ (NSString name, id root, NSPortNameServer server) | |
229 { | |
230 objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_serviceConnectionWithName_1rootObject_1usingNameServer_1, | |
231 name !is null ? name.id : null, root !is null ? root.id : null, server !is null ? server.id : null); | |
232 return result !is null ? new id(result) : null; | |
233 } | |
234 | |
235 public void setDelegate (id anObject) | |
236 { | |
237 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); | |
238 } | |
239 | |
240 public void setIndependentConversationQueueing (bool yorn) | |
241 { | |
242 OS.objc_msgSend(this.id, OS.sel_setIndependentConversationQueueing_1, yorn); | |
243 } | |
244 | |
245 public void setReplyTimeout (double ti) | |
246 { | |
247 OS.objc_msgSend(this.id, OS.sel_setReplyTimeout_1, ti); | |
248 } | |
249 | |
250 public void setRequestTimeout (double ti) | |
251 { | |
252 OS.objc_msgSend(this.id, OS.sel_setRequestTimeout_1, ti); | |
253 } | |
254 | |
255 public void setRootObject (id anObject) | |
256 { | |
257 OS.objc_msgSend(this.id, OS.sel_setRootObject_1, anObject !is null ? anObject.id : null); | |
258 } | |
259 | |
260 public NSDictionary statistics () | |
261 { | |
262 objc.id result = OS.objc_msgSend(this.id, OS.sel_statistics); | |
263 return result !is null ? new NSDictionary(result) : null; | |
264 } | |
265 | |
266 } |