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/test9.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/test9.h.ref')
-rw-r--r-- | autotests/kconfig_compiler/test9.h.ref | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/autotests/kconfig_compiler/test9.h.ref b/autotests/kconfig_compiler/test9.h.ref index 6e40cf48..7c95b1d1 100644 --- a/autotests/kconfig_compiler/test9.h.ref +++ b/autotests/kconfig_compiler/test9.h.ref @@ -21,7 +21,7 @@ class Test9 : public KConfigSkeleton */ void setMyStringList( const QStringList & v ) { - if (!isImmutable( QStringLiteral( "MyStringList" ) )) + if (!isMyStringListImmutable()) mMyStringList = v; } @@ -34,11 +34,19 @@ class Test9 : public KConfigSkeleton } /** + Is MyStringList Immutable + */ + bool isMyStringListImmutable() const + { + return isImmutable( QStringLiteral( "MyStringList" ) ); + } + + /** Set This is a list of paths */ void setMyPathList( const QStringList & v ) { - if (!isImmutable( QStringLiteral( "MyPathList" ) )) + if (!isMyPathListImmutable()) mMyPathList = v; } @@ -51,11 +59,19 @@ class Test9 : public KConfigSkeleton } /** + Is This is a list of paths Immutable + */ + bool isMyPathListImmutable() const + { + return isImmutable( QStringLiteral( "MyPathList" ) ); + } + + /** Set This is an additional test for PathList */ void setMyPathsList2( const QStringList & v ) { - if (!isImmutable( QStringLiteral( "MyPathsList2" ) )) + if (!isMyPathsList2Immutable()) mMyPathsList2 = v; } @@ -67,6 +83,14 @@ class Test9 : public KConfigSkeleton return mMyPathsList2; } + /** + Is This is an additional test for PathList Immutable + */ + bool isMyPathsList2Immutable() const + { + return isImmutable( QStringLiteral( "MyPathsList2" ) ); + } + protected: public: QString mParamtransport; |