diff options
author | Laurent Montel <montel@kde.org> | 2021-08-28 18:05:30 +0200 |
---|---|---|
committer | Laurent Montel <montel@kde.org> | 2021-08-28 18:05:30 +0200 |
commit | dffdff73fa98a4fdebca38fb4a41938541ffb1c1 (patch) | |
tree | 7f1c9fb2c402eef2b7ecc90ec9d31cc506160b1e /src/kconfig_compiler | |
parent | 3259a6e6530cb0526bf71733ba28015f481f056e (diff) | |
download | kconfig-dffdff73fa98a4fdebca38fb4a41938541ffb1c1.tar.gz kconfig-dffdff73fa98a4fdebca38fb4a41938541ffb1c1.tar.bz2 |
GIT_SILENT: we can use std::as_const directly
Diffstat (limited to 'src/kconfig_compiler')
-rw-r--r-- | src/kconfig_compiler/KConfigCodeGeneratorBase.cpp | 2 | ||||
-rw-r--r-- | src/kconfig_compiler/KConfigHeaderGenerator.cpp | 20 | ||||
-rw-r--r-- | src/kconfig_compiler/KConfigSourceGenerator.cpp | 24 | ||||
-rw-r--r-- | src/kconfig_compiler/kconfig_compiler.cpp | 2 |
4 files changed, 24 insertions, 24 deletions
diff --git a/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp b/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp index 0effd7e5..78a5fa0a 100644 --- a/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp +++ b/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp @@ -255,7 +255,7 @@ void KConfigCodeGeneratorBase::memberMutatorBody(const CfgEntry *e) m_stream << whitespace() << " " << varExpression << " = v;\n"; const auto listSignal = e->signalList; - for (const Signal &signal : qAsConst(listSignal)) { + for (const Signal &signal : std::as_const(listSignal)) { if (signal.modify) { m_stream << whitespace() << " Q_EMIT " << m_this << signal.name << "();\n"; } else { diff --git a/src/kconfig_compiler/KConfigHeaderGenerator.cpp b/src/kconfig_compiler/KConfigHeaderGenerator.cpp index 24829ff5..2c5126d5 100644 --- a/src/kconfig_compiler/KConfigHeaderGenerator.cpp +++ b/src/kconfig_compiler/KConfigHeaderGenerator.cpp @@ -52,7 +52,7 @@ void KConfigHeaderGenerator::doClassDefinition() createConstructor(); createDestructor(); - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { const QString returnType = (cfg().useEnumTypes && entry->type == QLatin1String("Enum")) ? enumType(entry, cfg().globalEnums) : cppType(entry->type); createSetters(entry); @@ -81,7 +81,7 @@ void KConfigHeaderGenerator::doClassDefinition() } // Class Parameters - for (const auto ¶meter : qAsConst(parseResult.parameters)) { + for (const auto ¶meter : std::as_const(parseResult.parameters)) { stream() << whitespace() << "" << cppType(parameter.type) << " mParam" << parameter.name << ";\n"; } @@ -152,7 +152,7 @@ void KConfigHeaderGenerator::implementChoiceEnums(const CfgEntry *entry, const C } QStringList values; - for (const auto &choice : qAsConst(chlist)) { + for (const auto &choice : std::as_const(chlist)) { values.append(choices.prefix + choice.name); } @@ -201,7 +201,7 @@ void KConfigHeaderGenerator::implementEnums() return; } - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { const CfgEntry::Choices &choices = entry->choices; const QStringList values = entry->paramValues; @@ -246,7 +246,7 @@ void KConfigHeaderGenerator::createSignals() stream() << whitespace() << "};" << Qt::dec << "\n\n"; stream() << " Q_SIGNALS:"; - for (const Signal &signal : qAsConst(parseResult.signalList)) { + for (const Signal &signal : std::as_const(parseResult.signalList)) { stream() << '\n'; if (!signal.label.isEmpty()) { stream() << whitespace() << "/**\n"; @@ -261,7 +261,7 @@ void KConfigHeaderGenerator::createSignals() Param argument = *it; QString type = param(argument.type); if (cfg().useEnumTypes && argument.type == QLatin1String("Enum")) { - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { if (entry->name == argument.name) { type = enumType(entry, cfg().globalEnums); break; @@ -290,7 +290,7 @@ void KConfigHeaderGenerator::createDPointer() // use a private class for both member variables and items stream() << " private:\n"; - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { if (cfg().allDefaultGetters || cfg().defaultGetters.contains(entry->name)) { stream() << whitespace() << ""; if (cfg().staticAccessors) { @@ -327,7 +327,7 @@ void KConfigHeaderGenerator::createConstructor() } bool first = true; - for (const auto ¶meter : qAsConst(parseResult.parameters)) { + for (const auto ¶meter : std::as_const(parseResult.parameters)) { if (first) { first = false; } else { @@ -587,7 +587,7 @@ void KConfigHeaderGenerator::createNonDPointerHelpers() } QString group; - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { if (entry->group != group) { group = entry->group; stream() << '\n'; @@ -614,7 +614,7 @@ void KConfigHeaderGenerator::createNonDPointerHelpers() stream() << "\n private:\n"; if (cfg().itemAccessors) { - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { stream() << whitespace() << "Item" << itemType(entry->type) << " *" << itemVar(entry, cfg()); if (!entry->param.isEmpty()) { stream() << QStringLiteral("[%1]").arg(entry->paramMax + 1); diff --git a/src/kconfig_compiler/KConfigSourceGenerator.cpp b/src/kconfig_compiler/KConfigSourceGenerator.cpp index e221d1ab..a8a05f4b 100644 --- a/src/kconfig_compiler/KConfigSourceGenerator.cpp +++ b/src/kconfig_compiler/KConfigSourceGenerator.cpp @@ -92,7 +92,7 @@ void KConfigSourceGenerator::createPrivateDPointerImplementation() stream() << " public:\n"; // Create Members - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { if (entry->group != group) { group = entry->group; stream() << '\n'; @@ -107,7 +107,7 @@ void KConfigSourceGenerator::createPrivateDPointerImplementation() stream() << "\n // items\n"; // Create Items. - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { const QString declType = entry->signalList.isEmpty() ? QString(cfg().inherits + QStringLiteral("::Item") + itemType(entry->type)) : QStringLiteral("KConfigCompilerSignallingItem"); @@ -187,7 +187,7 @@ void KConfigSourceGenerator::createSingletonImplementation() void KConfigSourceGenerator::createPreamble() { QString cppPreamble; - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { if (entry->paramValues.isEmpty()) { continue; } @@ -250,7 +250,7 @@ void KConfigSourceGenerator::createParentConstructorCall() void KConfigSourceGenerator::createInitializerList() { - for (const auto ¶meter : qAsConst(parseResult.parameters)) { + for (const auto ¶meter : std::as_const(parseResult.parameters)) { stream() << " , mParam" << parameter.name << "(" << parameter.name << ")\n"; } @@ -266,7 +266,7 @@ void KConfigSourceGenerator::createEnums(const CfgEntry *entry) } stream() << " QList<" << cfg().inherits << "::ItemEnum::Choice> values" << entry->name << ";\n"; - for (const auto &choice : qAsConst(entry->choices.choices)) { + for (const auto &choice : std::as_const(entry->choices.choices)) { stream() << " {\n"; stream() << " " << cfg().inherits << "::ItemEnum::Choice choice;\n"; stream() << " choice.name = QStringLiteral(\"" << choice.name << "\");\n"; @@ -312,7 +312,7 @@ void KConfigSourceGenerator::createNormalEntry(const CfgEntry *entry, const QStr stream() << " " << itemVarStr << "->setWriteFlags(KConfigBase::Notify);\n"; } - for (const CfgEntry::Choice &choice : qAsConst(entry->choices.choices)) { + for (const CfgEntry::Choice &choice : std::as_const(entry->choices.choices)) { if (!choice.val.isEmpty()) { stream() << " " << itemVarStr << "->setValueForChoice(QStringLiteral( \"" << choice.name << "\" ), QStringLiteral( \"" << choice.val << "\" ));\n"; } @@ -361,7 +361,7 @@ void KConfigSourceGenerator::createIndexedEntry(const CfgEntry *entry, const QSt stream() << " " << innerItemVarStr << "->setMaxValue(" << entry->max << ");\n"; } - for (const CfgEntry::Choice &choice : qAsConst(entry->choices.choices)) { + for (const CfgEntry::Choice &choice : std::as_const(entry->choices.choices)) { if (!choice.val.isEmpty()) { stream() << " " << itemVarStr << "->setValueForChoice(QStringLiteral( \"" << choice.name << "\" ), QStringLiteral( \"" << choice.val << "\" ));\n"; @@ -461,7 +461,7 @@ void KConfigSourceGenerator::doConstructor() stream() << '\n'; } - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { handleCurrentGroupChange(entry); const QString key = paramString(entry->key, parseResult.parameters); @@ -572,7 +572,7 @@ void KConfigSourceGenerator::doGetterSetterDPointerMode() } // setters and getters go in Cpp if in dpointer mode - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { createSetterDPointerMode(entry); createGetterDPointerMode(entry); createImmutableGetterDPointerMode(entry); @@ -584,7 +584,7 @@ void KConfigSourceGenerator::doGetterSetterDPointerMode() void KConfigSourceGenerator::createDefaultValueGetterSetter() { // default value getters always go in Cpp - for (const auto *entry : qAsConst(parseResult.entries)) { + for (const auto *entry : std::as_const(parseResult.entries)) { QString n = entry->name; QString t = entry->type; @@ -627,7 +627,7 @@ void KConfigSourceGenerator::createNonModifyingSignalsHelper() startScope(); stream() << " const bool res = " << cfg().inherits << "::usrSave();\n"; stream() << " if (!res) return false;\n\n"; - for (const Signal &signal : qAsConst(parseResult.signalList)) { + for (const Signal &signal : std::as_const(parseResult.signalList)) { if (signal.modify) { continue; } @@ -682,7 +682,7 @@ void KConfigSourceGenerator::createSignalFlagsHandler() stream() << '\n'; } - for (const Signal &signal : qAsConst(parseResult.signalList)) { + for (const Signal &signal : std::as_const(parseResult.signalList)) { if (signal.modify) { stream() << " if ( flags & " << signalEnumName(signal.name) << " ) {\n"; stream() << " Q_EMIT " << signal.name << "();\n"; diff --git a/src/kconfig_compiler/kconfig_compiler.cpp b/src/kconfig_compiler/kconfig_compiler.cpp index 761e64fc..fb7e7a68 100644 --- a/src/kconfig_compiler/kconfig_compiler.cpp +++ b/src/kconfig_compiler/kconfig_compiler.cpp @@ -773,7 +773,7 @@ int main(int argc, char **argv) } // TODO: Move this to somewhere saner. - for (const auto &signal : qAsConst(parseResult.signalList)) { + for (const auto &signal : std::as_const(parseResult.signalList)) { parseResult.hasNonModifySignals |= !signal.modify; } |