Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSException.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.NSException; | |
15 | |
16 import tango.stdc.stdarg : va_list; | |
17 | |
18 import dwt.internal.cocoa.id; | |
19 import dwt.internal.cocoa.NSArray; | |
20 import dwt.internal.cocoa.NSDictionary; | |
21 import dwt.internal.cocoa.NSObject; | |
22 import dwt.internal.cocoa.NSString; | |
23 import dwt.internal.cocoa.OS; | |
24 import objc = dwt.internal.objc.runtime; | |
25 | |
26 public class NSException : NSObject | |
27 { | |
28 | |
29 public this () | |
30 { | |
31 super(); | |
32 } | |
33 | |
34 public this (objc.id id) | |
35 { | |
36 super(id); | |
37 } | |
38 | |
39 public NSArray callStackReturnAddresses () | |
40 { | |
41 objc.id result = OS.objc_msgSend(this.id, OS.sel_callStackReturnAddresses); | |
42 return result !is null ? new NSArray(result) : null; | |
43 } | |
44 | |
45 public static NSException exceptionWithName (NSString name, NSString reason, NSDictionary userInfo) | |
46 { | |
47 objc.id result = OS.objc_msgSend(OS.class_NSException, OS.sel_exceptionWithName_1reason_1userInfo_1, name !is null ? name.id : null, | |
48 reason !is null ? reason.id : null, userInfo !is null ? userInfo.id : null); | |
49 return result !is null ? new NSException(result) : null; | |
50 } | |
51 | |
52 public id initWithName (NSString aName, NSString aReason, NSDictionary aUserInfo) | |
53 { | |
54 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithName_1reason_1userInfo_1, aName !is null ? aName.id : null, | |
55 aReason !is null ? aReason.id : null, aUserInfo !is null ? aUserInfo.id : null); | |
56 return result !is null ? new id(result) : null; | |
57 } | |
58 | |
59 public NSString name () | |
60 { | |
61 objc.id result = OS.objc_msgSend(this.id, OS.sel_name); | |
62 return result !is null ? new NSString(result) : null; | |
63 } | |
64 | |
65 public void raise () | |
66 { | |
67 OS.objc_msgSend(this.id, OS.sel_raise); | |
68 } | |
69 | |
70 public static void static_raise_format_ (NSString name, NSString format) | |
71 { | |
72 OS.objc_msgSend(OS.class_NSException, OS.sel_raise_1format_1, name !is null ? name.id : null, format !is null ? format.id : null); | |
73 } | |
74 | |
75 public static void static_raise_format_arguments_ (NSString name, NSString format, va_list argList) | |
76 { | |
77 OS.objc_msgSend(OS.class_NSException, OS.sel_raise_1format_1arguments_1, name !is null ? name.id : null, format !is null ? format.id : null, | |
78 argList); | |
79 } | |
80 | |
81 public NSString reason () | |
82 { | |
83 objc.id result = OS.objc_msgSend(this.id, OS.sel_reason); | |
84 return result !is null ? new NSString(result) : null; | |
85 } | |
86 | |
87 public NSDictionary userInfo () | |
88 { | |
89 objc.id result = OS.objc_msgSend(this.id, OS.sel_userInfo); | |
90 return result !is null ? new NSDictionary(result) : null; | |
91 } | |
92 | |
93 } |