Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSError.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 |
comparison
equal
deleted
inserted
replaced
44:ca5e494f2bbf | 45:d8635bb48c7c |
---|---|
1 /******************************************************************************* | 1 /******************************************************************************* |
2 * Copyright (c) 2007 IBM Corporation and others. | 2 * Copyright (c) 2000, 2008 IBM Corporation and others. |
3 * All rights reserved. This program and the accompanying materials | 3 * All rights reserved. This program and the accompanying materials |
4 * are made available under the terms of the Eclipse Public License v1.0 | 4 * are made available under the terms of the Eclipse Public License v1.0 |
5 * which accompanies this distribution, and is available at | 5 * which accompanies this distribution, and is available at |
6 * http://www.eclipse.org/legal/epl-v10.html | 6 * http://www.eclipse.org/legal/epl-v10.html |
7 * | 7 * |
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * | 10 * |
11 * Port to the D programming language: | 11 * Port to the D programming language: |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <doob@me.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSError; | 14 module dwt.internal.cocoa.NSError; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.dwthelper.utils; |
17 import dwt.internal.cocoa.NSArray; | 17 import cocoa = dwt.internal.cocoa.id; |
18 import dwt.internal.cocoa.NSDictionary; | 18 import dwt.internal.cocoa.NSDictionary; |
19 import dwt.internal.cocoa.NSInteger; | |
20 import dwt.internal.cocoa.NSObject; | 19 import dwt.internal.cocoa.NSObject; |
21 import dwt.internal.cocoa.NSString; | 20 import dwt.internal.cocoa.NSString; |
22 import dwt.internal.cocoa.OS; | 21 import dwt.internal.cocoa.OS; |
22 import dwt.internal.objc.cocoa.Cocoa; | |
23 import objc = dwt.internal.objc.runtime; | 23 import objc = dwt.internal.objc.runtime; |
24 | 24 |
25 public class NSError : NSObject | 25 public class NSError : NSObject { |
26 { | |
27 | 26 |
28 public this () | 27 public this() { |
29 { | 28 super(); |
30 super(); | 29 } |
31 } | |
32 | 30 |
33 public this (objc.id id) | 31 public this(objc.id id) { |
34 { | 32 super(id); |
35 super(id); | 33 } |
36 } | |
37 | 34 |
38 public NSInteger code () | 35 public this(cocoa.id id) { |
39 { | 36 super(id); |
40 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_code); | 37 } |
41 } | |
42 | 38 |
43 public NSString domain () | 39 public NSInteger code() { |
44 { | 40 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_code); |
45 objc.id result = OS.objc_msgSend(this.id_, OS.sel_domain); | 41 } |
46 return result !is null ? new NSString(result) : null; | |
47 } | |
48 | 42 |
49 public static id errorWithDomain (NSString domain, NSInteger code, NSDictionary dict) | 43 public NSString localizedDescription() { |
50 { | 44 objc.id result = OS.objc_msgSend(this.id, OS.sel_localizedDescription); |
51 objc.id result = OS.objc_msgSend(OS.class_NSError, OS.sel_errorWithDomain_1code_1userInfo_1, domain !is null ? domain.id_ : null, code, | 45 return result !is null ? new NSString(result) : null; |
52 dict !is null ? dict.id_ : null); | 46 } |
53 return result !is null ? new id(result) : null; | |
54 } | |
55 | 47 |
56 public id initWithDomain (NSString domain, NSInteger code, NSDictionary dict) | 48 public NSDictionary userInfo() { |
57 { | 49 objc.id result = OS.objc_msgSend(this.id, OS.sel_userInfo); |
58 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithDomain_1code_1userInfo_1, domain !is null ? domain.id_ : null, code, | 50 return result !is null ? new NSDictionary(result) : null; |
59 dict !is null ? dict.id_ : null); | 51 } |
60 return result !is null ? new id(result) : null; | |
61 } | |
62 | |
63 public NSString localizedDescription () | |
64 { | |
65 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedDescription); | |
66 return result !is null ? new NSString(result) : null; | |
67 } | |
68 | |
69 public NSString localizedFailureReason () | |
70 { | |
71 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedFailureReason); | |
72 return result !is null ? new NSString(result) : null; | |
73 } | |
74 | |
75 public NSArray localizedRecoveryOptions () | |
76 { | |
77 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedRecoveryOptions); | |
78 return result !is null ? new NSArray(result) : null; | |
79 } | |
80 | |
81 public NSString localizedRecoverySuggestion () | |
82 { | |
83 objc.id result = OS.objc_msgSend(this.id_, OS.sel_localizedRecoverySuggestion); | |
84 return result !is null ? new NSString(result) : null; | |
85 } | |
86 | |
87 public id recoveryAttempter () | |
88 { | |
89 objc.id result = OS.objc_msgSend(this.id_, OS.sel_recoveryAttempter); | |
90 return result !is null ? new id(result) : null; | |
91 } | |
92 | |
93 public NSDictionary userInfo () | |
94 { | |
95 objc.id result = OS.objc_msgSend(this.id_, OS.sel_userInfo); | |
96 return result !is null ? new NSDictionary(result) : null; | |
97 } | |
98 | 52 |
99 } | 53 } |