aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmldom/qqmldomtop.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 07:29:16 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 23:38:48 +0200
commit958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch)
tree6d3816fedf5dab2307675fd6ef70d39758e246f5 /src/qmldom/qqmldomtop.cpp
parente8e03215654ca730243336a80453cf9396cbdf58 (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: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmldom/qqmldomtop.cpp')
-rw-r--r--src/qmldom/qqmldomtop.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/qmldom/qqmldomtop.cpp b/src/qmldom/qqmldomtop.cpp
index 6bf952f9b1..5dfe244547 100644
--- a/src/qmldom/qqmldomtop.cpp
+++ b/src/qmldom/qqmldomtop.cpp
@@ -198,13 +198,13 @@ bool DomUniverse::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::queue),
[q](DomItem &list, index_type i) {
- if (i >= 0 && i < q.length())
+ if (i >= 0 && i < q.size())
return list.subDataItem(PathEls::Index(i), q.at(i).toCbor(),
ConstantData::Options::FirstMapIsFields);
else
return DomItem();
},
- [q](DomItem &) { return index_type(q.length()); }, nullptr,
+ [q](DomItem &) { return index_type(q.size()); }, nullptr,
QLatin1String("ParsingTask")));
});
return cont;
@@ -1085,7 +1085,7 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
loadedLoadInfo = true;
loadsWithWork = m_loadsWithWork;
inProgress = m_inProgress;
- nAllLoadedCallbacks = m_allLoadedCallback.length();
+ nAllLoadedCallbacks = m_allLoadedCallback.size();
}
};
cont = cont
@@ -1095,14 +1095,14 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::loadsWithWork),
[loadsWithWork](DomItem &list, index_type i) {
- if (i >= 0 && i < loadsWithWork.length())
+ if (i >= 0 && i < loadsWithWork.size())
return list.subDataItem(PathEls::Index(i),
loadsWithWork.at(i).toString());
else
return DomItem();
},
[loadsWithWork](DomItem &) {
- return index_type(loadsWithWork.length());
+ return index_type(loadsWithWork.size());
},
nullptr, QLatin1String("Path")));
});
@@ -1112,13 +1112,13 @@ bool DomEnvironment::iterateDirectSubpaths(DomItem &self, DirectVisitor visitor)
return self.subListItem(List(
Path::Field(Fields::inProgress),
[inProgress](DomItem &list, index_type i) {
- if (i >= 0 && i < inProgress.length())
+ if (i >= 0 && i < inProgress.size())
return list.subDataItem(PathEls::Index(i),
inProgress.at(i).toString());
else
return DomItem();
},
- [inProgress](DomItem &) { return index_type(inProgress.length()); },
+ [inProgress](DomItem &) { return index_type(inProgress.size()); },
nullptr, QLatin1String("Path")));
});
cont = cont && self.dvItemField(visitor, Fields::loadInfo, [&self, this]() {
@@ -1729,7 +1729,7 @@ QSet<QString> DomEnvironment::qmlDirPaths(DomItem &self, EnvLookup options) cons
const auto qmldirFiles = qmldirFilePaths(self, options);
for (const QString &p : qmldirFiles) {
if (p.endsWith(u"/qmldir")) {
- res.insert(p.left(p.length() - 7));
+ res.insert(p.left(p.size() - 7));
} else {
myErrors()
.warning(tr("Unexpected path not ending with qmldir in qmldirFilePaths: %1")