Mercurial > projects > dwt-win
diff dwt/dnd/HTMLTransfer.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 | 36f5cb12e1a2 |
line wrap: on
line diff
--- a/dwt/dnd/HTMLTransfer.d Sat Apr 26 10:01:48 2008 +0200 +++ b/dwt/dnd/HTMLTransfer.d Mon May 05 00:12:38 2008 +0200 @@ -40,14 +40,14 @@ public class HTMLTransfer : ByteArrayTransfer { static HTMLTransfer _instance; - static const char[] HTML_FORMAT = "HTML Format"; //$NON-NLS-1$ + static const String HTML_FORMAT = "HTML Format"; //$NON-NLS-1$ static const int HTML_FORMATID; - static const char[] NUMBER = "00000000"; //$NON-NLS-1$ - static const char[] HEADER = "Version:0.9\r\nStartHTML:"~NUMBER~"\r\nEndHTML:"~NUMBER~"\r\nStartFragment:"~NUMBER~"\r\nEndFragment:"~NUMBER~"\r\n"; - static const char[] PREFIX = "<html><body><!--StartFragment-->"; //$NON-NLS-1$ - static const char[] SUFFIX = "<!--EndFragment--></body></html>"; //$NON-NLS-1$ - static const char[] StartFragment = "StartFragment:"; //$NON-NLS-1$ - static const char[] EndFragment = "EndFragment:"; //$NON-NLS-1$ + static const String NUMBER = "00000000"; //$NON-NLS-1$ + static const String HEADER = "Version:0.9\r\nStartHTML:"~NUMBER~"\r\nEndHTML:"~NUMBER~"\r\nStartFragment:"~NUMBER~"\r\nEndFragment:"~NUMBER~"\r\n"; + static const String PREFIX = "<html><body><!--StartFragment-->"; //$NON-NLS-1$ + static const String SUFFIX = "<!--EndFragment--></body></html>"; //$NON-NLS-1$ + static const String StartFragment = "StartFragment:"; //$NON-NLS-1$ + static const String EndFragment = "EndFragment:"; //$NON-NLS-1$ static this(){ HTML_FORMATID = registerType(HTML_FORMAT); @@ -84,7 +84,7 @@ if (!checkHTML(object) || !isSupportedType(transferData)) { DND.error(DND.ERROR_INVALID_DATA); } - char[] string = ( cast(ArrayWrapperString)object ).array; + String string = ( cast(ArrayWrapperString)object ).array; int codePage = OS.GetACP(); int cchMultiByte = OS.WideCharToMultiByte(codePage, 0, StrToTCHARz(string), -1, null, 0, null, null); if (cchMultiByte is 0) { @@ -101,7 +101,7 @@ int maxLength = NUMBER.length; //startHTML int start = buffer.toString().indexOf(NUMBER); - char[] temp = Integer.toString(startHTML); + String temp = Integer.toString(startHTML); buffer.select(start + maxLength-temp.length, temp.length); buffer.replace(temp); buffer.select(); @@ -173,12 +173,12 @@ if (cchWideChar is 0) return null; wchar[] lpWideCharStr = new wchar [cchWideChar - 1]; OS.MultiByteToWideChar (codePage, OS.MB_PRECOMPOSED, lpMultiByteStr, -1, lpWideCharStr.ptr, lpWideCharStr.length); - char[] string = WCHARzToStr(lpWideCharStr.ptr); + String string = WCHARzToStr(lpWideCharStr.ptr); int fragmentStart = 0, fragmentEnd = 0; int start = string.indexOf(StartFragment) + StartFragment.length; int end = start + 1; while (end < string.length) { - char[] s = string.substring(start, end); + String s = string.substring(start, end); try { fragmentStart = Integer.parseInt(s); end++; @@ -189,7 +189,7 @@ start = string.indexOf(EndFragment) + EndFragment.length; end = start + 1; while (end < string.length) { - char[] s = string.substring(start, end); + String s = string.substring(start, end); try { fragmentEnd = Integer.parseInt(s); end++; @@ -202,11 +202,11 @@ * FragmentStart and FragmentEnd are offsets in original byte stream, not * the wide char version of the byte stream. */ - char[] s = string.substring(fragmentStart, fragmentEnd); + String s = string.substring(fragmentStart, fragmentEnd); /* * Firefox includes <!--StartFragment --> in the fragment, so remove it. */ - char[] foxStart = "<!--StartFragment -->\r\n"; //$NON-NLS-1$ + String foxStart = "<!--StartFragment -->\r\n"; //$NON-NLS-1$ int prefix = s.indexOf(foxStart); if (prefix !is -1) { prefix += foxStart.length; @@ -223,7 +223,7 @@ protected int[] getTypeIds(){ return [HTML_FORMATID]; } -protected char[][] getTypeNames(){ +protected String[] getTypeNames(){ return [HTML_FORMAT]; } bool checkHTML(Object object) {