diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-05 07:40:09 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-20 12:49:12 +0200 |
commit | 201ca07ae23ab142ac2efcf2413adf6c243be7f7 (patch) | |
tree | 6761b1bbd30680d585be4ba53e75eebba6581152 /src/quick3d/quick3drender/items | |
parent | e4343bcfe85111042a38870704079329cfe49794 (diff) |
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: I3b040fa72968753048fd669c073ae80c3ba1bdad
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/quick3d/quick3drender/items')
11 files changed, 15 insertions, 15 deletions
diff --git a/src/quick3d/quick3drender/items/quick3deffect.cpp b/src/quick3d/quick3drender/items/quick3deffect.cpp index 97e0fd83a..a38dddb47 100644 --- a/src/quick3d/quick3drender/items/quick3deffect.cpp +++ b/src/quick3d/quick3drender/items/quick3deffect.cpp @@ -33,7 +33,7 @@ QQmlListProperty<QTechnique> Quick3DEffect::techniqueList() auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DEffect *eff = qobject_cast<Quick3DEffect*>(list->object); if (eff) - return eff->parentEffect()->techniques().count(); + return eff->parentEffect()->techniques().size(); return 0; }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { @@ -72,7 +72,7 @@ QQmlListProperty<QParameter> Quick3DEffect::parameterList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DEffect *effect = qobject_cast<Quick3DEffect *>(list->object); - return qobject_cast<QEffect *>(effect->parentEffect())->parameters().count(); + return qobject_cast<QEffect *>(effect->parentEffect())->parameters().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DEffect *effect = qobject_cast<Quick3DEffect *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp b/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp index 93f0b55bb..2ad597294 100644 --- a/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp +++ b/src/quick3d/quick3drender/items/quick3dlayerfilter.cpp @@ -36,7 +36,7 @@ QQmlListProperty<QLayer> Quick3DLayerFilter::qmlLayers() auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DLayerFilter *filter = qobject_cast<Quick3DLayerFilter *>(list->object); if (filter) - return filter->parentFilter()->layers().count(); + return filter->parentFilter()->layers().size(); return 0; }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { diff --git a/src/quick3d/quick3drender/items/quick3dmaterial.cpp b/src/quick3d/quick3drender/items/quick3dmaterial.cpp index c46b85e18..9f8fed800 100644 --- a/src/quick3d/quick3drender/items/quick3dmaterial.cpp +++ b/src/quick3d/quick3drender/items/quick3dmaterial.cpp @@ -37,7 +37,7 @@ QQmlListProperty<QParameter> Quick3DMaterial::qmlParameters() auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DMaterial *mat = qobject_cast<Quick3DMaterial *>(list->object); if (mat) - return mat->parentMaterial()->parameters().count(); + return mat->parentMaterial()->parameters().size(); return 0; }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { diff --git a/src/quick3d/quick3drender/items/quick3drenderpass.cpp b/src/quick3d/quick3drender/items/quick3drenderpass.cpp index 1016200d4..5bc50673a 100644 --- a/src/quick3d/quick3drender/items/quick3drenderpass.cpp +++ b/src/quick3d/quick3drender/items/quick3drenderpass.cpp @@ -30,7 +30,7 @@ QQmlListProperty<QFilterKey> Quick3DRenderPass::filterKeyList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); - return rPass->parentRenderPass()->filterKeys().count(); + return rPass->parentRenderPass()->filterKeys().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); @@ -61,7 +61,7 @@ QQmlListProperty<QRenderState> Quick3DRenderPass::renderStateList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); - return rPass->parentRenderPass()->renderStates().count(); + return rPass->parentRenderPass()->renderStates().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); @@ -92,7 +92,7 @@ QQmlListProperty<QParameter> Quick3DRenderPass::parameterList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); - return rPass->parentRenderPass()->parameters().count(); + return rPass->parentRenderPass()->parameters().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DRenderPass *rPass = qobject_cast<Quick3DRenderPass *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp b/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp index 9f46aaaa7..7c6249298 100644 --- a/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp +++ b/src/quick3d/quick3drender/items/quick3drenderpassfilter.cpp @@ -32,7 +32,7 @@ QQmlListProperty<QFilterKey> Quick3DRenderPassFilter::includeList() auto countFunction = [](QQmlListProperty<QFilterKey> *list) -> qt_size_type { auto self = qobject_cast<Quick3DRenderPassFilter *>(list->object); if (self) - return self->parentRenderPassFilter()->matchAny().count(); + return self->parentRenderPassFilter()->matchAny().size(); return 0; }; auto atFunction = [](QQmlListProperty<QFilterKey> *list, qt_size_type index) -> QFilterKey * { @@ -70,7 +70,7 @@ QQmlListProperty<QParameter> Quick3DRenderPassFilter::parameterList() auto countFunction = [](QQmlListProperty<QParameter> *list) -> qt_size_type { auto self = qobject_cast<Quick3DRenderPassFilter *>(list->object); if (self) - return self->parentRenderPassFilter()->parameters().count(); + return self->parentRenderPassFilter()->parameters().size(); return 0; }; auto atFunction = [](QQmlListProperty<QParameter> *list, qt_size_type index) -> QParameter * { diff --git a/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp b/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp index 0488ecf3b..9ede43513 100644 --- a/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp +++ b/src/quick3d/quick3drender/items/quick3drendertargetoutput.cpp @@ -31,7 +31,7 @@ QQmlListProperty<QRenderTargetOutput> Quick3DRenderTargetOutput::qmlAttachments( auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DRenderTargetOutput *rT = qobject_cast<Quick3DRenderTargetOutput *>(list->object); if (rT) - return rT->parentRenderTarget()->outputs().count(); + return rT->parentRenderTarget()->outputs().size(); return 0; }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { diff --git a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp index 0d3faa348..76f1948b4 100644 --- a/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp +++ b/src/quick3d/quick3drender/items/quick3dshaderdataarray.cpp @@ -40,7 +40,7 @@ QQmlListProperty<QShaderData> Quick3DShaderDataArray::valuesList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DShaderDataArray *self = static_cast<Quick3DShaderDataArray *>(list->object); - return static_cast<Quick3DShaderDataArrayPrivate *>(Quick3DShaderDataArrayPrivate::get(self))->m_values.count(); + return static_cast<Quick3DShaderDataArrayPrivate *>(Quick3DShaderDataArrayPrivate::get(self))->m_values.size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DShaderDataArray *self = static_cast<Quick3DShaderDataArray *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3dstateset.cpp b/src/quick3d/quick3drender/items/quick3dstateset.cpp index 1861832a9..0c37c529f 100644 --- a/src/quick3d/quick3drender/items/quick3dstateset.cpp +++ b/src/quick3d/quick3drender/items/quick3dstateset.cpp @@ -33,7 +33,7 @@ QQmlListProperty<QRenderState> Quick3DStateSet::renderStateList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DStateSet *stateSet = qobject_cast<Quick3DStateSet *>(list->object); - return stateSet->parentStateSet()->renderStates().count(); + return stateSet->parentStateSet()->renderStates().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DStateSet *stateSet = qobject_cast<Quick3DStateSet *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3dtechnique.cpp b/src/quick3d/quick3drender/items/quick3dtechnique.cpp index 8bf720a25..d7ebfc9fe 100644 --- a/src/quick3d/quick3drender/items/quick3dtechnique.cpp +++ b/src/quick3d/quick3drender/items/quick3dtechnique.cpp @@ -67,7 +67,7 @@ QQmlListProperty<QParameter> Quick3DTechnique::parameterList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); - return technique->parentTechnique()->parameters().count(); + return technique->parentTechnique()->parameters().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DTechnique *technique = qobject_cast<Quick3DTechnique *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp b/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp index 51473018e..37ac4045f 100644 --- a/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp +++ b/src/quick3d/quick3drender/items/quick3dtechniquefilter.cpp @@ -69,7 +69,7 @@ QQmlListProperty<QParameter> Quick3DTechniqueFilter::parameterList() }; auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DTechniqueFilter *techniqueFilter = qobject_cast<Quick3DTechniqueFilter *>(list->object); - return techniqueFilter->parentTechniqueFilter()->parameters().count(); + return techniqueFilter->parentTechniqueFilter()->parameters().size(); }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { Quick3DTechniqueFilter *techniqueFilter = qobject_cast<Quick3DTechniqueFilter *>(list->object); diff --git a/src/quick3d/quick3drender/items/quick3dtexture.cpp b/src/quick3d/quick3drender/items/quick3dtexture.cpp index eb18920b0..2929ff4d4 100644 --- a/src/quick3d/quick3drender/items/quick3dtexture.cpp +++ b/src/quick3d/quick3drender/items/quick3dtexture.cpp @@ -33,7 +33,7 @@ QQmlListProperty<QAbstractTextureImage> Quick3DTextureExtension::textureImages() auto countFunction = [](QQmlListProperty<ListContentType> *list) -> qt_size_type { Quick3DTextureExtension *self = qobject_cast<Quick3DTextureExtension *>(list->object); if (self) - return self->parentTexture()->textureImages().count(); + return self->parentTexture()->textureImages().size(); return 0; }; auto atFunction = [](QQmlListProperty<ListContentType> *list, qt_size_type index) -> ListContentType * { |