diff dwt/internal/cocoa/NSURL.d @ 45:d8635bb48c7c

Merge with SWT 3.5
author Jacob Carlborg <doob@me.com>
date Mon, 01 Dec 2008 17:07:00 +0100
parents f565d3a95c0a
children
line wrap: on
line diff
--- a/dwt/internal/cocoa/NSURL.d	Tue Oct 21 15:20:04 2008 +0200
+++ b/dwt/internal/cocoa/NSURL.d	Mon Dec 01 17:07:00 2008 +0100
@@ -1,230 +1,62 @@
 /*******************************************************************************
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 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
+ *    IBM Corporation - initial API and implementation
  *     
  * Port to the D programming language:
- *     Jacob Carlborg <jacob.carlborg@gmail.com>
+ *    Jacob Carlborg <doob@me.com>
  *******************************************************************************/
 module dwt.internal.cocoa.NSURL;
 
-import dwt.internal.cocoa.id;
-import dwt.internal.cocoa.NSData;
-import dwt.internal.cocoa.NSNumber;
+import dwt.dwthelper.utils;
+import cocoa = dwt.internal.cocoa.id;
 import dwt.internal.cocoa.NSObject;
+import dwt.internal.cocoa.NSPasteboard;
 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 class NSURL : NSObject {
 
-    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 this() {
+    super();
+}
 
-    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 this(objc.id id) {
+    super(id);
+}
 
-    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 this(cocoa.id id) {
+    super(id);
+}
 
-    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 static NSURL URLFromPasteboard(NSPasteboard pasteBoard) {
+    objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLFromPasteboard_, pasteBoard !is null ? pasteBoard.id : null);
+    return result !is null ? new NSURL(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 void writeToPasteboard(NSPasteboard pasteBoard) {
+    OS.objc_msgSend(this.id, OS.sel_writeToPasteboard_, pasteBoard !is null ? pasteBoard.id : 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 static NSURL URLWithString(NSString URLString) {
+    objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_, URLString !is null ? URLString.id : null);
+    return result !is null ? new NSURL(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 absoluteString() {
+    objc.id result = OS.objc_msgSend(this.id, OS.sel_absoluteString);
+    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;
-    }
+public static NSURL fileURLWithPath(NSString path) {
+    objc.id result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_, path !is null ? path.id : null);
+    return result !is null ? new NSURL(result) : null;
+}
 
 }