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>
This commit is contained in:
jan Iversen 2018-07-01 22:26:27 +02:00 committed by Dirk Hohndel
parent ce358fdb68
commit 7ee1aab728

View file

@ -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