Commit acc6a52e authored by Ben Boeckel's avatar Ben Boeckel
Browse files

clang-tidy: fix `readability-qualified-auto` lints

parent 561c6ec5
......@@ -43,7 +43,7 @@ protected:
case Qt::Key_Enter:
case Qt::Key_Return:
{
auto sm = QTreeView::selectionModel();
auto* sm = QTreeView::selectionModel();
emit showDialog(sm->currentIndex());
}
break;
......
......@@ -110,12 +110,12 @@ public:
/// Explicilty add the contained custom rules to an attribute resource.
bool registerRulesTo(smtk::attribute::Resource::Ptr& resource) const
{
for (auto& registerFunction : m_associationRegisterFunctions)
for (const auto& registerFunction : m_associationRegisterFunctions)
{
registerFunction.second(*resource);
}
for (auto& registerFunction : m_dissociationRegisterFunctions)
for (const auto& registerFunction : m_dissociationRegisterFunctions)
{
registerFunction.second(*resource);
}
......@@ -214,7 +214,7 @@ protected:
if (auto manager = m_manager.lock())
{
// ...remove the rule from all of its attribute resources.
for (auto resource : manager->find<smtk::attribute::Resource>())
for (const auto& resource : manager->find<smtk::attribute::Resource>())
{
Trait<BaseRuleType>::factory(*resource).template unregisterType<CustomRuleType>();
}
......
......@@ -77,7 +77,7 @@ public:
// Explicitly add the contained Evaluator types to an attribute resource.
bool registerEvaluatorsTo(smtk::attribute::Resource::Ptr& resource) const
{
for (auto& registerFunction : m_registerFunctions)
for (const auto& registerFunction : m_registerFunctions)
{
registerFunction.second(*resource);
}
......@@ -144,7 +144,7 @@ public:
// If there is an associated resource manager...
if (auto manager = m_manager.lock())
{
for (auto resource : manager->find<smtk::attribute::Resource>())
for (const auto& resource : manager->find<smtk::attribute::Resource>())
{
// ...remove the Evaluator from all of its attribute resources.
resource->evaluatorFactory().unregisterEvaluator<EvaluatorType>();
......
......@@ -87,7 +87,7 @@ public:
/// resource.
bool registerDefinitionsTo(smtk::attribute::Resource::Ptr& resource) const
{
for (auto& registerFunction : m_registerFunctions)
for (const auto& registerFunction : m_registerFunctions)
{
registerFunction.second(*resource);
}
......@@ -154,7 +154,7 @@ public:
if (auto manager = m_manager.lock())
{
// ...remove the definition from all of its attribute resources.
for (auto resource : manager->find<smtk::attribute::Resource>())
for (const auto& resource : manager->find<smtk::attribute::Resource>())
{
resource->customItemDefinitionFactory().unregisterType<CustomDefinitionType>();
}
......
......@@ -201,7 +201,7 @@ static void processDerivedValueDefFromJson(
std::string discreteEnum = defPtr->discreteEnum(i);
if (itemsValue != structure->end())
{
for (auto currentItem : *itemsValue)
for (const auto& currentItem : *itemsValue)
{
defPtr->addConditionalItem(discreteEnum, currentItem);
}
......
......@@ -53,7 +53,7 @@ struct SMTKCORE_EXPORT SelectionFootprint
const smtk::geometry::Backend& backend) const override
{
bool hasFootprint = false;
auto attr = dynamic_cast<smtk::attribute::Attribute*>(&selectedObject);
auto* attr = dynamic_cast<smtk::attribute::Attribute*>(&selectedObject);
if (attr)
{
// If the attribute has geometry, use it:
......
......@@ -31,10 +31,10 @@ template<
typename base_type>
void to_json(json& j, const Links<id_type, left_type, right_type, role_type, base_type>& links)
{
for (auto link : links)
for (const auto& link : links)
{
json jlink;
const base_type& base = static_cast<base_type&>(link);
const base_type& base = static_cast<const base_type&>(link);
jlink["id"] = link.id;
jlink["base"] = base;
jlink["left"] = link.left;
......
......@@ -24,8 +24,8 @@ py::class_< smtk::extension::vtk::io::mesh::ExportVTKData > pybind11_init_smtk_e
.def(py::init<>())
.def("__call__", (bool (smtk::extension::vtk::io::mesh::ExportVTKData::*)(::std::string const &, ::smtk::mesh::ResourcePtr, ::std::string) const) &smtk::extension::vtk::io::mesh::ExportVTKData::operator(), py::arg("filename"), py::arg("resource"), py::arg("domainPropertyName") = "")
.def("__call__", (bool (smtk::extension::vtk::io::mesh::ExportVTKData::*)(::std::string const &, ::smtk::mesh::MeshSet const &, ::std::string) const) &smtk::extension::vtk::io::mesh::ExportVTKData::operator(), py::arg("filename"), py::arg("meshset"), py::arg("domainPropertyName") = "")
.def("__call__", [&](const smtk::extension::vtk::io::mesh::ExportVTKData& exportData, ::smtk::mesh::MeshSet const & ms, ::vtkDataSet* ds){ if (auto pd = vtkPolyData::SafeDownCast(ds)){ return exportData(ms, pd);} else if (auto ug = vtkUnstructuredGrid::SafeDownCast(ds)){ return exportData(ms, ug);}})
.def("__call__", [&](const smtk::extension::vtk::io::mesh::ExportVTKData& exportData, ::smtk::mesh::MeshSet const & ms, ::vtkDataSet* ds, const std::string& domain){ if (auto pd = vtkPolyData::SafeDownCast(ds)){ return exportData(ms, pd, domain);} else if (auto ug = vtkUnstructuredGrid::SafeDownCast(ds)){ return exportData(ms, ug, domain);}})
.def("__call__", [&](const smtk::extension::vtk::io::mesh::ExportVTKData& exportData, ::smtk::mesh::MeshSet const & ms, ::vtkDataSet* ds){ if (auto *pd = vtkPolyData::SafeDownCast(ds)){ return exportData(ms, pd);} else if (auto *ug = vtkUnstructuredGrid::SafeDownCast(ds)){ return exportData(ms, ug);}})
.def("__call__", [&](const smtk::extension::vtk::io::mesh::ExportVTKData& exportData, ::smtk::mesh::MeshSet const & ms, ::vtkDataSet* ds, const std::string& domain){ if (auto *pd = vtkPolyData::SafeDownCast(ds)){ return exportData(ms, pd, domain);} else if (auto *ug = vtkUnstructuredGrid::SafeDownCast(ds)){ return exportData(ms, ug, domain);}})
;
return instance;
}
......
......@@ -44,7 +44,7 @@ public:
auto rsrc = std::dynamic_pointer_cast<smtk::mesh::Resource>(std::get<0>(in));
if (rsrc)
{
auto provider = new Geometry(rsrc);
auto* provider = new Geometry(rsrc);
return GeometryPtr(provider);
}
throw std::invalid_argument("Not a mesh resource.");
......
......@@ -62,10 +62,10 @@ struct SMTKCORE_EXPORT SelectionFootprint
bool hasGeometry(smtk::resource::PersistentObject& object, const smtk::geometry::Backend& backend)
const
{
auto resource = dynamic_cast<smtk::geometry::Resource*>(&object);
auto* resource = dynamic_cast<smtk::geometry::Resource*>(&object);
if (!resource)
{
auto component = dynamic_cast<smtk::resource::Component*>(&object);
auto* component = dynamic_cast<smtk::resource::Component*>(&object);
if (component)
{
resource = dynamic_cast<smtk::geometry::Resource*>(component->resource().get());
......@@ -89,7 +89,7 @@ struct SMTKCORE_EXPORT SelectionFootprint
std::unordered_set<smtk::resource::PersistentObject*>& footprint,
const smtk::geometry::Backend& backend) const
{
auto resource = dynamic_cast<smtk::geometry::Resource*>(&object);
auto* resource = dynamic_cast<smtk::geometry::Resource*>(&object);
if (!resource)
{
return false;
......
......@@ -265,7 +265,7 @@ public:
bool disassociateAttributes(const T& attribPtrs)
{
bool removedAny = false;
for (auto attribPtr : attribPtrs)
for (const auto& attribPtr : attribPtrs)
{
removedAny |= this->disassociateAttribute(attribPtr->attributeResource(), attribPtr->id());
}
......
......@@ -127,7 +127,7 @@ Container Instance::divide(bool merge, Container* clonesIncluded)
std::set<int> taken;
Container tmp;
this->divideMapInternal(*this, taken, merge, output, clonesIncluded);
auto tess = this->generateTessellation();
auto* tess = this->generateTessellation();
std::size_t size = static_cast<std::size_t>(tess->coords().size() / 3);
std::vector<int> untaken;
......
......@@ -54,12 +54,12 @@ struct SMTKCORE_EXPORT SelectionFootprint
{
return hasFootprint;
}
auto ent = dynamic_cast<smtk::model::Entity*>(&selectedObject);
auto* ent = dynamic_cast<smtk::model::Entity*>(&selectedObject);
if (!ent)
{
return hasFootprint;
}
auto resource = dynamic_cast<smtk::geometry::Resource*>(ent->resource().get());
auto* resource = dynamic_cast<smtk::geometry::Resource*>(ent->resource().get());
if (!resource)
{
return hasFootprint;
......@@ -92,7 +92,7 @@ struct SMTKCORE_EXPORT SelectionFootprint
{
auto members =
smtk::model::Group(ent->shared_from_this()).members<smtk::model::EntityRefs>();
for (auto member : members)
for (const auto& member : members)
{
hasFootprint |= this->addComponentFootprint(member.entityRecord().get(), footprint, geom);
}
......
......@@ -126,7 +126,7 @@ protected:
template<typename Manager>
ClientFor<Manager>::~ClientFor()
{
for (auto base_registry : m_registries)
for (auto* base_registry : m_registries)
{
delete base_registry;
}
......
......@@ -351,7 +351,7 @@ std::set<std::shared_ptr<ProjectType>> Manager::find()
{
std::set<std::shared_ptr<Project>> tmp = this->find(smtk::common::typeName<ProjectType>());
std::set<std::shared_ptr<ProjectType>> projects;
for (auto& project : tmp)
for (const auto& project : tmp)
{
projects.insert(std::static_pointer_cast<ProjectType>(project));
}
......
......@@ -333,7 +333,7 @@ std::set<smtk::shared_ptr<ResourceType>> Manager::find()
{
Resource::Index index(typeid(ResourceType).hash_code());
std::set<Resource::Index> validIndices;
for (auto& metadatum : m_metadata)
for (const auto& metadatum : m_metadata)
{
if (metadatum.m_parentIndices.find(index) != metadatum.m_parentIndices.end())
{
......@@ -347,7 +347,7 @@ std::set<smtk::shared_ptr<ResourceType>> Manager::find()
ScopedLockGuard guard(m_lock, LockType::Read);
typedef Container::index<IndexTag>::type ResourcesByIndex;
ResourcesByIndex& resources = m_resources.get<IndexTag>();
for (auto& idx : validIndices)
for (const auto& idx : validIndices)
{
auto resourceItRange = resources.equal_range(idx);
for (auto& it = resourceItRange.first; it != resourceItRange.second; ++it)
......
......@@ -262,10 +262,10 @@ Collection Resource::findAs(const std::string& queryString) const
template<typename QueryType>
SMTKCORE_NO_EXPORT QueryType& queryForObject(const PersistentObject& object)
{
auto resource = dynamic_cast<const Resource*>(&object);
const auto* resource = dynamic_cast<const Resource*>(&object);
if (!resource)
{
const auto component = dynamic_cast<const Component*>(&object);
const auto* const component = dynamic_cast<const Component*>(&object);
if (component)
{
resource = component->resource().get();
......
......@@ -73,7 +73,7 @@ public:
auto rsrc = std::dynamic_pointer_cast<smtk::session::mesh::Resource>(std::get<0>(in));
if (rsrc)
{
auto provider = new vtk::Geometry(rsrc);
auto* provider = new vtk::Geometry(rsrc);
return GeometryPtr(provider);
}
throw std::invalid_argument("Not a mesh session resource.");
......
......@@ -39,7 +39,7 @@ public:
auto rsrc = std::dynamic_pointer_cast<smtk::session::vtk::Resource>(std::get<0>(in));
if (rsrc)
{
auto provider = new Geometry(rsrc);
auto* provider = new Geometry(rsrc);
return GeometryPtr(provider);
}
throw std::invalid_argument("Not a VTK-session resource.");
......
......@@ -288,7 +288,7 @@ public:
/// Visit every selected object with the given functor.
void visitSelection(std::function<void(Object::Ptr, int)> visitor)
{
for (auto entry : m_selection)
for (const auto& entry : m_selection)
{
visitor(entry.first, entry.second);
}
......@@ -354,7 +354,7 @@ T& Selection::currentSelectionByValue(T& selection, int value, bool exactMatch)
{
if (exactMatch)
{
for (auto entry : m_selection)
for (const auto& entry : m_selection)
{
if ((entry.second & value) == value)
{
......@@ -368,7 +368,7 @@ T& Selection::currentSelectionByValue(T& selection, int value, bool exactMatch)
}
else
{
for (auto entry : m_selection)
for (const auto& entry : m_selection)
{
if (entry.second & value)
{
......@@ -442,13 +442,13 @@ bool Selection::modifySelection(
if (!willErase.empty())
{
modified = true;
for (auto key : willErase)
for (const auto& key : willErase)
{
m_selection.erase(key);
}
}
}
for (auto object : objects)
for (const auto& object : objects)
{
modified |= this->performAction(object, value, action, suggestions, bitwise);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment