diff options
author | jan Iversen <jani@apache.org> | 2018-07-01 22:26:27 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-07 09:44:06 -0700 |
commit | 7ee1aab7286d529d5ae8e32ef0c43bef1cab912a (patch) | |
tree | d37a87ccc3ae63fb40b1fc1a85972dd1cae00a67 | |
parent | ce358fdb68f00291abae28fc717506cd13a40f11 (diff) | |
download | subsurface-7ee1aab7286d529d5ae8e32ef0c43bef1cab912a.tar.gz |
core: add macros to replace getter functions
Add macros to handle full getter functions
Remark: it is assumed the name of getter function is identical to
the name in struct preferences.
Signed-off-by: Jan Iversen <jani@apache.org>
-rw-r--r-- | core/settings/qPref_private.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/core/settings/qPref_private.h b/core/settings/qPref_private.h index e2e8f350c..ebe266581 100644 --- a/core/settings/qPref_private.h +++ b/core/settings/qPref_private.h @@ -101,4 +101,36 @@ void qPref ## class::disk_ ## field(bool doSync) \ { \ LOADSYNC_TXT(name, field); \ } + + +//******* Macros to generate get function +#define GET_PREFERENCE_BOOL(class, field) \ +bool qPref ## class::field () const \ +{ \ + return prefs.field; \ +} + +#define GET_PREFERENCE_DOUBLE(class, field) \ +double qPref ## class::field () const \ +{ \ + return prefs.field; \ +} + +#define GET_PREFERENCE_ENUM(class, type, field) \ +struct type qPref ## class:: ## field () const \ +{ \ + return prefs.field; \ +} + +#define GET_PREFERENCE_INT(class, field) \ +int qPref ## class::field () const \ +{ \ + return prefs.field; \ +} + +#define GET_PREFERENCE_TXT(class, field) \ +const QString qPref ## class::field () const \ +{ \ + return prefs.field; \ +} #endif |