comparison dwt/dnd/DND.d @ 238:380bad9f6852

reverted char[] to String
author Frank Benoit <benoit@tionex.de>
date Mon, 05 May 2008 00:42:55 +0200
parents 52b32f5cb1e0
children ce446666f5a2
comparison
equal deleted inserted replaced
237:98b80b00af79 238:380bad9f6852
10 * Port to the D programming language: 10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de> 11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/ 12 *******************************************************************************/
13 module dwt.dnd.DND; 13 module dwt.dnd.DND;
14 14
15 import dwt.dwthelper.utils;
16
15 17
16 import dwt.DWT; 18 import dwt.DWT;
17 import dwt.DWTError; 19 import dwt.DWTError;
18 import dwt.DWTException; 20 import dwt.DWTException;
19 21
198 * @since 3.1 200 * @since 3.1
199 */ 201 */
200 public static const int ERROR_INVALID_DATA = 2003; 202 public static const int ERROR_INVALID_DATA = 2003;
201 203
202 204
203 static const char[] INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$ 205 static const String INIT_DRAG_MESSAGE = "Cannot initialize Drag"; //$NON-NLS-1$
204 static const char[] INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$ 206 static const String INIT_DROP_MESSAGE = "Cannot initialize Drop"; //$NON-NLS-1$
205 static const char[] CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$ 207 static const String CANNOT_SET_CLIPBOARD_MESSAGE = "Cannot set data in clipboard"; //$NON-NLS-1$
206 static const char[] INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$ 208 static const String INVALID_DATA_MESSAGE = "Data does not have correct format for type"; //$NON-NLS-1$
207 209
208 /** 210 /**
209 * Throws an appropriate exception based on the passed in error code. 211 * Throws an appropriate exception based on the passed in error code.
210 * 212 *
211 * @param code the DND error code 213 * @param code the DND error code
241 */ 243 */
242 public static void error (int code, int hresult) { 244 public static void error (int code, int hresult) {
243 switch (code) { 245 switch (code) {
244 /* OS Failure/Limit (fatal, may occur only on some platforms) */ 246 /* OS Failure/Limit (fatal, may occur only on some platforms) */
245 case DND.ERROR_CANNOT_INIT_DRAG:{ 247 case DND.ERROR_CANNOT_INIT_DRAG:{
246 char[] msg = DND.INIT_DRAG_MESSAGE; 248 String msg = DND.INIT_DRAG_MESSAGE;
247 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ 249 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$
248 throw new DWTError (code, msg); 250 throw new DWTError (code, msg);
249 } 251 }
250 case DND.ERROR_CANNOT_INIT_DROP:{ 252 case DND.ERROR_CANNOT_INIT_DROP:{
251 char[] msg = DND.INIT_DROP_MESSAGE; 253 String msg = DND.INIT_DROP_MESSAGE;
252 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ 254 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$
253 throw new DWTError (code, msg); 255 throw new DWTError (code, msg);
254 } 256 }
255 case DND.ERROR_CANNOT_SET_CLIPBOARD:{ 257 case DND.ERROR_CANNOT_SET_CLIPBOARD:{
256 char[] msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE; 258 String msg = DND.CANNOT_SET_CLIPBOARD_MESSAGE;
257 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ 259 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$
258 throw new DWTError (code, msg); 260 throw new DWTError (code, msg);
259 } 261 }
260 case DND.ERROR_INVALID_DATA:{ 262 case DND.ERROR_INVALID_DATA:{
261 char[] msg = DND.INVALID_DATA_MESSAGE; 263 String msg = DND.INVALID_DATA_MESSAGE;
262 if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ 264 if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$
263 throw new DWTException (code, msg); 265 throw new DWTException (code, msg);
264 } 266 }
265 default: 267 default:
266 } 268 }
267 269