diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dwt/internal/cocoa/NSURL.d	Sat Aug 09 17:00:02 2008 +0200
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * 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.NSURL;
+
+import dwt.internal.cocoa.id;
+import dwt.internal.cocoa.NSData;
+import dwt.internal.cocoa.NSNumber;
+import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSString;
+import dwt.internal.cocoa.NSURLHandle;
+import dwt.internal.cocoa.OS;
+import objc = dwt.internal.objc.runtime;
+
+public class NSURL : NSObject
+{
+
+    public this ()
+    {
+        super();
+    }
+
+    public this (objc.id id)
+    {
+        super(id);
+    }
+
+    public NSURLHandle URLHandleUsingCache (bool shouldUseCache)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_URLHandleUsingCache_1, shouldUseCache);
+        return result !is null ? new NSURLHandle(result) : null;
+    }
+
+    public static NSURL static_URLWithString_ (NSString URLString)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_1, URLString !is null ? URLString.id : null);
+        return result !is null ? new NSURL(result) : null;
+    }
+
+    public static id static_URLWithString_relativeToURL_ (NSString URLString, NSURL baseURL)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_1relativeToURL_1, URLString !is null ? URLString.id : null,
+                baseURL !is null ? baseURL.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString absoluteString ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_absoluteString);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSURL absoluteURL ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_absoluteURL);
+        return result is this.id ? this : (result !is null ? new NSURL(result) : null);
+    }
+
+    public NSURL baseURL ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_baseURL);
+        return result is this.id ? this : (result !is null ? new NSURL(result) : null);
+    }
+
+    public static NSURL static_fileURLWithPath_ (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_1, path !is null ? path.id : null);
+        return result !is null ? new NSURL(result) : null;
+    }
+
+    public static id static_fileURLWithPath_isDirectory_ (NSString path, bool isDir)
+    {
+        objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_1isDirectory_1, path !is null ? path.id : null, isDir);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString fragment ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_fragment);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString host ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_host);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public id initFileURLWithPath_ (NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initFileURLWithPath_1, path !is null ? path.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initFileURLWithPath_isDirectory_ (NSString path, bool isDir)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initFileURLWithPath_1isDirectory_1, path !is null ? path.id : null, isDir);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithScheme (NSString scheme, NSString host, NSString path)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithScheme_1host_1path_1, scheme !is null ? scheme.id : null,
+                host !is null ? host.id : null, path !is null ? path.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithString_ (NSString URLString)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1, URLString !is null ? URLString.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public id initWithString_relativeToURL_ (NSString URLString, NSURL baseURL)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithString_1relativeToURL_1, URLString !is null ? URLString.id : null,
+                baseURL !is null ? baseURL.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public bool isFileURL ()
+    {
+        return OS.objc_msgSend(this.id, OS.sel_isFileURL) !is null;
+    }
+
+    public void loadResourceDataNotifyingClient (id client, bool shouldUseCache)
+    {
+        OS.objc_msgSend(this.id, OS.sel_loadResourceDataNotifyingClient_1usingCache_1, client !is null ? client.id : null, shouldUseCache);
+    }
+
+    public NSString parameterString ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_parameterString);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString password ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_password);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString path ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_path);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSNumber port ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_port);
+        return result !is null ? new NSNumber(result) : null;
+    }
+
+    public id propertyForKey (NSString propertyKey)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_propertyForKey_1, propertyKey !is null ? propertyKey.id : null);
+        return result !is null ? new id(result) : null;
+    }
+
+    public NSString query ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_query);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString relativePath ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_relativePath);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString relativeString ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_relativeString);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSData resourceDataUsingCache (bool shouldUseCache)
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_resourceDataUsingCache_1, shouldUseCache);
+        return result !is null ? new NSData(result) : null;
+    }
+
+    public NSString resourceSpecifier ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_resourceSpecifier);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public NSString scheme ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_scheme);
+        return result !is null ? new NSString(result) : null;
+    }
+
+    public bool setProperty (id property, NSString propertyKey)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setProperty_1forKey_1, property !is null ? property.id : null,
+                propertyKey !is null ? propertyKey.id : null) !is null;
+    }
+
+    public bool setResourceData (NSData data)
+    {
+        return OS.objc_msgSend(this.id, OS.sel_setResourceData_1, data !is null ? data.id : null) !is null;
+    }
+
+    public NSURL standardizedURL ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_standardizedURL);
+        return result is this.id ? this : (result !is null ? new NSURL(result) : null);
+    }
+
+    public NSString user ()
+    {
+        objc.id result = OS.objc_msgSend(this.id, OS.sel_user);
+        return result !is null ? new NSString(result) : null;
+    }
+
+}