Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSSocketPort.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 source
/******************************************************************************* * 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.NSSocketPort; import dwt.internal.cocoa.NSData; import dwt.internal.cocoa.NSPort; import dwt.internal.cocoa.NSString; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSSocketPort : NSPort { public this () { super(); } public this (objc.id id) { super(id); } public NSData address () { objc.id result = OS.objc_msgSend(this.id, OS.sel_address); return result !is null ? new NSData(result) : null; } public id initRemoteWithProtocolFamily (int family, int type, int protocol, NSData address) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initRemoteWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol, address !is null ? address.id : null); return result !is null ? new id(result) : null; } public id initRemoteWithTCPPort (ushort port, NSString hostName) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initRemoteWithTCPPort_1host_1, port, hostName !is null ? hostName.id : null); return result !is null ? new id(result) : null; } public id initWithProtocolFamily_socketType_protocol_address_ (int family, int type, int protocol, NSData address) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithProtocolFamily_1socketType_1protocol_1address_1, family, type, protocol, address !is null ? address.id : null); return result !is null ? new id(result) : null; } public id initWithProtocolFamily_socketType_protocol_socket_ (int family, int type, int protocol, NSSocketNativeHandle sock) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithProtocolFamily_1socketType_1protocol_1socket_1, family, type, protocol, sock); return result !is null ? new id(result) : null; } public id initWithTCPPort (short port) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithTCPPort_1, port); return result !is null ? new id(result) : null; } public int protocol () { return OS.objc_msgSend(this.id, OS.sel_protocol); } public int protocolFamily () { return OS.objc_msgSend(this.id, OS.sel_protocolFamily); } public NSSocketNativeHandle socket () { return OS.objc_msgSend(this.id, OS.sel_socket); } public int socketType () { return OS.objc_msgSend(this.id, OS.sel_socketType); } }