Changeset 561 for trunk/src/activeqt/container/qaxbase.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/activeqt/container/qaxbase.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the ActiveQt framework of the Qt Toolkit. … … 40 41 //#define QAX_NO_CLASSINFO 41 42 42 #ifndef UNICODE43 #define UNICODE44 #endif45 46 43 #define QT_CHECK_STATE 47 44 … … 175 172 // get the Dispatch ID from the object 176 173 QString unicodeName = QLatin1String(name); 177 OLECHAR *names = ( TCHAR*)unicodeName.utf16();174 OLECHAR *names = (wchar_t*)unicodeName.utf16(); 178 175 disp->GetIDsOfNames(IID_NULL, &names, 1, LOCALE_USER_DEFAULT, &dispid); 179 176 if (dispid != DISPID_UNKNOWN) … … 422 419 } else { 423 420 argv[p + 1] = const_cast<void*>(varp[p + 1].constData()); 424 if (ptype.endsWith( "*")) {421 if (ptype.endsWith('*')) { 425 422 argv_pointer[p + 1] = argv[p + 1]; 426 423 argv[p + 1] = argv_pointer + p + 1; … … 639 636 typeinfo->GetNames(dispID, &names, 1, &cNames); 640 637 if (cNames) { 641 propname = QString::from Utf16((const ushort *)names).toLatin1();638 propname = QString::fromWCharArray(names).toLatin1(); 642 639 SysFreeString(names); 643 640 } … … 649 646 const QMetaProperty prop = mo->property(index); 650 647 propsignal += prop.typeName(); 651 propsignal += ")";648 propsignal += ')'; 652 649 addProperty(dispID, propname, propsignal); 653 650 … … 913 910 \brief the name of the COM object wrapped by this QAxBase object. 914 911 915 Setting this property initi lializes the COM object. Any COM object912 Setting this property initializes the COM object. Any COM object 916 913 previously set is shut down. 917 914 … … 973 970 if (uuid.isNull()) { 974 971 CLSID clsid; 975 HRESULT res = CLSIDFromProgID(( WCHAR*)c.utf16(), &clsid);972 HRESULT res = CLSIDFromProgID((wchar_t*)c.utf16(), &clsid); 976 973 if (res == S_OK) 977 974 search = QUuid(clsid).toString(); … … 1138 1135 if (!verb.lpszVerbName) 1139 1136 continue; 1140 QString verbName = QString::from Utf16((const ushort *)verb.lpszVerbName);1137 QString verbName = QString::fromWCharArray(verb.lpszVerbName); 1141 1138 if (!verbName.isEmpty()) 1142 1139 d->verbs.insert(verbName, verb.lVerb); … … 1266 1263 BSTR licenseKey; 1267 1264 factory2->RequestLicKey(0, &licenseKey); 1268 QString qlicenseKey = QString::from Utf16((const ushort *)licenseKey);1265 QString qlicenseKey = QString::fromWCharArray(licenseKey); 1269 1266 SysFreeString(licenseKey); 1270 1267 qWarning("Use license key is '%s' to create object on unlicensed machine.", … … 1276 1273 BSTR licenseKey; 1277 1274 factory2->RequestLicKey(0, &licenseKey); 1278 QString qlicenseKey = QString::from Utf16((const ushort *)licenseKey);1275 QString qlicenseKey = QString::fromWCharArray(licenseKey); 1279 1276 SysFreeString(licenseKey); 1280 1277 … … 1436 1433 serverInfo.dwReserved2 = 0; 1437 1434 serverInfo.pAuthInfo = &authInfo; 1438 serverInfo.pwszName = ( WCHAR*)server.utf16();1435 serverInfo.pwszName = (wchar_t*)server.utf16(); 1439 1436 1440 1437 IClassFactory *factory = 0; … … 1661 1658 void addProperty(const QByteArray &type, const QByteArray &name, uint flags) 1662 1659 { 1660 QByteArray propertyType(type); 1661 if (propertyType.endsWith('&')) 1662 propertyType.chop(1); 1663 1663 1664 Property &prop = property_list[name]; 1664 if (! type.isEmpty() && type != "HRESULT") {1665 prop.type = replaceType( type);1666 if (prop.type != type)1667 prop.realType = type;1665 if (!propertyType.isEmpty() && propertyType != "HRESULT") { 1666 prop.type = replaceType(propertyType); 1667 if (prop.type != propertyType) 1668 prop.realType = propertyType; 1668 1669 } 1669 1670 if (flags & Writable) … … 1744 1745 return 0; 1745 1746 1746 className = QString::from Utf16((const ushort *)bstr);1747 className = QString::fromWCharArray(bstr); 1747 1748 SysFreeString(bstr); 1748 1749 … … 1765 1766 return 0; 1766 1767 1767 className = QString::from Utf16((const ushort *)bstr);1768 className = QString::fromWCharArray(bstr); 1768 1769 SysFreeString(bstr); 1769 1770 … … 1792 1793 1793 1794 interfaceInfo->GetDocumentation(-1, &bstr, 0, 0, 0); 1794 QString interfaceName = QString::from Utf16((const ushort *)bstr);1795 QString interfaceName = QString::fromWCharArray(bstr); 1795 1796 SysFreeString(bstr); 1796 1797 QByteArray key; … … 1840 1841 BSTR bstr; 1841 1842 typelib->GetDocumentation(-1, &bstr, 0, 0, 0); 1842 current_typelib = QString::from Utf16((const ushort *)bstr).toLatin1();1843 current_typelib = QString::fromWCharArray(bstr).toLatin1(); 1843 1844 SysFreeString(bstr); 1844 1845 } … … 1888 1889 BSTR typelibname = 0; 1889 1890 usertypelib->GetDocumentation(-1, &typelibname, 0, 0, 0); 1890 QByteArray typeLibName = QString::from Utf16((const ushort *)typelibname).toLatin1();1891 QByteArray typeLibName = QString::fromWCharArray(typelibname).toLatin1(); 1891 1892 SysFreeString(typelibname); 1892 1893 … … 1894 1895 BSTR usertypename = 0; 1895 1896 usertypelib->GetDocumentation(index, &usertypename, 0, 0, 0); 1896 QByteArray userTypeName = QString::from Utf16((const ushort *)usertypename).toLatin1();1897 QByteArray userTypeName = QString::fromWCharArray(usertypename).toLatin1(); 1897 1898 SysFreeString(usertypename); 1898 1899 … … 2043 2044 case VT_UINT: 2044 2045 case VT_CY: 2045 str += "&";2046 str += '&'; 2046 2047 break; 2047 2048 case VT_PTR: 2048 2049 if (str == "QFont" || str == "QPixmap") { 2049 str += "&";2050 str += '&'; 2050 2051 break; 2051 2052 } else if (str == "void*") { … … 2056 2057 default: 2057 2058 if (str == "QColor") 2058 str += "&";2059 str += '&'; 2059 2060 else if (str == "QDateTime") 2060 str += "&";2061 str += '&'; 2061 2062 else if (str == "QVariantList") 2062 str += "&";2063 str += '&'; 2063 2064 else if (str == "QByteArray") 2064 str += "&";2065 str += '&'; 2065 2066 else if (str == "QStringList") 2066 str += "&";2067 str += '&'; 2067 2068 else if (!str.isEmpty() && hasEnum(str)) 2068 str += "&";2069 str += '&'; 2069 2070 else if (!str.isEmpty() && str != "QFont" && str != "QPixmap" && str != "QVariant") 2070 str += "*";2071 str += '*'; 2071 2072 } 2072 2073 break; … … 2086 2087 str = guessTypes(tdesc.lpadesc->tdescElem, info, function); 2087 2088 if (!str.isEmpty()) 2088 str = "QList<" + str + ">";2089 str = "QList<" + str + '>'; 2089 2090 break; 2090 2091 } … … 2094 2095 if (!str.isEmpty()) { 2095 2096 for (int index = 0; index < tdesc.lpadesc->cDims; ++index) 2096 str += "[" + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + "]";2097 str += '[' + QByteArray::number((int)tdesc.lpadesc->rgbounds[index].cElements) + ']'; 2097 2098 } 2098 2099 break; … … 2111 2112 2112 2113 if (tdesc.vt & VT_BYREF) 2113 str += "&";2114 str += '&'; 2114 2115 2115 2116 str.replace("&*", "**"); … … 2138 2139 QString coClassIDstr = iidnames.value(QLatin1String("/CLSID/") + coClassID + QLatin1String("/Default"), coClassID).toString(); 2139 2140 addClassInfo("CoClass", coClassIDstr.isEmpty() ? coClassID.toLatin1() : coClassIDstr.toLatin1()); 2140 QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + "."+ QByteArray::number(typeattr->wMinorVerNum);2141 QByteArray version = QByteArray::number(typeattr->wMajorVerNum) + '.' + QByteArray::number(typeattr->wMinorVerNum); 2141 2142 if (version != "0.0") 2142 2143 addClassInfo("Version", version); … … 2171 2172 QString version = *vit; 2172 2173 ++vit; 2173 tlfile = controls.value(QLatin1 String("/") + version + QLatin1String("/0/win32/.")).toString();2174 tlfile = controls.value(QLatin1Char('/') + version + QLatin1String("/0/win32/.")).toString(); 2174 2175 } 2175 2176 controls.endGroup(); … … 2284 2285 QByteArray enumName; 2285 2286 if (typelib->GetDocumentation(i, &enumname, 0, 0, 0) == S_OK) { 2286 enumName = QString::from Utf16((const ushort *)enumname).toLatin1();2287 enumName = QString::fromWCharArray(enumname).toLatin1(); 2287 2288 SysFreeString(enumname); 2288 2289 } else { … … 2307 2308 enuminfo->GetNames(memid, &valuename, 1, &maxNamesOut); 2308 2309 if (maxNamesOut) { 2309 valueName = QString::from Utf16((const ushort *)valuename).toLatin1();2310 valueName = QString::fromWCharArray(valuename).toLatin1(); 2310 2311 SysFreeString(valuename); 2311 2312 } else { … … 2344 2345 QByteArray signalName(function); 2345 2346 signalName += "Changed"; 2346 QByteArray signalProto = signalName + "(" + replaceType(type) + ")";2347 QByteArray signalProto = signalName + '(' + replaceType(type) + ')'; 2347 2348 if (!hasSignal(signalProto)) 2348 2349 addSignal(signalProto, function); … … 2361 2362 prototype[0] = toupper(prototype[0]); 2362 2363 } 2363 prototype = set + prototype + "(" + propertyType(property) + ")";2364 prototype = set + prototype + '(' + propertyType(property) + ')'; 2364 2365 if (!hasSlot(prototype)) 2365 2366 addSlot(0, prototype, property); … … 2378 2379 } 2379 2380 2380 prototype = function + "(";2381 prototype = function + '('; 2381 2382 if (funcdesc->invkind == INVOKE_FUNC && type == hresult) 2382 2383 type = 0; … … 2392 2393 QByteArray ptype = guessTypes(tdesc, typeinfo, function); 2393 2394 if (pdesc.wParamFlags & PARAMFLAG_FRETVAL) { 2394 if (ptype.endsWith( "&")) {2395 if (ptype.endsWith('&')) { 2395 2396 ptype.truncate(ptype.length() - 1); 2396 2397 } else if (ptype.endsWith("**")) { … … 2400 2401 } else { 2401 2402 prototype += ptype; 2402 if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith( "&") && !ptype.endsWith("**"))2403 prototype += "&";2403 if (pdesc.wParamFlags & PARAMFLAG_FOUT && !ptype.endsWith('&') && !ptype.endsWith("**")) 2404 prototype += '&'; 2404 2405 if (optional || pdesc.wParamFlags & PARAMFLAG_FOPT) 2405 2406 paramName += "=0"; … … 2411 2412 } 2412 2413 if (p < funcdesc->cParams && !(pdesc.wParamFlags & PARAMFLAG_FRETVAL)) 2413 prototype += ",";2414 prototype += ','; 2414 2415 } 2415 2416 2416 2417 if (!prototype.isEmpty()) { 2417 if (prototype. right(1) == ",") {2418 if (prototype.endsWith(',')) { 2418 2419 if (funcdesc->invkind == INVOKE_PROPERTYPUT && p == funcdesc->cParams) { 2419 2420 TYPEDESC tdesc = funcdesc->lprgelemdescParam[p-1].tdesc; 2420 2421 QByteArray ptype = guessTypes(tdesc, typeinfo, function); 2421 2422 prototype += ptype; 2422 prototype += ")";2423 prototype += ')'; 2423 2424 parameters << "rhs"; 2424 2425 } else { … … 2426 2427 } 2427 2428 } else { 2428 prototype += ")";2429 prototype += ')'; 2429 2430 } 2430 2431 } … … 2464 2465 int p; 2465 2466 for (p = 0; p < (int)maxNamesOut; ++p) { 2466 names << QString::from Utf16((const ushort *)bstrNames[p]).toLatin1();2467 names << QString::fromWCharArray(bstrNames[p]).toLatin1(); 2467 2468 SysFreeString(bstrNames[p]); 2468 2469 } … … 2574 2575 if (defargs) { 2575 2576 parameters.takeLast(); 2576 int lastParam = prototype.lastIndexOf( ",");2577 int lastParam = prototype.lastIndexOf(','); 2577 2578 if (lastParam == -1) 2578 lastParam = prototype.indexOf( "(") + 1;2579 lastParam = prototype.indexOf('(') + 1; 2579 2580 prototype.truncate(lastParam); 2580 prototype += ")";2581 prototype += ')'; 2581 2582 } 2582 2583 } while (defargs); … … 2591 2592 BSTR bstrDocu; 2592 2593 info->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); 2593 QString strDocu = QString::from Utf16((const ushort*)bstrDocu);2594 QString strDocu = QString::fromWCharArray(bstrDocu); 2594 2595 SysFreeString(bstrDocu); 2595 2596 if (!!strDocu) 2596 desc += "[" + strDocu + "]";2597 desc += "\n";2597 desc += '[' + strDocu + ']'; 2598 desc += '\n'; 2598 2599 #endif 2599 2600 typeinfo->ReleaseFuncDesc(funcdesc); … … 2638 2639 uint flags = 0; 2639 2640 2640 variableName = QString::from Utf16((const ushort *)bstrName).toLatin1();2641 variableName = QString::fromWCharArray(bstrName).toLatin1(); 2641 2642 SysFreeString(bstrName); 2642 2643 … … 2674 2675 BSTR bstrDocu; 2675 2676 info->GetDocumentation(vardesc->memid, 0, &bstrDocu, 0, 0); 2676 QString strDocu = QString::from Utf16((const ushort*)bstrDocu);2677 QString strDocu = QString::fromWCharArray(bstrDocu); 2677 2678 SysFreeString(bstrDocu); 2678 2679 if (!!strDocu) 2679 desc += "[" + strDocu + "]";2680 desc += "\n";2680 desc += '[' + strDocu + ']'; 2681 desc += '\n'; 2681 2682 #endif 2682 2683 typeinfo->ReleaseVarDesc(vardesc); … … 2797 2798 int p; 2798 2799 for (p = 0; p < (int)maxNamesOut; ++p) { 2799 names << QString::from Utf16((const ushort *)bstrNames[p]).toLatin1();2800 names << QString::fromWCharArray(bstrNames[p]).toLatin1(); 2800 2801 SysFreeString(bstrNames[p]); 2801 2802 } … … 2821 2822 BSTR bstrDocu; 2822 2823 eventinfo->GetDocumentation(funcdesc->memid, 0, &bstrDocu, 0, 0); 2823 QString strDocu = QString::from Utf16((const ushort*)bstrDocu);2824 QString strDocu = QString::fromWCharArray(bstrDocu); 2824 2825 SysFreeString(bstrDocu); 2825 2826 if (!!strDocu) 2826 desc += "[" + strDocu + "]";2827 desc += "\n";2827 desc += '[' + strDocu + ']'; 2828 desc += '\n'; 2828 2829 #endif 2829 2830 eventinfo->ReleaseFuncDesc(funcdesc); … … 2979 2980 BSTR bstr; 2980 2981 typelib->GetDocumentation(-1, &bstr, 0, 0, 0); 2981 current_typelib = QString::from Utf16((const ushort *)bstr).toLatin1();2982 current_typelib = QString::fromWCharArray(bstr).toLatin1(); 2982 2983 SysFreeString(bstr); 2983 2984 } … … 3205 3206 3206 3207 static QMetaObject qaxobject_staticMetaObject = { 3207 &QObject::staticMetaObject, qt_meta_stringdata_QAxBase,3208 qt_meta_data_QAxBase, 0 3208 { &QObject::staticMetaObject, qt_meta_stringdata_QAxBase, 3209 qt_meta_data_QAxBase, 0 } 3209 3210 }; 3210 3211 static QMetaObject qaxwidget_staticMetaObject = { 3211 &QWidget::staticMetaObject, qt_meta_stringdata_QAxBase,3212 qt_meta_data_QAxBase, 0 3212 { &QWidget::staticMetaObject, qt_meta_stringdata_QAxBase, 3213 qt_meta_data_QAxBase, 0 } 3213 3214 }; 3214 3215 … … 3388 3389 3389 3390 code = exc->wCode ? exc->wCode : exc->scode; 3390 source = QString::from Utf16((const ushort *)exc->bstrSource);3391 desc = QString::from Utf16((const ushort *)exc->bstrDescription);3392 help = QString::from Utf16((const ushort *)exc->bstrHelpFile);3391 source = QString::fromWCharArray(exc->bstrSource); 3392 desc = QString::fromWCharArray(exc->bstrDescription); 3393 help = QString::fromWCharArray(exc->bstrHelpFile); 3393 3394 uint helpContext = exc->dwHelpContext; 3394 3395 … … 3693 3694 id = internalInvoke(call, id, v); 3694 3695 break; 3696 default: 3697 break; 3695 3698 } 3696 3699 break; … … 3706 3709 case QMetaObject::QueryPropertyUser: 3707 3710 id -= mo->propertyCount(); 3711 break; 3712 default: 3708 3713 break; 3709 3714 } … … 3906 3911 paramType = d->metaobj->paramType(normFunction, i, &out); 3907 3912 3908 if ( !parse && d->useMetaObject && var.type() == QVariant::String|| var.type() == QVariant::ByteArray) {3913 if ((!parse && d->useMetaObject && var.type() == QVariant::String) || var.type() == QVariant::ByteArray) { 3909 3914 int enumIndex =mo->indexOfEnumerator(paramType); 3910 3915 if (enumIndex != -1) { … … 4225 4230 return E_POINTER; 4226 4231 4227 QString property = QString::from Utf16((const ushort *)name);4232 QString property = QString::fromWCharArray(name); 4228 4233 QVariant qvar = map.value(property); 4229 4234 QVariantToVARIANT(qvar, *var); … … 4234 4239 if (!var) 4235 4240 return E_POINTER; 4236 QString property = QString::from Utf16((const ushort *)name);4241 QString property = QString::fromWCharArray(name); 4237 4242 QVariant qvar = VARIANTToQVariant(*var, 0); 4238 4243 map[property] = qvar; … … 4395 4400 QObject *object = qObject(); 4396 4401 if (QMetaType::type(cn)) 4397 qvar = QVariant(qRegisterMetaType<QObject*>(cn + "*"), &object);4398 // qVariantSetValue(qvar, qObject(), cn + "*");4402 qvar = QVariant(qRegisterMetaType<QObject*>(cn + '*'), &object); 4403 // qVariantSetValue(qvar, qObject(), cn + '*'); 4399 4404 } 4400 4405
Note:
See TracChangeset
for help on using the changeset viewer.