comparison dwt/internal/cocoa/NSURL.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.NSURL;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSData;
18 import dwt.internal.cocoa.NSNumber;
19 import dwt.internal.cocoa.NSObject;
20 import dwt.internal.cocoa.NSString;
21 import dwt.internal.cocoa.NSURLHandle;
22 import dwt.internal.cocoa.OS;
23 import objc = dwt.internal.objc.runtime;
24
25 public class NSURL : NSObject
26 {
27
28 public this ()
29 {
30 super();
31 }
32
33 public this (objc.id id)
34 {
35 super(id);
36 }
37
38 public NSURLHandle URLHandleUsingCache (bool shouldUseCache)
39 {
40 objc.id result = OS.objc_msgSend(this.id, OS.sel_URLHandleUsingCache_1, shouldUseCache);
41 return result !is null ? new NSURLHandle(result) : null;
42 }
43
44 public static NSURL static_URLWithString_ (NSString URLString)
45 {
46 objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_1, URLString !is null ? URLString.id : null);
47 return result !is null ? new NSURL(result) : null;
48 }
49
50 public static id static_URLWithString_relativeToURL_ (NSString URLString, NSURL baseURL)
51 {
52 objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_1relativeToURL_1, URLString !is null ? URLString.id : null,
53 baseURL !is null ? baseURL.id : null);
54 return result !is null ? new id(result) : null;
55 }
56
57 public NSString absoluteString ()
58 {
59 objc.id result = OS.objc_msgSend(this.id, OS.sel_absoluteString);
60 return result !is null ? new NSString(result) : null;
61 }
62
63 public NSURL absoluteURL ()
64 {
65 objc.id result = OS.objc_msgSend(this.id, OS.sel_absoluteURL);
66 return result is this.id ? this : (result !is null ? new NSURL(result) : null);
67 }
68
69 public NSURL baseURL ()
70 {
71 objc.id result = OS.objc_msgSend(this.id, OS.sel_baseURL);
72 return result is this.id ? this : (result !is null ? new NSURL(result) : null);
73 }
74
75 public static NSURL static_fileURLWithPath_ (NSString path)
76 {
77 objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_1, path !is null ? path.id : null);
78 return result !is null ? new NSURL(result) : null;
79 }
80
81 public static id static_fileURLWithPath_isDirectory_ (NSString path, bool isDir)
82 {
83 objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_1isDirectory_1, path !is null ? path.id : null, isDir);
84 return result !is null ? new id(result) : null;
85 }
86
87 public NSString fragment ()
88 {
89 objc.id result = OS.objc_msgSend(this.id, OS.sel_fragment);
90 return result !is null ? new NSString(result) : null;
91 }
92
93 public NSString host ()
94 {
95 objc.id result = OS.objc_msgSend(this.id, OS.sel_host);
96 return result !is null ? new NSString(result) : null;
97 }
98
99 public id initFileURLWithPath_ (NSString path)
100 {
101 objc.id result = OS.objc_msgSend(this.id, OS.sel_initFileURLWithPath_1, path !is null ? path.id : null);
102 return result !is null ? new id(result) : null;
103 }
104
105 public id initFileURLWithPath_isDirectory_ (NSString path, bool isDir)
106 {
107 objc.id result = OS.objc_msgSend(this.id, OS.sel_initFileURLWithPath_1isDirectory_1, path !is null ? path.id : null, isDir);
108 return result !is null ? new id(result) : null;
109 }
110
111 public id initWithScheme (NSString scheme, NSString host, NSString path)
112 {
113 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithScheme_1host_1path_1, scheme !is null ? scheme.id : null,
114 host !is null ? host.id : null, path !is null ? path.id : null);
115 return result !is null ? new id(result) : null;
116 }
117
118 public id initWithString_ (NSString URLString)
119 {
120 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, URLString !is null ? URLString.id : null);
121 return result !is null ? new id(result) : null;
122 }
123
124 public id initWithString_relativeToURL_ (NSString URLString, NSURL baseURL)
125 {
126 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1relativeToURL_1, URLString !is null ? URLString.id : null,
127 baseURL !is null ? baseURL.id : null);
128 return result !is null ? new id(result) : null;
129 }
130
131 public bool isFileURL ()
132 {
133 return OS.objc_msgSend(this.id, OS.sel_isFileURL) !is null;
134 }
135
136 public void loadResourceDataNotifyingClient (id client, bool shouldUseCache)
137 {
138 OS.objc_msgSend(this.id, OS.sel_loadResourceDataNotifyingClient_1usingCache_1, client !is null ? client.id : null, shouldUseCache);
139 }
140
141 public NSString parameterString ()
142 {
143 objc.id result = OS.objc_msgSend(this.id, OS.sel_parameterString);
144 return result !is null ? new NSString(result) : null;
145 }
146
147 public NSString password ()
148 {
149 objc.id result = OS.objc_msgSend(this.id, OS.sel_password);
150 return result !is null ? new NSString(result) : null;
151 }
152
153 public NSString path ()
154 {
155 objc.id result = OS.objc_msgSend(this.id, OS.sel_path);
156 return result !is null ? new NSString(result) : null;
157 }
158
159 public NSNumber port ()
160 {
161 objc.id result = OS.objc_msgSend(this.id, OS.sel_port);
162 return result !is null ? new NSNumber(result) : null;
163 }
164
165 public id propertyForKey (NSString propertyKey)
166 {
167 objc.id result = OS.objc_msgSend(this.id, OS.sel_propertyForKey_1, propertyKey !is null ? propertyKey.id : null);
168 return result !is null ? new id(result) : null;
169 }
170
171 public NSString query ()
172 {
173 objc.id result = OS.objc_msgSend(this.id, OS.sel_query);
174 return result !is null ? new NSString(result) : null;
175 }
176
177 public NSString relativePath ()
178 {
179 objc.id result = OS.objc_msgSend(this.id, OS.sel_relativePath);
180 return result !is null ? new NSString(result) : null;
181 }
182
183 public NSString relativeString ()
184 {
185 objc.id result = OS.objc_msgSend(this.id, OS.sel_relativeString);
186 return result !is null ? new NSString(result) : null;
187 }
188
189 public NSData resourceDataUsingCache (bool shouldUseCache)
190 {
191 objc.id result = OS.objc_msgSend(this.id, OS.sel_resourceDataUsingCache_1, shouldUseCache);
192 return result !is null ? new NSData(result) : null;
193 }
194
195 public NSString resourceSpecifier ()
196 {
197 objc.id result = OS.objc_msgSend(this.id, OS.sel_resourceSpecifier);
198 return result !is null ? new NSString(result) : null;
199 }
200
201 public NSString scheme ()
202 {
203 objc.id result = OS.objc_msgSend(this.id, OS.sel_scheme);
204 return result !is null ? new NSString(result) : null;
205 }
206
207 public bool setProperty (id property, NSString propertyKey)
208 {
209 return OS.objc_msgSend(this.id, OS.sel_setProperty_1forKey_1, property !is null ? property.id : null,
210 propertyKey !is null ? propertyKey.id : null) !is null;
211 }
212
213 public bool setResourceData (NSData data)
214 {
215 return OS.objc_msgSend(this.id, OS.sel_setResourceData_1, data !is null ? data.id : null) !is null;
216 }
217
218 public NSURL standardizedURL ()
219 {
220 objc.id result = OS.objc_msgSend(this.id, OS.sel_standardizedURL);
221 return result is this.id ? this : (result !is null ? new NSURL(result) : null);
222 }
223
224 public NSString user ()
225 {
226 objc.id result = OS.objc_msgSend(this.id, OS.sel_user);
227 return result !is null ? new NSString(result) : null;
228 }
229
230 }