summaryrefslogtreecommitdiffstats
path: root/tools/qscxmlc/scxmlcppdumper.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 08:10:32 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 14:37:00 +0200
commit8f8aacdeadea1ddf92923f6183c4c67925a25db2 (patch)
treeeefe3d96f1a0b789b34166000f2b424f9affceaf /tools/qscxmlc/scxmlcppdumper.cpp
parentcf65af2f6d4b399cfe28bbf27d1fc43a791ce442 (diff)
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Iaf46b2ba54f3b125aee087c2cacb702d8d564201 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tools/qscxmlc/scxmlcppdumper.cpp')
-rw-r--r--tools/qscxmlc/scxmlcppdumper.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/qscxmlc/scxmlcppdumper.cpp b/tools/qscxmlc/scxmlcppdumper.cpp
index 6154446..5e19d33 100644
--- a/tools/qscxmlc/scxmlcppdumper.cpp
+++ b/tools/qscxmlc/scxmlcppdumper.cpp
@@ -42,7 +42,7 @@ QString cEscape(const QString &str)
{
QString res;
int lastI = 0;
- for (int i = 0; i < str.length(); ++i) {
+ for (int i = 0; i < str.size(); ++i) {
QChar c = str.at(i);
if (c < QLatin1Char(' ') || c == QLatin1Char('\\') || c == QLatin1Char('\"')) {
res.append(str.mid(lastI, i - lastI));
@@ -137,7 +137,7 @@ static void generateList(QString &out, std::function<QString(int)> next)
if (i != 0)
line += QLatin1Char(',');
- if (line.length() + nr.length() + 1 > maxLineLength) {
+ if (line.size() + nr.size() + 1 > maxLineLength) {
out += line + QLatin1Char('\n');
line.clear();
} else if (i != 0) {
@@ -652,7 +652,7 @@ QString CppDumper::mangleIdentifier(const QString &str)
}
}
- for (int ei = str.length(); i != ei; ++i) {
+ for (int ei = str.size(); i != ei; ++i) {
auto c = str.at(i);
if ((c >= QLatin1Char('0') && c <= QLatin1Char('9')) || isNonDigit(c)) {
mangled += c;