1 /*******************************************************************************
2 * Copyright (c) 2000, 2017 IBM Corporation and others.
3 *
4 * This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License 2.0
6 * which accompanies this distribution, and is available at
7 * https://www.eclipse.org/legal/epl-2.0/
8 *
9 * SPDX-License-Identifier: EPL-2.0
10 *
11 * Contributors:
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.internal.cocoa;
15
16 public class NSURL extends NSObject {
17
NSURL()18 public NSURL() {
19 super();
20 }
21
NSURL(long id)22 public NSURL(long id) {
23 super(id);
24 }
25
NSURL(id id)26 public NSURL(id id) {
27 super(id);
28 }
29
URLFromPasteboard(NSPasteboard pasteBoard)30 public static NSURL URLFromPasteboard(NSPasteboard pasteBoard) {
31 long result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLFromPasteboard_, pasteBoard != null ? pasteBoard.id : 0);
32 return result != 0 ? new NSURL(result) : null;
33 }
34
URLWithString(NSString URLString)35 public static NSURL URLWithString(NSString URLString) {
36 long result = OS.objc_msgSend(OS.class_NSURL, OS.sel_URLWithString_, URLString != null ? URLString.id : 0);
37 return result != 0 ? new NSURL(result) : null;
38 }
39
absoluteString()40 public NSString absoluteString() {
41 long result = OS.objc_msgSend(this.id, OS.sel_absoluteString);
42 return result != 0 ? new NSString(result) : null;
43 }
44
fileURLWithPath(NSString path)45 public static NSURL fileURLWithPath(NSString path) {
46 long result = OS.objc_msgSend(OS.class_NSURL, OS.sel_fileURLWithPath_, path != null ? path.id : 0);
47 return result != 0 ? new NSURL(result) : null;
48 }
49
host()50 public NSString host() {
51 long result = OS.objc_msgSend(this.id, OS.sel_host);
52 return result != 0 ? new NSString(result) : null;
53 }
54
isFileURL()55 public boolean isFileURL() {
56 return OS.objc_msgSend_bool(this.id, OS.sel_isFileURL);
57 }
58
path()59 public NSString path() {
60 long result = OS.objc_msgSend(this.id, OS.sel_path);
61 return result != 0 ? new NSString(result) : null;
62 }
63
64 }
65