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 /autotests/kconfig_compiler/test3a.h.ref | |
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 'autotests/kconfig_compiler/test3a.h.ref')
-rw-r--r-- | autotests/kconfig_compiler/test3a.h.ref | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/autotests/kconfig_compiler/test3a.h.ref b/autotests/kconfig_compiler/test3a.h.ref index dbe009dc..3cdf1677 100644 --- a/autotests/kconfig_compiler/test3a.h.ref +++ b/autotests/kconfig_compiler/test3a.h.ref @@ -23,7 +23,7 @@ class Test3a : public KConfigSkeleton */ void setAutoSave( bool v ) { - if (!isImmutable( QStringLiteral( "AutoSave" ) )) + if (!isAutoSaveImmutable()) mAutoSave = v; } @@ -36,6 +36,14 @@ class Test3a : public KConfigSkeleton } /** + Is Enable automatic saving of calendar Immutable + */ + bool isAutoSaveImmutable() const + { + return isImmutable( QStringLiteral( "AutoSave" ) ); + } + + /** Get Item object corresponding to AutoSave() */ ItemBool *autoSaveItem() @@ -48,7 +56,7 @@ class Test3a : public KConfigSkeleton */ void setBlubb( int v ) { - if (!isImmutable( QStringLiteral( "Blubb" ) )) + if (!isBlubbImmutable()) mBlubb = v; } @@ -61,6 +69,14 @@ class Test3a : public KConfigSkeleton } /** + Is Blubb Immutable + */ + bool isBlubbImmutable() const + { + return isImmutable( QStringLiteral( "Blubb" ) ); + } + + /** Get Item object corresponding to Blubb() */ ItemInt *blubbItem() @@ -73,7 +89,7 @@ class Test3a : public KConfigSkeleton */ void setBlahBlah( const QString & v ) { - if (!isImmutable( QStringLiteral( "BlahBlah" ) )) + if (!isBlahBlahImmutable()) mBlahBlah = v; } @@ -86,6 +102,14 @@ class Test3a : public KConfigSkeleton } /** + Is BlahBlah Immutable + */ + bool isBlahBlahImmutable() const + { + return isImmutable( QStringLiteral( "BlahBlah" ) ); + } + + /** Get Item object corresponding to BlahBlah() */ ItemString *blahBlahItem() @@ -98,7 +122,7 @@ class Test3a : public KConfigSkeleton */ void setMyPassword( const QString & v ) { - if (!isImmutable( QStringLiteral( "MyPassword" ) )) + if (!isMyPasswordImmutable()) mMyPassword = v; } @@ -111,6 +135,14 @@ class Test3a : public KConfigSkeleton } /** + Is MyPassword Immutable + */ + bool isMyPasswordImmutable() const + { + return isImmutable( QStringLiteral( "MyPassword" ) ); + } + + /** Get Item object corresponding to MyPassword() */ ItemPassword *myPasswordItem() |