comparison dwt/internal/cocoa/NSError.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
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSError;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
18 import dwt.internal.cocoa.NSDictionary;
19 import dwt.internal.cocoa.NSInteger;
20 import dwt.internal.cocoa.NSObject;
21 import dwt.internal.cocoa.NSString;
22 import dwt.internal.cocoa.OS;
23 import objc = dwt.internal.objc.runtime;
24
25 public class NSError : NSObject
26 {
27
28 public this ()
29 {
30 super();
31 }
32
33 public this (objc.id id)
34 {
35 super(id);
36 }
37
38 public NSInteger code ()
39 {
40 return OS.objc_msgSend(this.id, OS.sel_code);
41 }
42
43 public NSString domain ()
44 {
45 objc.id result = OS.objc_msgSend(this.id, OS.sel_domain);
46 return result !is null ? new NSString(result) : null;
47 }
48
49 public static id errorWithDomain (NSString domain, NSInteger code, NSDictionary dict)
50 {
51 objc.id result = OS.objc_msgSend(OS.class_NSError, OS.sel_errorWithDomain_1code_1userInfo_1, domain !is null ? domain.id : null, code,
52 dict !is null ? dict.id : null);
53 return result !is null ? new id(result) : null;
54 }
55
56 public id initWithDomain (NSString domain, NSInteger code, NSDictionary dict)
57 {
58 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDomain_1code_1userInfo_1, domain !is null ? domain.id : null, code,
59 dict !is null ? dict.id : null);
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
99 }