fix (Qt) issues found by clang's clazy tool:
+ -Wclazy-incorrect-emit + -Wclazy-strict-iterators + -Wclazy-overloaded-signal + -Wclazy-qstring-arg + -Wclazy-unused-non-trivial-variable + -Wclazy-container-anti-pattern + -Wclazy-range-loop-reference + -Wclazy-const-signal-or-slot + -Wclazy-detaching-temporary + -Wclazy-qfileinfo-exists
This commit is contained in:
@@ -43,7 +43,7 @@ ExtensionContainer::ExtensionContainer() {
|
||||
ExtensionContainer::~ExtensionContainer() {
|
||||
|
||||
//we need to delete all dynamically added extensions
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.second->isPythonExtension())
|
||||
delete entry.second;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ void ExtensionContainer::registerExtension(Base::Type extension, Extension* ext)
|
||||
|
||||
//no duplicate extensions (including base classes)
|
||||
if(hasExtension(extension)) {
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.first == extension || entry.first.isDerivedFrom(extension)) {
|
||||
_extensions.erase(entry.first);
|
||||
break;
|
||||
@@ -73,7 +73,7 @@ bool ExtensionContainer::hasExtension(Base::Type t, bool derived) const {
|
||||
bool found = _extensions.find(t) != _extensions.end();
|
||||
if(!found && derived) {
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.first.isDerivedFrom(t))
|
||||
return true;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ bool ExtensionContainer::hasExtension(Base::Type t, bool derived) const {
|
||||
bool ExtensionContainer::hasExtension(const std::string& name) const {
|
||||
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.second->name() == name)
|
||||
return true;
|
||||
}
|
||||
@@ -98,11 +98,11 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_
|
||||
auto result = _extensions.find(t);
|
||||
if((result == _extensions.end()) && derived) {
|
||||
//we need to check for derived types
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.first.isDerivedFrom(t))
|
||||
return entry.second;
|
||||
}
|
||||
if(no_except)
|
||||
if(no_except)
|
||||
return nullptr;
|
||||
//if we arrive here we don't have anything matching
|
||||
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
|
||||
@@ -111,7 +111,7 @@ Extension* ExtensionContainer::getExtension(Base::Type t, bool derived, bool no_
|
||||
return result->second;
|
||||
}
|
||||
else {
|
||||
if(no_except)
|
||||
if(no_except)
|
||||
return nullptr;
|
||||
//if we arrive here we don't have anything matching
|
||||
throw Base::TypeError("ExtensionContainer::getExtension: No extension of given type available");
|
||||
@@ -126,7 +126,7 @@ bool ExtensionContainer::hasExtensions() const {
|
||||
Extension* ExtensionContainer::getExtension(const std::string& name) const {
|
||||
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.second->name() == name)
|
||||
return entry.second;
|
||||
}
|
||||
@@ -137,7 +137,7 @@ std::vector< Extension* > ExtensionContainer::getExtensionsDerivedFrom(Base::Typ
|
||||
|
||||
std::vector<Extension*> vec;
|
||||
//and for types derived from it, as they can be cast to the extension
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
if(entry.first.isDerivedFrom(type))
|
||||
vec.push_back(entry.second);
|
||||
}
|
||||
@@ -146,13 +146,13 @@ std::vector< Extension* > ExtensionContainer::getExtensionsDerivedFrom(Base::Typ
|
||||
|
||||
void ExtensionContainer::getPropertyList(std::vector< Property* >& List) const {
|
||||
App::PropertyContainer::getPropertyList(List);
|
||||
for(auto entry : _extensions)
|
||||
for(const auto& entry : _extensions)
|
||||
entry.second->extensionGetPropertyList(List);
|
||||
}
|
||||
|
||||
void ExtensionContainer::getPropertyMap(std::map< std::string, Property* >& Map) const {
|
||||
App::PropertyContainer::getPropertyMap(Map);
|
||||
for(auto entry : _extensions)
|
||||
for(const auto& entry : _extensions)
|
||||
entry.second->extensionGetPropertyMap(Map);
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ Property* ExtensionContainer::getPropertyByName(const char* name) const {
|
||||
if(prop)
|
||||
return prop;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
auto prop = entry.second->extensionGetPropertyByName(name);
|
||||
if(prop)
|
||||
return prop;
|
||||
@@ -176,7 +176,7 @@ short int ExtensionContainer::getPropertyType(const Property* prop) const {
|
||||
if(res != 0)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyType(prop);
|
||||
if(res != 0)
|
||||
return res;
|
||||
@@ -191,7 +191,7 @@ short int ExtensionContainer::getPropertyType(const char* name) const {
|
||||
if(res != 0)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyType(name);
|
||||
if(res != 0)
|
||||
return res;
|
||||
@@ -207,7 +207,7 @@ const char* ExtensionContainer::getPropertyName(const Property* prop) const {
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyName(prop);
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
@@ -222,7 +222,7 @@ const char* ExtensionContainer::getPropertyGroup(const Property* prop) const {
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyGroup(prop);
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
@@ -237,7 +237,7 @@ const char* ExtensionContainer::getPropertyGroup(const char* name) const {
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyGroup(name);
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
@@ -253,7 +253,7 @@ const char* ExtensionContainer::getPropertyDocumentation(const Property* prop) c
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyDocumentation(prop);
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
@@ -268,7 +268,7 @@ const char* ExtensionContainer::getPropertyDocumentation(const char* name) const
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
res = entry.second->extensionGetPropertyDocumentation(name);
|
||||
if(res != nullptr)
|
||||
return res;
|
||||
@@ -281,7 +281,7 @@ void ExtensionContainer::onChanged(const Property* prop) {
|
||||
|
||||
//inform all extensions about changed property. This includes all properties from the
|
||||
//extended object (this) as well as all extension properties
|
||||
for(auto entry : _extensions)
|
||||
for(const auto& entry : _extensions)
|
||||
entry.second->extensionOnChanged(prop);
|
||||
|
||||
App::PropertyContainer::onChanged(prop);
|
||||
@@ -318,7 +318,7 @@ void ExtensionContainer::saveExtensions(Base::Writer& writer) const {
|
||||
//save dynamic extensions
|
||||
writer.incInd(); // indentation for 'Extensions'
|
||||
writer.Stream() << writer.ind() << "<Extensions Count=\"" << _extensions.size() << "\">" << std::endl;
|
||||
for(auto entry : _extensions) {
|
||||
for(const auto& entry : _extensions) {
|
||||
|
||||
auto ext = entry.second;
|
||||
writer.incInd(); // indentation for 'Extension name'
|
||||
|
||||
Reference in New Issue
Block a user