diff dwt/internal/cocoa/NSNetService.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/NSNetService.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * 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.NSNetService;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSArray;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSDate : NSTimeInterval;
+import dwt.internal.cocoa.NSDictionary;
+import dwt.internal.cocoa.NSInteger;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSRunLoop;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+enum
+{
+    NSNetServiceNoAutoRename = 1 << 0
+}
+
+alias NSUInteger NSNetServiceOptions;
+
+public class NSNetService : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSData TXTRecordData ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_TXTRecordData);
+        return result !is null ? new NSData(result) : null;
+    }
+
+    public NSArray addresses ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_addresses);
+        return result !is null ? new NSArray(result) : null;
+    }
+
+    public static NSData dataFromTXTRecordDictionary (NSDictionary txtDictionary)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSNetService, OS.sel_dataFromTXTRecordDictionary_1,
+                txtDictionary !is null ? txtDictionary.id : null);
+        return result !is null ? new NSData(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 static NSDictionary dictionaryFromTXTRecordData (NSData txtData)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSNetService, OS.sel_dictionaryFromTXTRecordData_1, txtData !is null ? txtData.id : null);
+        return result !is null ? new NSDictionary(result) : null;
+    }
+
+    public NSString domain ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_domain);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public bool getInputStream (objc.id** inputStream, objc.id** outputStream)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_getInputStream_1outputStream_1, inputStream, outputStream) !is null;
+    }
+
+    public NSString hostName ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_hostName);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public id initWithDomain_type_name_ (NSString domain, NSString type, NSString name)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDomain_1type_1name_1, domain !is null ? domain.id : null,
+                type !is null ? type.id : null, name !is null ? name.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithDomain_type_name_port_ (NSString domain, NSString type, NSString name, int port)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDomain_1type_1name_1port_1, domain !is null ? domain.id : null,
+                type !is null ? type.id : null, name !is null ? name.id : null, port);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString name ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_name);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSInteger port ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_port);
+    }
+
+    public NSString protocolSpecificInformation ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_protocolSpecificInformation);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public void publish ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_publish);
+    }
+
+    public void publishWithOptions (NSNetServiceOptions options)
+    {
+        OS.objc_msgSend(this.id, OS.sel_publishWithOptions_1, options);
+    }
+
+    public void removeFromRunLoop (NSRunLoop aRunLoop, NSString mode)
+    {
+        OS.objc_msgSend(this.id, OS.sel_removeFromRunLoop_1forMode_1, aRunLoop !is null ? aRunLoop.id : null, mode !is null ? mode.id : null);
+    }
+
+    public void resolve ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_resolve);
+    }
+
+    public void resolveWithTimeout (NSTimeInterval timeout)
+    {
+        OS.objc_msgSend(this.id, OS.sel_resolveWithTimeout_1, timeout);
+    }
+
+    public void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode)
+    {
+        OS.objc_msgSend(this.id, OS.sel_scheduleInRunLoop_1forMode_1, aRunLoop !is null ? aRunLoop.id : null, mode !is null ? mode.id : null);
+    }
+
+    public void setDelegate (id delegatee)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
+    }
+
+    public void setProtocolSpecificInformation (NSString specificInformation)
+    {
+        OS.objc_msgSend(this.id, OS.sel_setProtocolSpecificInformation_1, specificInformation !is null ? specificInformation.id : null);
+    }
+
+    public bool setTXTRecordData (NSData recordData)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setTXTRecordData_1, recordData !is null ? recordData.id : null) !is null;
+    }
+
+    public void startMonitoring ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_startMonitoring);
+    }
+
+    public void stop ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_stop);
+    }
+
+    public void stopMonitoring ()
+    {
+        OS.objc_msgSend(this.id, OS.sel_stopMonitoring);
+    }
+
+    public NSString type ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_type);
+        return result !is null ? new NSString(result) : null;
+    }
+
+}