comparison 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
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.NSNetService;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSData;
19 import dwt.internal.cocoa.NSDate : NSTimeInterval;
20 import dwt.internal.cocoa.NSDictionary;
21 import dwt.internal.cocoa.NSInteger;
22 import dwt.internal.cocoa.NSObject;
23 import dwt.internal.cocoa.NSRunLoop;
24 import dwt.internal.cocoa.NSString;
25 import dwt.internal.cocoa.OS;
26 import objc = dwt.internal.objc.runtime;
27
28 enum
29 {
30 NSNetServiceNoAutoRename = 1 << 0
31 }
32
33 alias NSUInteger NSNetServiceOptions;
34
35 public class NSNetService : NSObject
36 {
37
38 public this ()
39 {
40 super();
41 }
42
43 public this (objc.id id)
44 {
45 super(id);
46 }
47
48 public NSData TXTRecordData ()
49 {
50 objc.id result = OS.objc_msgSend(this.id, OS.sel_TXTRecordData);
51 return result !is null ? new NSData(result) : null;
52 }
53
54 public NSArray addresses ()
55 {
56 objc.id result = OS.objc_msgSend(this.id, OS.sel_addresses);
57 return result !is null ? new NSArray(result) : null;
58 }
59
60 public static NSData dataFromTXTRecordDictionary (NSDictionary txtDictionary)
61 {
62 objc.id result = OS.objc_msgSend(OS.class_NSNetService, OS.sel_dataFromTXTRecordDictionary_1,
63 txtDictionary !is null ? txtDictionary.id : null);
64 return result !is null ? new NSData(result) : null;
65 }
66
67 public id delegatee ()
68 {
69 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
70 return result !is null ? new id(result) : null;
71 }
72
73 public static NSDictionary dictionaryFromTXTRecordData (NSData txtData)
74 {
75 objc.id result = OS.objc_msgSend(OS.class_NSNetService, OS.sel_dictionaryFromTXTRecordData_1, txtData !is null ? txtData.id : null);
76 return result !is null ? new NSDictionary(result) : null;
77 }
78
79 public NSString domain ()
80 {
81 objc.id result = OS.objc_msgSend(this.id, OS.sel_domain);
82 return result !is null ? new NSString(result) : null;
83 }
84
85 public bool getInputStream (objc.id** inputStream, objc.id** outputStream)
86 {
87 return OS.objc_msgSend(this.id, OS.sel_getInputStream_1outputStream_1, inputStream, outputStream) !is null;
88 }
89
90 public NSString hostName ()
91 {
92 objc.id result = OS.objc_msgSend(this.id, OS.sel_hostName);
93 return result !is null ? new NSString(result) : null;
94 }
95
96 public id initWithDomain_type_name_ (NSString domain, NSString type, NSString name)
97 {
98 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDomain_1type_1name_1, domain !is null ? domain.id : null,
99 type !is null ? type.id : null, name !is null ? name.id : null);
100 return result !is null ? new id(result) : null;
101 }
102
103 public id initWithDomain_type_name_port_ (NSString domain, NSString type, NSString name, int port)
104 {
105 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDomain_1type_1name_1port_1, domain !is null ? domain.id : null,
106 type !is null ? type.id : null, name !is null ? name.id : null, port);
107 return result !is null ? new id(result) : null;
108 }
109
110 public NSString name ()
111 {
112 objc.id result = OS.objc_msgSend(this.id, OS.sel_name);
113 return result !is null ? new NSString(result) : null;
114 }
115
116 public NSInteger port ()
117 {
118 return OS.objc_msgSend(this.id, OS.sel_port);
119 }
120
121 public NSString protocolSpecificInformation ()
122 {
123 objc.id result = OS.objc_msgSend(this.id, OS.sel_protocolSpecificInformation);
124 return result !is null ? new NSString(result) : null;
125 }
126
127 public void publish ()
128 {
129 OS.objc_msgSend(this.id, OS.sel_publish);
130 }
131
132 public void publishWithOptions (NSNetServiceOptions options)
133 {
134 OS.objc_msgSend(this.id, OS.sel_publishWithOptions_1, options);
135 }
136
137 public void removeFromRunLoop (NSRunLoop aRunLoop, NSString mode)
138 {
139 OS.objc_msgSend(this.id, OS.sel_removeFromRunLoop_1forMode_1, aRunLoop !is null ? aRunLoop.id : null, mode !is null ? mode.id : null);
140 }
141
142 public void resolve ()
143 {
144 OS.objc_msgSend(this.id, OS.sel_resolve);
145 }
146
147 public void resolveWithTimeout (NSTimeInterval timeout)
148 {
149 OS.objc_msgSend(this.id, OS.sel_resolveWithTimeout_1, timeout);
150 }
151
152 public void scheduleInRunLoop (NSRunLoop aRunLoop, NSString mode)
153 {
154 OS.objc_msgSend(this.id, OS.sel_scheduleInRunLoop_1forMode_1, aRunLoop !is null ? aRunLoop.id : null, mode !is null ? mode.id : null);
155 }
156
157 public void setDelegate (id delegatee)
158 {
159 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null);
160 }
161
162 public void setProtocolSpecificInformation (NSString specificInformation)
163 {
164 OS.objc_msgSend(this.id, OS.sel_setProtocolSpecificInformation_1, specificInformation !is null ? specificInformation.id : null);
165 }
166
167 public bool setTXTRecordData (NSData recordData)
168 {
169 return OS.objc_msgSend(this.id, OS.sel_setTXTRecordData_1, recordData !is null ? recordData.id : null) !is null;
170 }
171
172 public void startMonitoring ()
173 {
174 OS.objc_msgSend(this.id, OS.sel_startMonitoring);
175 }
176
177 public void stop ()
178 {
179 OS.objc_msgSend(this.id, OS.sel_stop);
180 }
181
182 public void stopMonitoring ()
183 {
184 OS.objc_msgSend(this.id, OS.sel_stopMonitoring);
185 }
186
187 public NSString type ()
188 {
189 objc.id result = OS.objc_msgSend(this.id, OS.sel_type);
190 return result !is null ? new NSString(result) : null;
191 }
192
193 }