Mercurial > projects > dwt-mac
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSConnection.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,266 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSConnection; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSConnection; +import dwt.internal.cocoa.NSDictionary; +import dwt.internal.cocoa.NSDistantObject; +import dwt.internal.cocoa.NSObject; +import dwt.internal.cocoa.NSPort; +import dwt.internal.cocoa.NSPortNameServer; +import dwt.internal.cocoa.NSRunLoop; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSConnection : NSObject +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void addRequestMode (NSString rmode) + { + OS.objc_msgSend(this.id, OS.sel_addRequestMode_1, rmode !is null ? rmode.id : null); + } + + public void addRunLoop (NSRunLoop runloop) + { + OS.objc_msgSend(this.id, OS.sel_addRunLoop_1, runloop !is null ? runloop.id : null); + } + + public static NSArray allConnections () + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_allConnections); + return result !is null ? new NSArray(result) : null; + } + + public static id connectionWithReceivePort (NSPort receivePort, NSPort sendPort) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithReceivePort_1sendPort_1, + receivePort !is null ? receivePort.id : null, sendPort !is null ? sendPort.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_connectionWithRegisteredName_host_ (NSString name, NSString hostName) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithRegisteredName_1host_1, name !is null ? name.id : null, + hostName !is null ? hostName.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_connectionWithRegisteredName_host_usingNameServer_ (NSString name, NSString hostName, NSPortNameServer server) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_connectionWithRegisteredName_1host_1usingNameServer_1, + name !is null ? name.id : null, hostName !is null ? hostName.id : null, server !is null ? server.id : null); + return result !is null ? new id(result) : null; + } + + public static id currentConversation () + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_currentConversation); + return result !is null ? new id(result) : null; + } + + public static NSConnection defaultConnection () + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_defaultConnection); + return result !is null ? new NSConnection(result) : null; + } + + public id delegatee () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + return result !is null ? new id(result) : null; + } + + public void enableMultipleThreads () + { + OS.objc_msgSend(this.id, OS.sel_enableMultipleThreads); + } + + public bool independentConversationQueueing () + { + return OS.objc_msgSend(this.id, OS.sel_independentConversationQueueing) !is null; + } + + public id initWithReceivePort (NSPort receivePort, NSPort sendPort) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithReceivePort_1sendPort_1, receivePort !is null ? receivePort.id : null, + sendPort !is null ? sendPort.id : null); + return result !is null ? new id(result) : null; + } + + public void invalidate () + { + OS.objc_msgSend(this.id, OS.sel_invalidate); + } + + public bool isValid () + { + return OS.objc_msgSend(this.id, OS.sel_isValid) !is null; + } + + public NSArray localObjects () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_localObjects); + return result !is null ? new NSArray(result) : null; + } + + public bool multipleThreadsEnabled () + { + return OS.objc_msgSend(this.id, OS.sel_multipleThreadsEnabled) !is null; + } + + public NSPort receivePort () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_receivePort); + return result !is null ? new NSPort(result) : null; + } + + public bool registerName_ (NSString name) + { + return OS.objc_msgSend(this.id, OS.sel_registerName_1, name !is null ? name.id : null) !is null; + } + + public bool registerName_withNameServer_ (NSString name, NSPortNameServer server) + { + 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; + } + + public NSArray remoteObjects () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_remoteObjects); + return result !is null ? new NSArray(result) : null; + } + + public void removeRequestMode (NSString rmode) + { + OS.objc_msgSend(this.id, OS.sel_removeRequestMode_1, rmode !is null ? rmode.id : null); + } + + public void removeRunLoop (NSRunLoop runloop) + { + OS.objc_msgSend(this.id, OS.sel_removeRunLoop_1, runloop !is null ? runloop.id : null); + } + + public double replyTimeout () + { + return OS.objc_msgSend_fpret(this.id, OS.sel_replyTimeout); + } + + public NSArray requestModes () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_requestModes); + return result !is null ? new NSArray(result) : null; + } + + public double requestTimeout () + { + return OS.objc_msgSend_fpret(this.id, OS.sel_requestTimeout); + } + + public id rootObject () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_rootObject); + return result !is null ? new id(result) : null; + } + + public NSDistantObject rootProxy () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_rootProxy); + return result !is null ? new NSDistantObject(result) : null; + } + + public static NSDistantObject static_rootProxyForConnectionWithRegisteredName_host_ (NSString name, NSString hostName) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_rootProxyForConnectionWithRegisteredName_1host_1, + name !is null ? name.id : null, hostName !is null ? hostName.id : null); + return result !is null ? new NSDistantObject(result) : null; + } + + public static NSDistantObject static_rootProxyForConnectionWithRegisteredName_host_usingNameServer_ (NSString name, NSString hostName, + NSPortNameServer server) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_rootProxyForConnectionWithRegisteredName_1host_1usingNameServer_1, + name !is null ? name.id : null, hostName !is null ? hostName.id : null, server !is null ? server.id : null); + return result !is null ? new NSDistantObject(result) : null; + } + + public void runInNewThread () + { + OS.objc_msgSend(this.id, OS.sel_runInNewThread); + } + + public NSPort sendPort () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_sendPort); + return result !is null ? new NSPort(result) : null; + } + + public static id static_serviceConnectionWithName_rootObject_ (NSString name, id root) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_serviceConnectionWithName_1rootObject_1, name !is null ? name.id : null, + root !is null ? root.id : null); + return result !is null ? new id(result) : null; + } + + public static id static_serviceConnectionWithName_rootObject_usingNameServer_ (NSString name, id root, NSPortNameServer server) + { + objc.id result = OS.objc_msgSend(OS.class_NSConnection, OS.sel_serviceConnectionWithName_1rootObject_1usingNameServer_1, + name !is null ? name.id : null, root !is null ? root.id : null, server !is null ? server.id : null); + return result !is null ? new id(result) : null; + } + + public void setDelegate (id anObject) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); + } + + public void setIndependentConversationQueueing (bool yorn) + { + OS.objc_msgSend(this.id, OS.sel_setIndependentConversationQueueing_1, yorn); + } + + public void setReplyTimeout (double ti) + { + OS.objc_msgSend(this.id, OS.sel_setReplyTimeout_1, ti); + } + + public void setRequestTimeout (double ti) + { + OS.objc_msgSend(this.id, OS.sel_setRequestTimeout_1, ti); + } + + public void setRootObject (id anObject) + { + OS.objc_msgSend(this.id, OS.sel_setRootObject_1, anObject !is null ? anObject.id : null); + } + + public NSDictionary statistics () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_statistics); + return result !is null ? new NSDictionary(result) : null; + } + +}