diff options
author | Méven Car <meven.car@enioka.com> | 2020-02-04 16:03:52 +0100 |
---|---|---|
committer | Méven Car <meven29@gmail.com> | 2020-02-04 16:09:29 +0100 |
commit | d46739294d04c72af1e434e414e1c012d7e78a42 (patch) | |
tree | 5a227069a6a1a110cc26b788ff8a3bd99005735e /src/kconfig_compiler/KConfigCodeGeneratorBase.h | |
parent | fd0e26ddb49122fa55bdc8f35e189c832cc138ad (diff) | |
download | kconfig-d46739294d04c72af1e434e414e1c012d7e78a42.tar.gz kconfig-d46739294d04c72af1e434e414e1c012d7e78a42.tar.bz2 |
Add an is<PropertyName>Immutable to know if a property is immutable
Summary:
Add a utility function is<Parameter>Immutable to access immutability quickly.
Generated classes uses them internally to avoid code redundance.
Sample:
```
/**
Set blocked-by-default
*/
void setBlockedByDefault( bool v )
{
if (v != mBlockedByDefault && !isBlockedByDefaultImmutable() ) {
mBlockedByDefault = v;
Q_EMIT blockedByDefaultChanged();
}
}
/**
Is blocked-by-default Immutable
*/
bool isBlockedByDefaultImmutable()
{
return isImmutable( QStringLiteral( "blockedByDefault" ) );
}
```
```
/**
Set org.kde.ActivityManager.ResourceScoringEnabled
*/
void setResourceScoringEnabled( bool v )
{
if (!isResourceScoringEnabledImmutable() )
mResourceScoringEnabled = v;
}
/**
Is org.kde.ActivityManager.ResourceScoringEnabled Immutable
*/
bool isResourceScoringEnabledImmutable()
{
return isImmutable( QStringLiteral( "resourceScoringEnabled" ) );
}
```
Reviewers: ervin, #frameworks, dfaure
Reviewed By: ervin
Subscribers: dfaure, tcanabrava, kde-frameworks-devel
Tags: #frameworks
Differential Revision: https://phabricator.kde.org/D26368
Diffstat (limited to 'src/kconfig_compiler/KConfigCodeGeneratorBase.h')
-rw-r--r-- | src/kconfig_compiler/KConfigCodeGeneratorBase.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/kconfig_compiler/KConfigCodeGeneratorBase.h b/src/kconfig_compiler/KConfigCodeGeneratorBase.h index 5bbc6b71..0c815c9b 100644 --- a/src/kconfig_compiler/KConfigCodeGeneratorBase.h +++ b/src/kconfig_compiler/KConfigCodeGeneratorBase.h @@ -82,6 +82,9 @@ public: // TODO: write to the stream directly without returning a QString. QString memberAccessorBody(const CfgEntry *e, bool globalEnums) const; + // Implements the is<Param>Immutable for the CfgEntry + void memberImmutableBody(const CfgEntry *e, bool globalEnums); + // Implements the `Set` methods for the CfgEntry void memberMutatorBody(const CfgEntry *e); |