Prefer rvalue versions of toLower() and toUpper()
... to re-use existing buffers. Change-Id: Ib2bc938f1cf0451c1dbc012b3db022b878e987cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
e8cf0bf5f8
commit
18d6c82299
@ -419,7 +419,7 @@ QMacSettingsPrivate::QMacSettingsPrivate(QSettings::Scope scope, const QString &
|
||||
curPos = nextDot + 1;
|
||||
}
|
||||
javaPackageName.prepend(domainName.midRef(curPos));
|
||||
javaPackageName = javaPackageName.toLower();
|
||||
javaPackageName = std::move(javaPackageName).toLower();
|
||||
if (curPos == 0)
|
||||
javaPackageName.prepend(QLatin1String("com."));
|
||||
suiteId = javaPackageName;
|
||||
|
@ -2891,7 +2891,7 @@ QString QLocaleData::doubleToString(const QChar _zero, const QChar plus, const Q
|
||||
num_str.prepend(QLatin1Char(' '));
|
||||
|
||||
if (flags & QLocaleData::CapitalEorX)
|
||||
num_str = num_str.toUpper();
|
||||
num_str = std::move(num_str).toUpper();
|
||||
|
||||
return num_str;
|
||||
}
|
||||
@ -2973,7 +2973,7 @@ QString QLocaleData::longLongToString(const QChar zero, const QChar group,
|
||||
}
|
||||
|
||||
if (flags & CapitalEorX)
|
||||
num_str = num_str.toUpper();
|
||||
num_str = std::move(num_str).toUpper();
|
||||
|
||||
if (base == 16 && (flags & ShowBase))
|
||||
num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
|
||||
@ -3052,7 +3052,7 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group,
|
||||
}
|
||||
|
||||
if (flags & CapitalEorX)
|
||||
num_str = num_str.toUpper();
|
||||
num_str = std::move(num_str).toUpper();
|
||||
|
||||
if (base == 16 && flags & ShowBase)
|
||||
num_str.prepend(QLatin1String(flags & UppercaseBase ? "0X" : "0x"));
|
||||
|
@ -1183,7 +1183,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
|
||||
QString keyName(tran == 0
|
||||
? QCoreApplication::translate("QShortcut", keyname[i].name)
|
||||
: QString::fromLatin1(keyname[i].name));
|
||||
if (accelRef == keyName.toLower()) {
|
||||
if (accelRef == std::move(keyName).toLower()) {
|
||||
ret |= keyname[i].key;
|
||||
found = true;
|
||||
break;
|
||||
|
@ -1822,7 +1822,7 @@ void StyleSheet::buildIndexes(Qt::CaseSensitivity nameCaseSensitivity)
|
||||
nr.order = i;
|
||||
QString name = sel.elementName;
|
||||
if (nameCaseSensitivity == Qt::CaseInsensitive)
|
||||
name=name.toLower();
|
||||
name = std::move(name).toLower();
|
||||
nameIndex.insert(name, nr);
|
||||
} else {
|
||||
universalsSelectors += selector;
|
||||
@ -2027,7 +2027,7 @@ QVector<StyleRule> StyleSelector::styleRulesForNode(NodePtr node)
|
||||
for (int i = 0; i < names.count(); i++) {
|
||||
QString name = names.at(i);
|
||||
if (nameCaseSensitivity == Qt::CaseInsensitive)
|
||||
name = name.toLower();
|
||||
name = std::move(name).toLower();
|
||||
QMultiHash<QString, StyleRule>::const_iterator it = styleSheet.nameIndex.constFind(name);
|
||||
while (it != styleSheet.nameIndex.constEnd() && it.key() == name) {
|
||||
matchRule(node, it.value(), styleSheet.origin, styleSheet.depth, &weightedRules);
|
||||
|
@ -133,7 +133,7 @@ bool Qt::mightBeRichText(const QString& text)
|
||||
return false; // that's not a tag
|
||||
}
|
||||
#ifndef QT_NO_TEXTHTMLPARSER
|
||||
return QTextHtmlParser::lookupElement(tag.toLower()) != -1;
|
||||
return QTextHtmlParser::lookupElement(std::move(tag).toLower()) != -1;
|
||||
#else
|
||||
return false;
|
||||
#endif // QT_NO_TEXTHTMLPARSER
|
||||
|
@ -1525,7 +1525,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
} else if (value == QLatin1String("I")) {
|
||||
node->listStyle = QTextListFormat::ListUpperRoman;
|
||||
} else {
|
||||
value = value.toLower();
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("square"))
|
||||
node->listStyle = QTextListFormat::ListSquare;
|
||||
else if (value == QLatin1String("disc"))
|
||||
@ -1636,7 +1636,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
node->parseStyleAttribute(value, resourceProvider);
|
||||
#endif
|
||||
} else if (key == QLatin1String("align")) {
|
||||
value = value.toLower();
|
||||
value = std::move(value).toLower();
|
||||
bool alignmentSet = true;
|
||||
|
||||
if (value == QLatin1String("left"))
|
||||
@ -1664,7 +1664,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
}
|
||||
}
|
||||
} else if (key == QLatin1String("valign")) {
|
||||
value = value.toLower();
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("top"))
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignTop);
|
||||
else if (value == QLatin1String("middle"))
|
||||
@ -1672,7 +1672,7 @@ void QTextHtmlParser::applyAttributes(const QStringList &attributes)
|
||||
else if (value == QLatin1String("bottom"))
|
||||
node->charFormat.setVerticalAlignment(QTextCharFormat::AlignBottom);
|
||||
} else if (key == QLatin1String("dir")) {
|
||||
value = value.toLower();
|
||||
value = std::move(value).toLower();
|
||||
if (value == QLatin1String("ltr"))
|
||||
node->blockFormat.setLayoutDirection(Qt::LeftToRight);
|
||||
else if (value == QLatin1String("rtl"))
|
||||
|
@ -815,14 +815,14 @@ QString QWindowsFileIconEngine::cacheKey() const
|
||||
// Return "" for .exe, .lnk and .ico extensions.
|
||||
// It is faster to just look at the file extensions;
|
||||
// avoiding slow QFileInfo::isExecutable() (QTBUG-13182)
|
||||
const QString &suffix = fileInfo().suffix();
|
||||
QString suffix = fileInfo().suffix();
|
||||
if (!suffix.compare(QLatin1String("exe"), Qt::CaseInsensitive)
|
||||
|| !suffix.compare(QLatin1String("lnk"), Qt::CaseInsensitive)
|
||||
|| !suffix.compare(QLatin1String("ico"), Qt::CaseInsensitive)) {
|
||||
return QString();
|
||||
}
|
||||
return QLatin1String("qt_.")
|
||||
+ (suffix.isEmpty() ? fileInfo().fileName() : suffix.toUpper()); // handle "Makefile" ;)
|
||||
+ (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile" ;)
|
||||
}
|
||||
|
||||
QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon::State)
|
||||
|
@ -1073,12 +1073,12 @@ QSqlIndex QPSQLDriver::primaryIndex(const QString& tablename) const
|
||||
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
|
||||
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
|
||||
else
|
||||
tbl = tbl.toLower();
|
||||
tbl = std::move(tbl).toLower();
|
||||
|
||||
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
|
||||
schema = stripDelimiters(schema, QSqlDriver::TableName);
|
||||
else
|
||||
schema = schema.toLower();
|
||||
schema = std::move(schema).toLower();
|
||||
|
||||
switch(d->pro) {
|
||||
case QPSQLDriver::Version6:
|
||||
@ -1153,12 +1153,12 @@ QSqlRecord QPSQLDriver::record(const QString& tablename) const
|
||||
if (isIdentifierEscaped(tbl, QSqlDriver::TableName))
|
||||
tbl = stripDelimiters(tbl, QSqlDriver::TableName);
|
||||
else
|
||||
tbl = tbl.toLower();
|
||||
tbl = std::move(tbl).toLower();
|
||||
|
||||
if (isIdentifierEscaped(schema, QSqlDriver::TableName))
|
||||
schema = stripDelimiters(schema, QSqlDriver::TableName);
|
||||
else
|
||||
schema = schema.toLower();
|
||||
schema = std::move(schema).toLower();
|
||||
|
||||
QString stmt;
|
||||
switch(d->pro) {
|
||||
|
@ -493,7 +493,7 @@ QMatchData QCompletionEngine::filterHistory()
|
||||
bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatchData *hint)
|
||||
{
|
||||
if (c->cs == Qt::CaseInsensitive)
|
||||
part = part.toLower();
|
||||
part = std::move(part).toLower();
|
||||
|
||||
const CacheItem& map = cache[parent];
|
||||
|
||||
@ -512,7 +512,7 @@ bool QCompletionEngine::matchHint(QString part, const QModelIndex& parent, QMatc
|
||||
bool QCompletionEngine::lookupCache(QString part, const QModelIndex& parent, QMatchData *m)
|
||||
{
|
||||
if (c->cs == Qt::CaseInsensitive)
|
||||
part = part.toLower();
|
||||
part = std::move(part).toLower();
|
||||
const CacheItem& map = cache[parent];
|
||||
if (!map.contains(part))
|
||||
return false;
|
||||
@ -548,7 +548,7 @@ void QCompletionEngine::saveInCache(QString part, const QModelIndex& parent, con
|
||||
}
|
||||
|
||||
if (c->cs == Qt::CaseInsensitive)
|
||||
part = part.toLower();
|
||||
part = std::move(part).toLower();
|
||||
cache[parent][part] = m;
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ QIndexMapper QSortedModelEngine::indexHint(QString part, const QModelIndex& pare
|
||||
const QAbstractItemModel *model = c->proxy->sourceModel();
|
||||
|
||||
if (c->cs == Qt::CaseInsensitive)
|
||||
part = part.toLower();
|
||||
part = std::move(part).toLower();
|
||||
|
||||
const CacheItem& map = cache[parent];
|
||||
|
||||
|
@ -1798,7 +1798,7 @@ QTextStream& operator>>(QTextStream& ts, QSplitter& splitter)
|
||||
QString line = ts.readLine();
|
||||
line = line.simplified();
|
||||
line.replace(QLatin1Char(' '), QString());
|
||||
line = line.toUpper();
|
||||
line = std::move(line).toUpper();
|
||||
|
||||
splitter.restoreState(line.toLatin1());
|
||||
return ts;
|
||||
|
Loading…
Reference in New Issue
Block a user