Mercurial > projects > dwt-win
diff dwt/ole/win32/OLE.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 | 619faee45ef6 |
children |
line wrap: on
line diff
--- a/dwt/ole/win32/OLE.d Sat Apr 26 10:01:48 2008 +0200 +++ b/dwt/ole/win32/OLE.d Mon May 05 00:12:38 2008 +0200 @@ -38,8 +38,8 @@ public static const int E_NOINTERFACE = -2147467262; // QueryInterface did not recognize the requested interface. public static const int E_NOTIMPL = -2147467263; // Not implemented - public static const char[] IID_IUNKNOWN = "{00000000-0000-0000-C000-000000000046}"; //$NON-NLS-1$ - public static const char[] IID_IDISPATCH = "{00020400-0000-0000-C000-000000000046}"; //$NON-NLS-1$ + public static const String IID_IUNKNOWN = "{00000000-0000-0000-C000-000000000046}"; //$NON-NLS-1$ + public static const String IID_IDISPATCH = "{00020400-0000-0000-C000-000000000046}"; //$NON-NLS-1$ // Verbs that can be invoked on this client public static const int OLEIVERB_DISCARDUNDOSTATE = -6; // close the OLE object and discard the undo state @@ -269,28 +269,28 @@ public static const int CC_MPWPASCAL = 8; public static const int CC_MAX = 9; - static const char[] ERROR_NOT_IMPLEMENTED_MSG = "Required functionality not currently supported.";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_CREATE_FILE_MSG = "Failed to create file.";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_CREATE_OBJECT_MSG = "Failed to create Ole Client.";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_OPEN_FILE_MSG = "File does not exist, is not accessible to user or does not have the correct format.";//$NON-NLS-1$ - static const char[] ERROR_INTERFACE_NOT_FOUND_MSG = "Failed to find requested interface on OLE Object.";//$NON-NLS-1$ - static const char[] ERROR_INVALID_CLASSID_MSG = "Class ID not found in registry";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG = "Failed to get the class factory for the specified classID";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG = "Failed to create Licensed instance";//$NON-NLS-1$ - static const char[] ERROR_OUT_OF_MEMORY_MSG = "Out of Memory";//$NON-NLS-1$ - static const char[] ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG = "Failed to change Variant type";//$NON-NLS-1$ - static const char[] ERROR_INVALID_INTERFACE_ADDRESS_MSG = "Invalid address received for Ole Interface.";//$NON-NLS-1$ - static const char[] ERROR_APPLICATION_NOT_FOUND_MSG = "Unable to find Application.";//$NON-NLS-1$ - static const char[] ERROR_ACTION_NOT_PERFORMED_MSG = "Action can not be performed.";//$NON-NLS-1$ + static const String ERROR_NOT_IMPLEMENTED_MSG = "Required functionality not currently supported.";//$NON-NLS-1$ + static const String ERROR_CANNOT_CREATE_FILE_MSG = "Failed to create file.";//$NON-NLS-1$ + static const String ERROR_CANNOT_CREATE_OBJECT_MSG = "Failed to create Ole Client.";//$NON-NLS-1$ + static const String ERROR_CANNOT_OPEN_FILE_MSG = "File does not exist, is not accessible to user or does not have the correct format.";//$NON-NLS-1$ + static const String ERROR_INTERFACE_NOT_FOUND_MSG = "Failed to find requested interface on OLE Object.";//$NON-NLS-1$ + static const String ERROR_INVALID_CLASSID_MSG = "Class ID not found in registry";//$NON-NLS-1$ + static const String ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG = "Failed to get the class factory for the specified classID";//$NON-NLS-1$ + static const String ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG = "Failed to create Licensed instance";//$NON-NLS-1$ + static const String ERROR_OUT_OF_MEMORY_MSG = "Out of Memory";//$NON-NLS-1$ + static const String ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG = "Failed to change Variant type";//$NON-NLS-1$ + static const String ERROR_INVALID_INTERFACE_ADDRESS_MSG = "Invalid address received for Ole Interface.";//$NON-NLS-1$ + static const String ERROR_APPLICATION_NOT_FOUND_MSG = "Unable to find Application.";//$NON-NLS-1$ + static const String ERROR_ACTION_NOT_PERFORMED_MSG = "Action can not be performed.";//$NON-NLS-1$ -public static void error (char[] file, long line, int code) { +public static void error (String file, long line, int code) { error (code, 0); } public static void error (int code) { error (code, 0); } -public static void error (char[] file, long line, int code, int hresult) { +public static void error (String file, long line, int code, int hresult) { error (code, hresult); } public static void error (int code, int hresult) { @@ -303,60 +303,60 @@ /* DWT Errors (non-fatal) */ case ERROR_CANNOT_CREATE_FILE : { - char[] msg = ERROR_CANNOT_CREATE_FILE_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_CREATE_FILE_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_CANNOT_CREATE_OBJECT : { - char[] msg = ERROR_CANNOT_CREATE_OBJECT_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_CREATE_OBJECT_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg);//$NON-NLS-1$ } case ERROR_CANNOT_OPEN_FILE : { - char[] msg = ERROR_CANNOT_OPEN_FILE_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_OPEN_FILE_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_INTERFACE_NOT_FOUND : { - char[] msg = ERROR_INTERFACE_NOT_FOUND_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_INTERFACE_NOT_FOUND_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_INVALID_CLASSID : { - char[] msg = ERROR_INVALID_CLASSID_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_INVALID_CLASSID_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_CANNOT_ACCESS_CLASSFACTORY : { - char[] msg = ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_ACCESS_CLASSFACTORY_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_CANNOT_CREATE_LICENSED_OBJECT : { - char[] msg = ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_CREATE_LICENSED_OBJECT_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_CANNOT_CHANGE_VARIANT_TYPE : { - char[] msg = ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_CANNOT_CHANGE_VARIANT_TYPE_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_APPLICATION_NOT_FOUND : { - char[] msg = ERROR_APPLICATION_NOT_FOUND_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_APPLICATION_NOT_FOUND_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } case ERROR_ACTION_NOT_PERFORMED : { - char[] msg = ERROR_ACTION_NOT_PERFORMED_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult);//$NON-NLS-1$ + String msg = ERROR_ACTION_NOT_PERFORMED_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult);//$NON-NLS-1$ throw new DWTException (code, msg); } /* OS Failure/Limit (fatal, may occur only on some platforms) */ case ERROR_OUT_OF_MEMORY : { - char[] msg = ERROR_ACTION_NOT_PERFORMED_MSG; - if (hresult !is 0) msg ~= " result = "~to!(char[])(hresult); //$NON-NLS-1$ + String msg = ERROR_ACTION_NOT_PERFORMED_MSG; + if (hresult !is 0) msg ~= " result = "~to!(String)(hresult); //$NON-NLS-1$ throw new DWTError (code, msg); } default: @@ -378,7 +378,7 @@ * <li>ERROR_NULL_ARGUMENT when extension is null</li> * </ul> */ -public static char[] findProgramID (char[] extension) { +public static String findProgramID (String extension) { if (extension is null) DWT.error (DWT.ERROR_NULL_ARGUMENT); if (extension.length is 0) return ""; //$NON-NLS-1$ @@ -386,7 +386,7 @@ /* Use the character encoding for the default locale */ TCHAR[] extensionKey = StrToTCHARs(0, extension, true); - char[] result = getKeyValue(extensionKey); + String result = getKeyValue(extensionKey); if (result !is null) { // look for "<programID>\NotInsertable" TCHAR[] notInsertableKey = StrToTCHARs(0, result~"\\NotInsertable", true); //$NON-NLS-1$ @@ -401,12 +401,12 @@ return ""; //$NON-NLS-1$ } -static char[] getKeyValue (TCHAR[] key) { +static String getKeyValue (TCHAR[] key) { void* [1] phkResult; if (OS.RegOpenKeyEx (cast(void*)OS.HKEY_CLASSES_ROOT, key.ptr, 0, OS.KEY_READ, phkResult.ptr) !is 0) { return null; } - char[] result = null; + String result = null; uint [1] lpcbData; if (OS.RegQueryValueEx (phkResult [0], null, null, null, null, lpcbData.ptr) is 0) { int length_ = lpcbData [0] / TCHAR.sizeof;