comparison dwt/dnd/TextTransfer.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 184ab53b7785
children e2affbeb686d
comparison
equal deleted inserted replaced
211:ff59aeb96cac 212:ab60f3309436
39 * @see Transfer 39 * @see Transfer
40 */ 40 */
41 public class TextTransfer : ByteArrayTransfer { 41 public class TextTransfer : ByteArrayTransfer {
42 42
43 private static TextTransfer _instance; 43 private static TextTransfer _instance;
44 private static const char[] CF_UNICODETEXT = "CF_UNICODETEXT"; //$NON-NLS-1$ 44 private static const String CF_UNICODETEXT = "CF_UNICODETEXT"; //$NON-NLS-1$
45 private static const char[] CF_TEXT = "CF_TEXT"; //$NON-NLS-1$ 45 private static const String CF_TEXT = "CF_TEXT"; //$NON-NLS-1$
46 private static const int CF_UNICODETEXTID = COM.CF_UNICODETEXT; 46 private static const int CF_UNICODETEXTID = COM.CF_UNICODETEXT;
47 private static const int CF_TEXTID = COM.CF_TEXT; 47 private static const int CF_TEXTID = COM.CF_TEXT;
48 48
49 private this() {} 49 private this() {}
50 50
77 public void javaToNative (Object object, TransferData transferData){ 77 public void javaToNative (Object object, TransferData transferData){
78 if (!checkText(object) || !isSupportedType(transferData)) { 78 if (!checkText(object) || !isSupportedType(transferData)) {
79 DND.error(DND.ERROR_INVALID_DATA); 79 DND.error(DND.ERROR_INVALID_DATA);
80 } 80 }
81 transferData.result = COM.E_FAIL; 81 transferData.result = COM.E_FAIL;
82 char[] string = (cast(ArrayWrapperString)object).array; 82 String string = (cast(ArrayWrapperString)object).array;
83 switch (transferData.type) { 83 switch (transferData.type) {
84 case COM.CF_UNICODETEXT: { 84 case COM.CF_UNICODETEXT: {
85 wchar[] chars = StrToWCHARs(0,string, true); 85 wchar[] chars = StrToWCHARs(0,string, true);
86 int charCount = chars.length; 86 int charCount = chars.length;
87 int byteCount = chars.length * 2; 87 int byteCount = chars.length * 2;
186 186
187 protected int[] getTypeIds(){ 187 protected int[] getTypeIds(){
188 return [CF_UNICODETEXTID, CF_TEXTID]; 188 return [CF_UNICODETEXTID, CF_TEXTID];
189 } 189 }
190 190
191 protected char[][] getTypeNames(){ 191 protected String[] getTypeNames(){
192 return [CF_UNICODETEXT, CF_TEXT]; 192 return [CF_UNICODETEXT, CF_TEXT];
193 } 193 }
194 194
195 bool checkText(Object object) { 195 bool checkText(Object object) {
196 if( auto s = cast(ArrayWrapperString)object ){ 196 if( auto s = cast(ArrayWrapperString)object ){