• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1{% from "macros.tmpl" import license -%}
2{{ license() }}
3
4#ifndef SettingsMacros_h
5#define SettingsMacros_h
6
7#define SETTINGS_GETTERS_AND_SETTERS \
8{%- for setting in settings %}
9    {{setting.type|to_passing_type}} {{setting.name}}() const { return m_{{setting.name}}; } \
10    void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}); \
11{%- endfor %}
12// End of SETTINGS_GETTERS_AND_SETTERS.
13
14#define SETTINGS_MEMBER_VARIABLES \
15{%- for setting in settings if setting.type != "bool" %}
16    {{setting.type}} m_{{setting.name}}; \
17{%- endfor %}
18{%- for setting in settings if setting.type == "bool" %}
19    bool m_{{setting.name}} : 1; \
20{%- endfor %}
21// End of SETTINGS_MEMBER_VARIABLES.
22
23#define SETTINGS_INITIALIZER_LIST \
24{%- for setting in settings if setting.initial  and setting.type != "bool" %}
25    , m_{{setting.name}}({{setting.initial}}) \
26{%- endfor %}
27{%- for setting in settings if setting.initial and setting.type == "bool" %}
28    , m_{{setting.name}}({{setting.initial}}) \
29{%- endfor %}
30// End of SETTINGS_INITIALIZER_LIST.
31
32#define SETTINGS_SETTER_BODIES \
33{%- for setting in settings %}
34void Settings::set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}) \
35{ \
36    if (m_{{setting.name}} == {{setting.name}}) \
37        return; \
38    m_{{setting.name}} = {{setting.name}}; \
39    {%- if setting.invalidate %}
40    invalidate(SettingsDelegate::{{setting.invalidate}}Change); \
41    {%- endif  %}
42} \
43{%- endfor %}
44// End of SETTINGS_SETTER_BODIES.
45
46#endif // SettingsMacros_h
47