Don't use QStringLiteral in comparisons
For QLatin1String, operator== is overloaded, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I761b2b26ab5b416bc695f524a9ee607dacf0a7b2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
58f8dd4f92
commit
0f27d11285
@ -121,14 +121,14 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
|
|||||||
bool haveDirectConnection = false;
|
bool haveDirectConnection = false;
|
||||||
foreach (const QUrl& url, rawProxies) {
|
foreach (const QUrl& url, rawProxies) {
|
||||||
QNetworkProxy::ProxyType type;
|
QNetworkProxy::ProxyType type;
|
||||||
if (url.scheme() == QStringLiteral("http")) {
|
if (url.scheme() == QLatin1String("http")) {
|
||||||
type = QNetworkProxy::HttpProxy;
|
type = QNetworkProxy::HttpProxy;
|
||||||
} else if (url.scheme() == QStringLiteral("socks")
|
} else if (url.scheme() == QLatin1String("socks")
|
||||||
|| url.scheme() == QStringLiteral("socks5")) {
|
|| url.scheme() == QLatin1String("socks5")) {
|
||||||
type = QNetworkProxy::Socks5Proxy;
|
type = QNetworkProxy::Socks5Proxy;
|
||||||
} else if (url.scheme() == QStringLiteral("ftp")) {
|
} else if (url.scheme() == QLatin1String("ftp")) {
|
||||||
type = QNetworkProxy::FtpCachingProxy;
|
type = QNetworkProxy::FtpCachingProxy;
|
||||||
} else if (url.scheme() == QStringLiteral("direct")) {
|
} else if (url.scheme() == QLatin1String("direct")) {
|
||||||
type = QNetworkProxy::NoProxy;
|
type = QNetworkProxy::NoProxy;
|
||||||
haveDirectConnection = true;
|
haveDirectConnection = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1961,71 +1961,71 @@ namespace
|
|||||||
// https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes"
|
// https://bugzilla.gnome.org/show_bug.cgi?id=744553 "ATK docs provide no guidance for allowed values of some text attributes"
|
||||||
// specifically for "weight", "invalid", "language" and value range for colors
|
// specifically for "weight", "invalid", "language" and value range for colors
|
||||||
|
|
||||||
if (ia2Name == QStringLiteral("background-color")) {
|
if (ia2Name == QLatin1String("background-color")) {
|
||||||
name = QStringLiteral("bg-color");
|
name = QStringLiteral("bg-color");
|
||||||
value = atspiColor(value);
|
value = atspiColor(value);
|
||||||
} else if (ia2Name == QStringLiteral("font-family")) {
|
} else if (ia2Name == QLatin1String("font-family")) {
|
||||||
name = QStringLiteral("family-name");
|
name = QStringLiteral("family-name");
|
||||||
} else if (ia2Name == QStringLiteral("color")) {
|
} else if (ia2Name == QLatin1String("color")) {
|
||||||
name = QStringLiteral("fg-color");
|
name = QStringLiteral("fg-color");
|
||||||
value = atspiColor(value);
|
value = atspiColor(value);
|
||||||
} else if (ia2Name == QStringLiteral("text-align")) {
|
} else if (ia2Name == QLatin1String("text-align")) {
|
||||||
name = QStringLiteral("justification");
|
name = QStringLiteral("justification");
|
||||||
if (value == QStringLiteral("justify")) {
|
if (value == QLatin1String("justify")) {
|
||||||
value = QStringLiteral("fill");
|
value = QStringLiteral("fill");
|
||||||
} else {
|
} else {
|
||||||
if (value != QStringLiteral("left") &&
|
if (value != QLatin1String("left") &&
|
||||||
value != QStringLiteral("right") &&
|
value != QLatin1String("right") &&
|
||||||
value != QStringLiteral("center")
|
value != QLatin1String("center")
|
||||||
) {
|
) {
|
||||||
value = QString();
|
value = QString();
|
||||||
qAtspiDebug() << "Unknown text-align attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
qAtspiDebug() << "Unknown text-align attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (ia2Name == QStringLiteral("font-size")) {
|
} else if (ia2Name == QLatin1String("font-size")) {
|
||||||
name = QStringLiteral("size");
|
name = QStringLiteral("size");
|
||||||
value = atspiSize(value);
|
value = atspiSize(value);
|
||||||
} else if (ia2Name == QStringLiteral("font-style")) {
|
} else if (ia2Name == QLatin1String("font-style")) {
|
||||||
name = QStringLiteral("style");
|
name = QStringLiteral("style");
|
||||||
if (value != QStringLiteral("normal") &&
|
if (value != QLatin1String("normal") &&
|
||||||
value != QStringLiteral("italic") &&
|
value != QLatin1String("italic") &&
|
||||||
value != QStringLiteral("oblique")
|
value != QLatin1String("oblique")
|
||||||
) {
|
) {
|
||||||
value = QString();
|
value = QString();
|
||||||
qAtspiDebug() << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
qAtspiDebug() << "Unknown font-style attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
||||||
}
|
}
|
||||||
} else if (ia2Name == QStringLiteral("text-underline-type")) {
|
} else if (ia2Name == QLatin1String("text-underline-type")) {
|
||||||
name = QStringLiteral("underline");
|
name = QStringLiteral("underline");
|
||||||
if (value != QStringLiteral("none") &&
|
if (value != QLatin1String("none") &&
|
||||||
value != QStringLiteral("single") &&
|
value != QLatin1String("single") &&
|
||||||
value != QStringLiteral("double")
|
value != QLatin1String("double")
|
||||||
) {
|
) {
|
||||||
value = QString();
|
value = QString();
|
||||||
qAtspiDebug() << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
qAtspiDebug() << "Unknown text-underline-type attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
||||||
}
|
}
|
||||||
} else if (ia2Name == QStringLiteral("font-weight")) {
|
} else if (ia2Name == QLatin1String("font-weight")) {
|
||||||
name = QStringLiteral("weight");
|
name = QStringLiteral("weight");
|
||||||
if (value == QStringLiteral("normal"))
|
if (value == QLatin1String("normal"))
|
||||||
// Orca seems to accept all IAccessible2 values except for "normal"
|
// Orca seems to accept all IAccessible2 values except for "normal"
|
||||||
// (on which it produces traceback and fails to read any following text attributes),
|
// (on which it produces traceback and fails to read any following text attributes),
|
||||||
// but that is the default value, so omit it anyway
|
// but that is the default value, so omit it anyway
|
||||||
value = QString();
|
value = QString();
|
||||||
} else if (ia2Name == QStringLiteral("text-position")) {
|
} else if (ia2Name == QLatin1String("text-position")) {
|
||||||
name = QStringLiteral("vertical-align");
|
name = QStringLiteral("vertical-align");
|
||||||
if (value != QStringLiteral("baseline") &&
|
if (value != QLatin1String("baseline") &&
|
||||||
value != QStringLiteral("super") &&
|
value != QLatin1String("super") &&
|
||||||
value != QStringLiteral("sub")
|
value != QLatin1String("sub")
|
||||||
) {
|
) {
|
||||||
value = QString();
|
value = QString();
|
||||||
qAtspiDebug() << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
qAtspiDebug() << "Unknown text-position attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
||||||
}
|
}
|
||||||
} else if (ia2Name == QStringLiteral("writing-mode")) {
|
} else if (ia2Name == QLatin1String("writing-mode")) {
|
||||||
name = QStringLiteral("direction");
|
name = QStringLiteral("direction");
|
||||||
if (value == QStringLiteral("lr"))
|
if (value == QLatin1String("lr"))
|
||||||
value = QStringLiteral("ltr");
|
value = QStringLiteral("ltr");
|
||||||
else if (value == QStringLiteral("rl"))
|
else if (value == QLatin1String("rl"))
|
||||||
value = QStringLiteral("rtl");
|
value = QStringLiteral("rtl");
|
||||||
else if (value == QStringLiteral("tb")) {
|
else if (value == QLatin1String("tb")) {
|
||||||
// IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet))
|
// IAccessible2 docs refer to XSL, which specifies "tb" is shorthand for "tb-rl"; so at least give a hint about the horizontal direction (ATK does not support vertical direction in this attribute (yet))
|
||||||
value = QStringLiteral("rtl");
|
value = QStringLiteral("rtl");
|
||||||
qAtspiDebug() << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
|
qAtspiDebug() << "writing-mode attribute value \"tb\" translated only w.r.t. horizontal direction; vertical direction ignored";
|
||||||
@ -2033,9 +2033,9 @@ namespace
|
|||||||
value = QString();
|
value = QString();
|
||||||
qAtspiDebug() << "Unknown writing-mode attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
qAtspiDebug() << "Unknown writing-mode attribute value \"" << value << "\" cannot be translated to AT-SPI.";
|
||||||
}
|
}
|
||||||
} else if (ia2Name == QStringLiteral("language")) {
|
} else if (ia2Name == QLatin1String("language")) {
|
||||||
// OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now
|
// OK - ATK has no docs on the format of the value, IAccessible2 has reasonable format - leave it at that now
|
||||||
} else if (ia2Name == QStringLiteral("invalid")) {
|
} else if (ia2Name == QLatin1String("invalid")) {
|
||||||
// OK - ATK docs are vague but suggest they support the same range of values as IAccessible2
|
// OK - ATK docs are vague but suggest they support the same range of values as IAccessible2
|
||||||
} else {
|
} else {
|
||||||
// attribute we know nothing about
|
// attribute we know nothing about
|
||||||
|
@ -1030,17 +1030,17 @@ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const
|
|||||||
|
|
||||||
QString bearer = i.value()->bearer();
|
QString bearer = i.value()->bearer();
|
||||||
|
|
||||||
if (bearer == QStringLiteral("gsm")) {
|
if (bearer == QLatin1String("gsm")) {
|
||||||
return QNetworkConfiguration::Bearer2G;
|
return QNetworkConfiguration::Bearer2G;
|
||||||
} else if (bearer == QStringLiteral("edge")) {
|
} else if (bearer == QLatin1String("edge")) {
|
||||||
return QNetworkConfiguration::Bearer2G;
|
return QNetworkConfiguration::Bearer2G;
|
||||||
} else if (bearer == QStringLiteral("umts")) {
|
} else if (bearer == QLatin1String("umts")) {
|
||||||
return QNetworkConfiguration::BearerWCDMA;
|
return QNetworkConfiguration::BearerWCDMA;
|
||||||
} else if (bearer == QStringLiteral("hspa")
|
} else if (bearer == QLatin1String("hspa")
|
||||||
|| bearer == QStringLiteral("hsdpa")
|
|| bearer == QLatin1String("hsdpa")
|
||||||
|| bearer == QStringLiteral("hsupa")) {
|
|| bearer == QLatin1String("hsupa")) {
|
||||||
return QNetworkConfiguration::BearerHSPA;
|
return QNetworkConfiguration::BearerHSPA;
|
||||||
} else if (bearer == QStringLiteral("lte")) {
|
} else if (bearer == QLatin1String("lte")) {
|
||||||
return QNetworkConfiguration::BearerLTE;
|
return QNetworkConfiguration::BearerLTE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
|
|||||||
i.next();
|
i.next();
|
||||||
propertyMap.insert(i.key(),i.value());
|
propertyMap.insert(i.key(),i.value());
|
||||||
|
|
||||||
if (i.key() == QStringLiteral("State")) {
|
if (i.key() == QLatin1String("State")) {
|
||||||
quint32 state = i.value().toUInt();
|
quint32 state = i.value().toUInt();
|
||||||
if (state == NM_DEVICE_STATE_ACTIVATED
|
if (state == NM_DEVICE_STATE_ACTIVATED
|
||||||
|| state == NM_DEVICE_STATE_DISCONNECTED
|
|| state == NM_DEVICE_STATE_DISCONNECTED
|
||||||
@ -223,7 +223,7 @@ void QNetworkManagerInterface::propertiesSwap(QMap<QString,QVariant> map)
|
|||||||
Q_EMIT propertiesChanged(map);
|
Q_EMIT propertiesChanged(map);
|
||||||
Q_EMIT stateChanged(state);
|
Q_EMIT stateChanged(state);
|
||||||
}
|
}
|
||||||
} else if (i.key() == QStringLiteral("ActiveConnections")) {
|
} else if (i.key() == QLatin1String("ActiveConnections")) {
|
||||||
Q_EMIT propertiesChanged(map);
|
Q_EMIT propertiesChanged(map);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,7 +418,7 @@ void QNetworkManagerInterfaceDevice::propertiesSwap(QMap<QString,QVariant> map)
|
|||||||
QMapIterator<QString, QVariant> i(map);
|
QMapIterator<QString, QVariant> i(map);
|
||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
if (i.key() == QStringLiteral("AvailableConnections")) { //Device
|
if (i.key() == QLatin1String("AvailableConnections")) { //Device
|
||||||
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
|
const QDBusArgument &dbusArgs = i.value().value<QDBusArgument>();
|
||||||
QDBusObjectPath path;
|
QDBusObjectPath path;
|
||||||
QStringList paths;
|
QStringList paths;
|
||||||
@ -514,9 +514,8 @@ void QNetworkManagerInterfaceDeviceWired::propertiesSwap(QMap<QString,QVariant>
|
|||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
propertyMap.insert(i.key(),i.value());
|
propertyMap.insert(i.key(),i.value());
|
||||||
if (i.key() == QStringLiteral("Carrier")) {
|
if (i.key() == QLatin1String("Carrier"))
|
||||||
Q_EMIT carrierChanged(i.value().toBool());
|
Q_EMIT carrierChanged(i.value().toBool());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Q_EMIT propertiesChanged(map);
|
Q_EMIT propertiesChanged(map);
|
||||||
}
|
}
|
||||||
@ -693,9 +692,8 @@ void QNetworkManagerInterfaceDeviceWireless::propertiesSwap(QMap<QString,QVarian
|
|||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
propertyMap.insert(i.key(),i.value());
|
propertyMap.insert(i.key(),i.value());
|
||||||
if (i.key() == QStringLiteral("ActiveAccessPoint")) { //DeviceWireless
|
if (i.key() == QLatin1String("ActiveAccessPoint")) //DeviceWireless
|
||||||
Q_EMIT propertiesChanged(map);
|
Q_EMIT propertiesChanged(map);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1051,7 +1049,7 @@ void QNetworkManagerConnectionActive::propertiesSwap(QMap<QString,QVariant> map)
|
|||||||
while (i.hasNext()) {
|
while (i.hasNext()) {
|
||||||
i.next();
|
i.next();
|
||||||
propertyMap.insert(i.key(),i.value());
|
propertyMap.insert(i.key(),i.value());
|
||||||
if (i.key() == QStringLiteral("State")) {
|
if (i.key() == QLatin1String("State")) {
|
||||||
quint32 state = i.value().toUInt();
|
quint32 state = i.value().toUInt();
|
||||||
if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|
if (state == NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|
||||||
|| state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
|
|| state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATED) {
|
||||||
|
@ -86,9 +86,9 @@ QMimeData *QHaikuClipboard::mimeData(QClipboard::Mode mode)
|
|||||||
const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
|
const status_t status = clipboard->FindData(name, B_MIME_TYPE, &data, &dataLen);
|
||||||
if (dataLen && (status == B_OK)) {
|
if (dataLen && (status == B_OK)) {
|
||||||
const QString format = QString::fromLatin1(name);
|
const QString format = QString::fromLatin1(name);
|
||||||
if (format == QStringLiteral("text/plain")) {
|
if (format == QLatin1String("text/plain")) {
|
||||||
m_systemMimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
|
m_systemMimeData->setText(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
|
||||||
} else if (format == QStringLiteral("text/html")) {
|
} else if (format == QLatin1String("text/html")) {
|
||||||
m_systemMimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
|
m_systemMimeData->setHtml(QString::fromLocal8Bit(reinterpret_cast<const char*>(data), dataLen));
|
||||||
} else {
|
} else {
|
||||||
m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen));
|
m_systemMimeData->setData(format, QByteArray(reinterpret_cast<const char*>(data), dataLen));
|
||||||
|
@ -1613,7 +1613,7 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request)
|
|||||||
if (fam.isEmpty())
|
if (fam.isEmpty())
|
||||||
fam = QStringLiteral("MS Sans Serif");
|
fam = QStringLiteral("MS Sans Serif");
|
||||||
|
|
||||||
if ((fam == QStringLiteral("MS Sans Serif"))
|
if (fam == QLatin1String("MS Sans Serif")
|
||||||
&& (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) {
|
&& (request.style == QFont::StyleItalic || (-lf.lfHeight > 18 && -lf.lfHeight != 24))) {
|
||||||
fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale
|
fam = QStringLiteral("Arial"); // MS Sans Serif has bearing problems in italic, and does not scale
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1145,7 @@ QVariant QWindowsMimeImage::convertToMime(const QString &mimeType, IDataObject *
|
|||||||
{
|
{
|
||||||
Q_UNUSED(preferredType);
|
Q_UNUSED(preferredType);
|
||||||
QVariant result;
|
QVariant result;
|
||||||
if (mimeType != QStringLiteral("application/x-qt-image"))
|
if (mimeType != QLatin1String("application/x-qt-image"))
|
||||||
return result;
|
return result;
|
||||||
//Try to convert from a format which has more data
|
//Try to convert from a format which has more data
|
||||||
//DIBV5, use only if its is not synthesized
|
//DIBV5, use only if its is not synthesized
|
||||||
|
@ -639,7 +639,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
|
|||||||
QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));
|
QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION"));
|
||||||
if (!glIntegrationName.isEmpty()) {
|
if (!glIntegrationName.isEmpty()) {
|
||||||
qCDebug(QT_XCB_GLINTEGRATION) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
|
qCDebug(QT_XCB_GLINTEGRATION) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName;
|
||||||
if (glIntegrationName != QStringLiteral("none")) {
|
if (glIntegrationName != QLatin1String("none")) {
|
||||||
glIntegrationNames.removeAll(glIntegrationName);
|
glIntegrationNames.removeAll(glIntegrationName);
|
||||||
glIntegrationNames.prepend(glIntegrationName);
|
glIntegrationNames.prepend(glIntegrationName);
|
||||||
} else {
|
} else {
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
|
|
||||||
QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key)
|
QPlatformPrinterSupport *QCocoaPrinterSupportPlugin::create(const QString &key)
|
||||||
{
|
{
|
||||||
if (key.compare(key, QStringLiteral("cocoaprintersupport"), Qt::CaseInsensitive) != 0)
|
if (key.compare(key, QLatin1String("cocoaprintersupport"), Qt::CaseInsensitive) != 0)
|
||||||
return 0;
|
return 0;
|
||||||
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
|
QGuiApplication *app = qobject_cast<QGuiApplication *>(QCoreApplication::instance());
|
||||||
if (!app)
|
if (!app)
|
||||||
|
@ -1094,7 +1094,7 @@ void Configure::parseCmdLine()
|
|||||||
if (i == argCount)
|
if (i == argCount)
|
||||||
break;
|
break;
|
||||||
QString mod = configCmdLine.at(i);
|
QString mod = configCmdLine.at(i);
|
||||||
if (!mod.startsWith(QStringLiteral("qt")))
|
if (!mod.startsWith(QLatin1String("qt")))
|
||||||
mod.insert(0, QStringLiteral("qt"));
|
mod.insert(0, QStringLiteral("qt"));
|
||||||
if (!QFileInfo(sourcePath + "/../" + mod).isDir()) {
|
if (!QFileInfo(sourcePath + "/../" + mod).isDir()) {
|
||||||
cout << "Attempting to skip non-existent module " << mod << "." << endl;
|
cout << "Attempting to skip non-existent module " << mod << "." << endl;
|
||||||
@ -3810,7 +3810,7 @@ void Configure::displayConfig()
|
|||||||
env = "Unset";
|
env = "Unset";
|
||||||
sout << " PATH=\n " << env << endl;
|
sout << " PATH=\n " << env << endl;
|
||||||
|
|
||||||
if (dictionary[QStringLiteral("EDITION")] != QStringLiteral("OpenSource")) {
|
if (dictionary[QStringLiteral("EDITION")] != QLatin1String("OpenSource")) {
|
||||||
QString l1 = dictionary[ "LICENSEE" ];
|
QString l1 = dictionary[ "LICENSEE" ];
|
||||||
QString l2 = dictionary[ "LICENSEID" ];
|
QString l2 = dictionary[ "LICENSEID" ];
|
||||||
QString l3 = dictionary["EDITION"] + ' ' + "Edition";
|
QString l3 = dictionary["EDITION"] + ' ' + "Edition";
|
||||||
|
@ -389,11 +389,11 @@ QString CodeGenerator::passByType(const Argument &arg) const
|
|||||||
|
|
||||||
QString CodeGenerator::safeArgumentName(const QString& arg) const
|
QString CodeGenerator::safeArgumentName(const QString& arg) const
|
||||||
{
|
{
|
||||||
if (arg == QStringLiteral("near")) // MS Windows defines near and far
|
if (arg == QLatin1String("near")) // MS Windows defines near and far
|
||||||
return QStringLiteral("nearVal");
|
return QStringLiteral("nearVal");
|
||||||
else if (arg == QStringLiteral("far"))
|
else if (arg == QLatin1String("far"))
|
||||||
return QStringLiteral("farVal");
|
return QStringLiteral("farVal");
|
||||||
else if (arg == QStringLiteral("d"))
|
else if (arg == QLatin1String("d"))
|
||||||
return QStringLiteral("dd"); // Don't shadow d pointer
|
return QStringLiteral("dd"); // Don't shadow d pointer
|
||||||
else
|
else
|
||||||
return arg;
|
return arg;
|
||||||
@ -810,7 +810,7 @@ void CodeGenerator::writeInlineFunction(QTextStream &stream, const QString &clas
|
|||||||
argumentNames.append(safeArgumentName(arg.name));
|
argumentNames.append(safeArgumentName(arg.name));
|
||||||
QString argNames = argumentNames.join(", ");
|
QString argNames = argumentNames.join(", ");
|
||||||
|
|
||||||
if (f.returnType == QStringLiteral("void"))
|
if (f.returnType == QLatin1String("void"))
|
||||||
stream << QString(QStringLiteral(" %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl;
|
stream << QString(QStringLiteral(" %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl;
|
||||||
else
|
else
|
||||||
stream << QString(QStringLiteral(" return %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl;
|
stream << QString(QStringLiteral(" return %1->%2(%3);")).arg(backendVar).arg(f.name).arg(argNames) << endl;
|
||||||
|
@ -80,7 +80,7 @@ bool LegacySpecParser::parseTypeMap()
|
|||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
QString line = stream.readLine();
|
QString line = stream.readLine();
|
||||||
|
|
||||||
if (line.startsWith(QStringLiteral("#")))
|
if (line.startsWith(QLatin1Char('#')))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (typeMapRegExp.indexIn(line) != -1) {
|
if (typeMapRegExp.indexIn(line) != -1) {
|
||||||
@ -88,7 +88,7 @@ bool LegacySpecParser::parseTypeMap()
|
|||||||
QString value = typeMapRegExp.cap(2).simplified();
|
QString value = typeMapRegExp.cap(2).simplified();
|
||||||
|
|
||||||
// Special case for void
|
// Special case for void
|
||||||
if (value == QStringLiteral("*"))
|
if (value == QLatin1String("*"))
|
||||||
value = QStringLiteral("void");
|
value = QStringLiteral("void");
|
||||||
|
|
||||||
m_typeMap.insert(key, value);
|
m_typeMap.insert(key, value);
|
||||||
@ -144,7 +144,7 @@ void LegacySpecParser::parseFunctions(QTextStream &stream)
|
|||||||
// extension. These functions should be added to the DSA extension rather
|
// extension. These functions should be added to the DSA extension rather
|
||||||
// than the core functionality. The core will already contain non-DSA
|
// than the core functionality. The core will already contain non-DSA
|
||||||
// versions of these functions.
|
// versions of these functions.
|
||||||
if (acceptCurrentFunctionInCore && currentFunction.name.endsWith(QStringLiteral("EXT"))) {
|
if (acceptCurrentFunctionInCore && currentFunction.name.endsWith(QLatin1String("EXT"))) {
|
||||||
acceptCurrentFunctionInCore = false;
|
acceptCurrentFunctionInCore = false;
|
||||||
acceptCurrentFunctionInExtension = true;
|
acceptCurrentFunctionInExtension = true;
|
||||||
currentCategory = QStringLiteral("EXT_direct_state_access");
|
currentCategory = QStringLiteral("EXT_direct_state_access");
|
||||||
@ -191,9 +191,9 @@ void LegacySpecParser::parseFunctions(QTextStream &stream)
|
|||||||
arg.type = m_typeMap.value(type);
|
arg.type = m_typeMap.value(type);
|
||||||
|
|
||||||
QString direction = argumentRegExp.cap(3);
|
QString direction = argumentRegExp.cap(3);
|
||||||
if (direction == QStringLiteral("in")) {
|
if (direction == QLatin1String("in")) {
|
||||||
arg.direction = Argument::In;
|
arg.direction = Argument::In;
|
||||||
} else if (direction == QStringLiteral("out")) {
|
} else if (direction == QLatin1String("out")) {
|
||||||
arg.direction = Argument::Out;
|
arg.direction = Argument::Out;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Invalid argument direction found:" << direction;
|
qWarning() << "Invalid argument direction found:" << direction;
|
||||||
@ -201,11 +201,11 @@ void LegacySpecParser::parseFunctions(QTextStream &stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString mode = argumentRegExp.cap(4);
|
QString mode = argumentRegExp.cap(4);
|
||||||
if (mode == QStringLiteral("value")) {
|
if (mode == QLatin1String("value")) {
|
||||||
arg.mode = Argument::Value;
|
arg.mode = Argument::Value;
|
||||||
} else if (mode == QStringLiteral("array")) {
|
} else if (mode == QLatin1String("array")) {
|
||||||
arg.mode = Argument::Array;
|
arg.mode = Argument::Array;
|
||||||
} else if (mode == QStringLiteral("reference")) {
|
} else if (mode == QLatin1String("reference")) {
|
||||||
arg.mode = Argument::Reference;
|
arg.mode = Argument::Reference;
|
||||||
} else {
|
} else {
|
||||||
qWarning() << "Invalid argument mode found:" << mode;
|
qWarning() << "Invalid argument mode found:" << mode;
|
||||||
@ -246,7 +246,7 @@ void LegacySpecParser::parseFunctions(QTextStream &stream)
|
|||||||
// Extract the OpenGL version in which this function was deprecated.
|
// Extract the OpenGL version in which this function was deprecated.
|
||||||
// If it is OpenGL 3.1 then it must be a compatibility profile function
|
// If it is OpenGL 3.1 then it must be a compatibility profile function
|
||||||
QString deprecatedVersion = deprecatedRegExp.cap(1).simplified();
|
QString deprecatedVersion = deprecatedRegExp.cap(1).simplified();
|
||||||
if (deprecatedVersion == QStringLiteral("3.1") && !inDeprecationException(currentFunction.name))
|
if (deprecatedVersion == QLatin1String("3.1") && !inDeprecationException(currentFunction.name))
|
||||||
currentVersionProfile.profile = VersionProfile::CompatibilityProfile;
|
currentVersionProfile.profile = VersionProfile::CompatibilityProfile;
|
||||||
|
|
||||||
} else if (categoryRegExp.indexIn(line) != -1) {
|
} else if (categoryRegExp.indexIn(line) != -1) {
|
||||||
@ -301,5 +301,5 @@ void LegacySpecParser::parseFunctions(QTextStream &stream)
|
|||||||
|
|
||||||
bool LegacySpecParser::inDeprecationException(const QString &functionName) const
|
bool LegacySpecParser::inDeprecationException(const QString &functionName) const
|
||||||
{
|
{
|
||||||
return (functionName == QStringLiteral("TexImage3D"));
|
return functionName == QLatin1String("TexImage3D");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user