Mercurial > projects > dwt-linux
comparison dwt/DWT.d @ 238:380bad9f6852
reverted char[] to String
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 05 May 2008 00:42:55 +0200 |
parents | 08789b28bdf3 |
children | ce446666f5a2 |
comparison
equal
deleted
inserted
replaced
237:98b80b00af79 | 238:380bad9f6852 |
---|---|
3420 * @param code the DWT error code. | 3420 * @param code the DWT error code. |
3421 * @return a description of the error code. | 3421 * @return a description of the error code. |
3422 * | 3422 * |
3423 * @see DWT | 3423 * @see DWT |
3424 */ | 3424 */ |
3425 static char[] findErrorText (int code) { | 3425 static String findErrorText (int code) { |
3426 switch (code) { | 3426 switch (code) { |
3427 case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$ | 3427 case ERROR_UNSPECIFIED: return "Unspecified error"; //$NON-NLS-1$ |
3428 case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$ | 3428 case ERROR_NO_HANDLES: return "No more handles"; //$NON-NLS-1$ |
3429 case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$ | 3429 case ERROR_NO_MORE_CALLBACKS: return "No more callbacks"; //$NON-NLS-1$ |
3430 case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$ | 3430 case ERROR_NULL_ARGUMENT: return "Argument cannot be null"; //$NON-NLS-1$ |
3477 * | 3477 * |
3478 * @exception IllegalArgumentException <ul> | 3478 * @exception IllegalArgumentException <ul> |
3479 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> | 3479 * <li>ERROR_NULL_ARGUMENT - if the key is null</li> |
3480 * </ul> | 3480 * </ul> |
3481 */ | 3481 */ |
3482 public static char[] getMessage(char[] key) { | 3482 public static String getMessage(String key) { |
3483 // PORTING_FIXME: Implement | 3483 // PORTING_FIXME: Implement |
3484 return "msg not found"; | 3484 return "msg not found"; |
3485 //return Compatibility.getMessage(key); | 3485 //return Compatibility.getMessage(key); |
3486 } | 3486 } |
3487 | 3487 |
3489 * Returns the DWT platform name. | 3489 * Returns the DWT platform name. |
3490 * Examples: "win32", "motif", "gtk", "photon", "carbon" | 3490 * Examples: "win32", "motif", "gtk", "photon", "carbon" |
3491 * | 3491 * |
3492 * @return the DWT platform name | 3492 * @return the DWT platform name |
3493 */ | 3493 */ |
3494 public static char[] getPlatform () { | 3494 public static String getPlatform () { |
3495 return Platform.PLATFORM; | 3495 return Platform.PLATFORM; |
3496 } | 3496 } |
3497 | 3497 |
3498 /** | 3498 /** |
3499 * Returns the DWT version number as an integer. | 3499 * Returns the DWT version number as an integer. |
3508 /** | 3508 /** |
3509 * Throws an appropriate exception based on the passed in error code. | 3509 * Throws an appropriate exception based on the passed in error code. |
3510 * | 3510 * |
3511 * @param code the DWT error code | 3511 * @param code the DWT error code |
3512 */ | 3512 */ |
3513 public static void error (char[] file, long line, int code) { | 3513 public static void error (String file, long line, int code) { |
3514 error (code, null); | 3514 error (code, null); |
3515 } | 3515 } |
3516 public static void error (int code) { | 3516 public static void error (int code) { |
3517 error (code, null); | 3517 error (code, null); |
3518 } | 3518 } |
3572 * @see DWTException | 3572 * @see DWTException |
3573 * @see IllegalArgumentException | 3573 * @see IllegalArgumentException |
3574 * | 3574 * |
3575 * @since 3.0 | 3575 * @since 3.0 |
3576 */ | 3576 */ |
3577 public static void error (int code, Exception throwable, char[] detail) { | 3577 public static void error (int code, Exception throwable, String detail) { |
3578 | 3578 |
3579 /* | 3579 /* |
3580 * This code prevents the creation of "chains" of SWTErrors and | 3580 * This code prevents the creation of "chains" of SWTErrors and |
3581 * SWTExceptions which in turn contain other SWTErrors and | 3581 * SWTExceptions which in turn contain other SWTErrors and |
3582 * SWTExceptions as their throwable. This can occur when low level | 3582 * SWTExceptions as their throwable. This can occur when low level |
3593 if (code != DWT.ERROR_FAILED_EXEC) { | 3593 if (code != DWT.ERROR_FAILED_EXEC) { |
3594 if (auto t = cast(DWTError)throwable) throw t; | 3594 if (auto t = cast(DWTError)throwable) throw t; |
3595 if (auto t = cast(DWTException)throwable) throw t; | 3595 if (auto t = cast(DWTException)throwable) throw t; |
3596 } | 3596 } |
3597 | 3597 |
3598 char[] message = findErrorText (code); | 3598 String message = findErrorText (code); |
3599 if (detail != null) message ~= detail; | 3599 if (detail != null) message ~= detail; |
3600 switch (code) { | 3600 switch (code) { |
3601 | 3601 |
3602 /* Illegal Arguments (non-fatal) */ | 3602 /* Illegal Arguments (non-fatal) */ |
3603 case ERROR_NULL_ARGUMENT: | 3603 case ERROR_NULL_ARGUMENT: |