view dwt/internal/cocoa/NSURL.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
line wrap: on
line source

/*******************************************************************************
 * 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;
    }

}