diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 08:17:22 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-06 18:20:17 +0200 |
commit | c338447261878111df7198fbd96051926464e865 (patch) | |
tree | d21b5af1efae225f75d5c05dfe370daefb1ea1d1 /src/qdoc/codechunk.h | |
parent | 6495329e6de803025e6e4e8291b648f94893551c (diff) | |
download | qttools-c338447261878111df7198fbd96051926464e865.tar.gz |
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: I95f6410e57a6a92b1cf91bbedfbe3d517cab6b44
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'src/qdoc/codechunk.h')
-rw-r--r-- | src/qdoc/codechunk.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qdoc/codechunk.h b/src/qdoc/codechunk.h index 788e8224d..00ad26c6d 100644 --- a/src/qdoc/codechunk.h +++ b/src/qdoc/codechunk.h @@ -19,7 +19,7 @@ public: void appendHotspot() { if (m_hotspot == -1) - m_hotspot = m_str.length(); + m_hotspot = m_str.size(); } [[nodiscard]] bool isEmpty() const { return m_str.isEmpty(); } @@ -27,11 +27,11 @@ public: [[nodiscard]] QString toString() const { return m_str; } [[nodiscard]] QString left() const { - return m_str.left(m_hotspot == -1 ? m_str.length() : m_hotspot); + return m_str.left(m_hotspot == -1 ? m_str.size() : m_hotspot); } [[nodiscard]] QString right() const { - return m_str.mid(m_hotspot == -1 ? m_str.length() : m_hotspot); + return m_str.mid(m_hotspot == -1 ? m_str.size() : m_hotspot); } private: |