aboutsummaryrefslogtreecommitdiff
path: root/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kconfig_compiler/KConfigCodeGeneratorBase.cpp')
-rw-r--r--src/kconfig_compiler/KConfigCodeGeneratorBase.cpp54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp b/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp
index 5a110b2e..239c906c 100644
--- a/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp
+++ b/src/kconfig_compiler/KConfigCodeGeneratorBase.cpp
@@ -184,39 +184,51 @@ QString KConfigCodeGeneratorBase::memberAccessorBody(const CfgEntry *e, bool glo
return result;
}
-void KConfigCodeGeneratorBase::createIfSetLogic(const CfgEntry *e, const QString &varExpression)
+void KConfigCodeGeneratorBase::memberImmutableBody(const CfgEntry *e, bool globalEnums)
{
- const QString n = e->name;
- const QString t = e->type;
- const bool hasBody = !e->signalList.empty() || m_cfg.generateProperties;
+ QString n = e->name;
+ QString t = e->type;
- m_stream << whitespace() << "if (";
- if (hasBody) {
- m_stream << "v != " << varExpression << " && ";
- }
- m_stream << "!" << m_this << "isImmutable( QStringLiteral( \"";
+ stream() << whitespace() << "return " << m_this << "isImmutable( QStringLiteral( \"";
if (!e->param.isEmpty()) {
- QString paramName = e->paramName;
-
- m_stream << paramName.replace(QStringLiteral("$(") + e->param + QStringLiteral(")"), QLatin1String("%1")) << "\" ).arg( ";
+ stream() << QString(e->paramName).replace(QLatin1String("$(") + e->param + QLatin1Char(')'), QLatin1String("%1")) << "\" ).arg( ";
if (e->paramType == QLatin1String("Enum")) {
- m_stream << "QLatin1String( ";
+ stream() << "QLatin1String( ";
- if (m_cfg.globalEnums) {
- m_stream << enumName(e->param) << "ToString[i]";
+ if (globalEnums) {
+ stream() << enumName(e->param) << "ToString[i]";
} else {
- m_stream << enumName(e->param) << "::enumToString[i]";
+ stream() << enumName(e->param) << "::enumToString[i]";
}
- m_stream << " )";
+ stream() << " )";
} else {
- m_stream << "i";
+ stream() << "i";
}
- m_stream << " )";
+ stream() << " )";
} else {
- m_stream << n << "\" )";
+ stream() << n << "\" )";
+ }
+ stream() << " );" << endl;
+}
+
+void KConfigCodeGeneratorBase::createIfSetLogic(const CfgEntry *e, const QString &varExpression)
+{
+ const QString n = e->name;
+ const QString t = e->type;
+ const bool hasBody = !e->signalList.empty() || m_cfg.generateProperties;
+
+ m_stream << whitespace() << "if (";
+ if (hasBody) {
+ m_stream << "v != " << varExpression << " && ";
+ }
+
+ const auto immutablefunction = immutableFunction(n, m_cfg.dpointer ? m_cfg.className : QString());
+ m_stream << "!" << m_this << immutablefunction << "(";
+ if (!e->param.isEmpty()) {
+ m_stream << " i ";
}
- m_stream << " ))";
+ m_stream << "))";
}
void KConfigCodeGeneratorBase::memberMutatorBody(const CfgEntry *e)