diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 08:22:39 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-11 17:36:36 +0200 |
commit | 39ebe4abccdc4e059a0e310a331f3fc392c84009 (patch) | |
tree | aeca91ed813d6675693fcb9e71d8336c3d303cab /src/core/api | |
parent | 555beb85735f8ce92fdbff7358a6659820e4819c (diff) | |
download | qtwebengine-39ebe4abccdc4e059a0e310a331f3fc392c84009.tar.gz |
Port from container::count() and length() to size() - V4
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
a.k.a qt-port-to-std-compatible-api V4 with config Scope: 'Container'.
Change-Id: I3e6fef8eca212da0c4f0b464545ba96183b4476f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api')
-rw-r--r-- | src/core/api/qwebenginehttprequest.cpp | 2 | ||||
-rw-r--r-- | src/core/api/qwebenginescriptcollection.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/core/api/qwebenginehttprequest.cpp b/src/core/api/qwebenginehttprequest.cpp index bb822d6e3..050213d1e 100644 --- a/src/core/api/qwebenginehttprequest.cpp +++ b/src/core/api/qwebenginehttprequest.cpp @@ -151,7 +151,7 @@ QWebEngineHttpRequest QWebEngineHttpRequest::postRequest(const QUrl &url, QByteArray key = QUrl::toPercentEncoding(it.key()); QByteArray value = QUrl::toPercentEncoding(it.value()); - if (buffer.length() > 0) + if (buffer.size() > 0) buffer += '&'; buffer.append(key).append('=').append(value); } diff --git a/src/core/api/qwebenginescriptcollection.cpp b/src/core/api/qwebenginescriptcollection.cpp index e551a5127..7867192b6 100644 --- a/src/core/api/qwebenginescriptcollection.cpp +++ b/src/core/api/qwebenginescriptcollection.cpp @@ -120,7 +120,7 @@ QWebEngineScriptCollectionPrivate::QWebEngineScriptCollectionPrivate(QtWebEngine int QWebEngineScriptCollectionPrivate::count() const { - return m_scripts.count(); + return m_scripts.size(); } bool QWebEngineScriptCollectionPrivate::contains(const QWebEngineScript &s) const |