aboutsummaryrefslogtreecommitdiff
path: root/autotests/kconfig_compiler/test1.h.ref
diff options
context:
space:
mode:
authorMéven Car <meven.car@enioka.com>2020-02-04 16:03:52 +0100
committerMéven Car <meven29@gmail.com>2020-02-04 16:09:29 +0100
commitd46739294d04c72af1e434e414e1c012d7e78a42 (patch)
tree5a227069a6a1a110cc26b788ff8a3bd99005735e /autotests/kconfig_compiler/test1.h.ref
parentfd0e26ddb49122fa55bdc8f35e189c832cc138ad (diff)
downloadkconfig-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/test1.h.ref')
-rw-r--r--autotests/kconfig_compiler/test1.h.ref90
1 files changed, 81 insertions, 9 deletions
diff --git a/autotests/kconfig_compiler/test1.h.ref b/autotests/kconfig_compiler/test1.h.ref
index 52921ac6..24500176 100644
--- a/autotests/kconfig_compiler/test1.h.ref
+++ b/autotests/kconfig_compiler/test1.h.ref
@@ -26,7 +26,7 @@ class Test1 : public KConfigSkeleton
*/
void setOneOption( bool v )
{
- if (!isImmutable( QStringLiteral( "OneOption" ) ))
+ if (!isOneOptionImmutable())
mOneOption = v;
}
@@ -39,11 +39,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is One option Immutable
+ */
+ bool isOneOptionImmutable() const
+ {
+ return isImmutable( QStringLiteral( "OneOption" ) );
+ }
+
+ /**
Set Another option
*/
void setAnotherOption( int v )
{
- if (!isImmutable( QStringLiteral( "AnotherOption" ) ))
+ if (!isAnotherOptionImmutable())
mAnotherOption = v;
}
@@ -56,11 +64,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is Another option Immutable
+ */
+ bool isAnotherOptionImmutable() const
+ {
+ return isImmutable( QStringLiteral( "AnotherOption" ) );
+ }
+
+ /**
Set This is some funky option
*/
void setListOption( int v )
{
- if (!isImmutable( QStringLiteral( "ListOption" ) ))
+ if (!isListOptionImmutable())
mListOption = v;
}
@@ -73,11 +89,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is This is some funky option Immutable
+ */
+ bool isListOptionImmutable() const
+ {
+ return isImmutable( QStringLiteral( "ListOption" ) );
+ }
+
+ /**
Set This is a string
*/
void setMyString( const QString & v )
{
- if (!isImmutable( QStringLiteral( "MyString" ) ))
+ if (!isMyStringImmutable())
mMyString = v;
}
@@ -90,11 +114,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is This is a string Immutable
+ */
+ bool isMyStringImmutable() const
+ {
+ return isImmutable( QStringLiteral( "MyString" ) );
+ }
+
+ /**
Set This is a path
*/
void setMyPath( const QString & v )
{
- if (!isImmutable( QStringLiteral( "MyPath" ) ))
+ if (!isMyPathImmutable())
mMyPath = v;
}
@@ -107,11 +139,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is This is a path Immutable
+ */
+ bool isMyPathImmutable() const
+ {
+ return isImmutable( QStringLiteral( "MyPath" ) );
+ }
+
+ /**
Set Another option
*/
void setAnotherOption2( int v )
{
- if (!isImmutable( QStringLiteral( "AnotherOption2" ) ))
+ if (!isAnotherOption2Immutable())
mAnotherOption2 = v;
}
@@ -124,11 +164,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is Another option Immutable
+ */
+ bool isAnotherOption2Immutable() const
+ {
+ return isImmutable( QStringLiteral( "AnotherOption2" ) );
+ }
+
+ /**
Set MyStringList
*/
void setMyStringList( const QStringList & v )
{
- if (!isImmutable( QStringLiteral( "MyStringList" ) ))
+ if (!isMyStringListImmutable())
mMyStringList = v;
}
@@ -141,11 +189,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is MyStringList Immutable
+ */
+ bool isMyStringListImmutable() const
+ {
+ return isImmutable( QStringLiteral( "MyStringList" ) );
+ }
+
+ /**
Set MyStringListHidden
*/
void setMyStringListHidden( const QStringList & v )
{
- if (!isImmutable( QStringLiteral( "MyStringListHidden" ) ))
+ if (!isMyStringListHiddenImmutable())
mMyStringListHidden = v;
}
@@ -158,11 +214,19 @@ class Test1 : public KConfigSkeleton
}
/**
+ Is MyStringListHidden Immutable
+ */
+ bool isMyStringListHiddenImmutable() const
+ {
+ return isImmutable( QStringLiteral( "MyStringListHidden" ) );
+ }
+
+ /**
Set List Number
*/
void setMyNumber( int v )
{
- if (!isImmutable( QStringLiteral( "MyNumber" ) ))
+ if (!isMyNumberImmutable())
mMyNumber = v;
}
@@ -174,6 +238,14 @@ class Test1 : public KConfigSkeleton
return mMyNumber;
}
+ /**
+ Is List Number Immutable
+ */
+ bool isMyNumberImmutable() const
+ {
+ return isImmutable( QStringLiteral( "MyNumber" ) );
+ }
+
protected:
QString mParamtransport;
QString mParamfolder;