Mercurial > projects > dwt-win
comparison dwt/DWT.d @ 212:ab60f3309436
reverted the char[] to String and use the an alias.
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:12:38 +0200 |
parents | 1e7701c27c03 |
children | 36f5cb12e1a2 |
comparison
equal
deleted
inserted
replaced
211:ff59aeb96cac | 212:ab60f3309436 |
---|---|
18 import dwt.internal.Platform; | 18 import dwt.internal.Platform; |
19 import dwt.DWTError; | 19 import dwt.DWTError; |
20 import dwt.DWTException; | 20 import dwt.DWTException; |
21 | 21 |
22 import tango.core.Exception; | 22 import tango.core.Exception; |
23 import dwt.dwthelper.utils; | |
23 | 24 |
24 version(build){ | 25 version(build){ |
25 pragma(link, "advapi32"); | 26 pragma(link, "advapi32"); |
26 pragma(link, "comctl32"); | 27 pragma(link, "comctl32"); |
27 pragma(link, "comdlg32"); | 28 pragma(link, "comdlg32"); |
3390 * @param code the DWT error code. | 3391 * @param code the DWT error code. |
3391 * @return a description of the error code. | 3392 * @return a description of the error code. |
3392 * | 3393 * |
3393 * @see DWT | 3394 * @see DWT |
3394 */ | 3395 */ |
3395 static char[] findErrorText (int code) { | 3396 static String findErrorText (int code) { |
3396 switch (code) { | 3397 switch (code) { |
3397 case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$ | 3398 case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$ |
3398 case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$ | 3399 case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$ |
3399 case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$ | 3400 case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$ |
3400 case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$ | 3401 case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$ |
3446 * | 3447 * |
3447 * @exception IllegalArgumentException <ul> | 3448 * @exception IllegalArgumentException <ul> |
3448 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> | 3449 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> |
3449 * </ul> | 3450 * </ul> |
3450 */ | 3451 */ |
3451 public static char[] getMessage(char[] key) { | 3452 public static String getMessage(String key) { |
3452 //return Compatibility.getMessage(key); | 3453 //return Compatibility.getMessage(key); |
3453 return ""; | 3454 return ""; |
3454 } | 3455 } |
3455 | 3456 |
3456 /** | 3457 /** |
3457 * Returns the DWT platform name. | 3458 * Returns the DWT platform name. |
3458 * Examples: "win32", "motif", "gtk", "photon", "carbon" | 3459 * Examples: "win32", "motif", "gtk", "photon", "carbon" |
3459 * | 3460 * |
3460 * @return the DWT platform name | 3461 * @return the DWT platform name |
3461 */ | 3462 */ |
3462 public static char[] getPlatform () { | 3463 public static String getPlatform () { |
3463 return Platform.PLATFORM; | 3464 return Platform.PLATFORM; |
3464 } | 3465 } |
3465 | 3466 |
3466 /** | 3467 /** |
3467 * Returns the DWT version number as an integer. | 3468 * Returns the DWT version number as an integer. |
3476 /** | 3477 /** |
3477 * Throws an appropriate exception based on the passed in error code. | 3478 * Throws an appropriate exception based on the passed in error code. |
3478 * | 3479 * |
3479 * @param code the DWT error code | 3480 * @param code the DWT error code |
3480 */ | 3481 */ |
3481 public static void error (char[] file, long line, int code) { | 3482 public static void error (String file, long line, int code) { |
3482 error (code, null); | 3483 error (code, null); |
3483 } | 3484 } |
3484 public static void error (int code) { | 3485 public static void error (int code) { |
3485 error (code, null); | 3486 error (code, null); |
3486 } | 3487 } |
3540 * @see DWTException | 3541 * @see DWTException |
3541 * @see IllegalArgumentException | 3542 * @see IllegalArgumentException |
3542 * | 3543 * |
3543 * @since 3.0 | 3544 * @since 3.0 |
3544 */ | 3545 */ |
3545 public static void error (int code, Exception throwable, char[] detail) { | 3546 public static void error (int code, Exception throwable, String detail) { |
3546 | 3547 |
3547 /* | 3548 /* |
3548 * This code prevents the creation of "chains" of SWTErrors and | 3549 * This code prevents the creation of "chains" of SWTErrors and |
3549 * SWTExceptions which in turn contain other SWTErrors and | 3550 * SWTExceptions which in turn contain other SWTErrors and |
3550 * SWTExceptions as their throwable. This can occur when low level | 3551 * SWTExceptions as their throwable. This can occur when low level |
3561 if (code !is DWT.ERROR_FAILED_EXEC) { | 3562 if (code !is DWT.ERROR_FAILED_EXEC) { |
3562 if (auto t = cast(DWTError)throwable ) throw t; | 3563 if (auto t = cast(DWTError)throwable ) throw t; |
3563 if (auto t = cast(DWTException)throwable ) throw t; | 3564 if (auto t = cast(DWTException)throwable ) throw t; |
3564 } | 3565 } |
3565 | 3566 |
3566 char[] message = findErrorText (code); | 3567 String message = findErrorText (code); |
3567 if (detail != null) message ~= detail; | 3568 if (detail != null) message ~= detail; |
3568 switch (code) { | 3569 switch (code) { |
3569 | 3570 |
3570 /* Illegal Arguments (non-fatal) */ | 3571 /* Illegal Arguments (non-fatal) */ |
3571 case ERROR_NULL_ARGUMENT: | 3572 case ERROR_NULL_ARGUMENT: |