applied some clang modernize (#2435)

This commit is contained in:
borgmanJeremy
2022-02-16 21:15:25 -06:00
committed by GitHub
parent 53698bca6f
commit 424b7fba37
24 changed files with 82 additions and 75 deletions

View File

@@ -67,10 +67,10 @@ QString optionsToString(const QList<CommandOption>& options,
if (!arguments.isEmpty()) {
result += QObject::tr("Arguments") + ":\n";
}
for (int i = 0; i < arguments.length(); ++i) {
for (const auto& argument : arguments) {
result += QStringLiteral(" %1 %2\n")
.arg(arguments.at(i).name().leftJustified(size, ' '))
.arg(arguments.at(i).description());
.arg(argument.name().leftJustified(size, ' '))
.arg(argument.description());
}
return result;
}
@@ -363,9 +363,8 @@ CommandLineParser::Node* CommandLineParser::findParent(
}
// find the parent in the subNodes recursively
Node* res = nullptr;
for (auto i = m_parseTree.subNodes.begin(); i != m_parseTree.subNodes.end();
++i) {
res = recursiveParentSearch(parent, *i);
for (auto& subNode : m_parseTree.subNodes) {
res = recursiveParentSearch(parent, subNode);
if (res != nullptr) {
break;
}
@@ -381,8 +380,8 @@ CommandLineParser::Node* CommandLineParser::recursiveParentSearch(
if (node.argument == parent) {
res = &node;
} else {
for (auto i = node.subNodes.begin(); i != node.subNodes.end(); ++i) {
res = recursiveParentSearch(parent, *i);
for (auto& subNode : node.subNodes) {
res = recursiveParentSearch(parent, subNode);
if (res != nullptr) {
break;
}