mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
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:
parent
ce358fdb68
commit
7ee1aab728
1 changed files with 32 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue