| OLD | NEW |
| 1 {% from "macros.tmpl" import license %} | 1 {% from "macros.tmpl" import license %} |
| 2 {{ license() }} | 2 {{ license() }} |
| 3 | 3 |
| 4 #ifndef SettingsMacros_h | 4 #ifndef SettingsMacros_h |
| 5 #define SettingsMacros_h | 5 #define SettingsMacros_h |
| 6 | 6 |
| 7 #define SETTINGS_GETTERS_AND_SETTERS \ | 7 #define SETTINGS_GETTERS_AND_SETTERS \ |
| 8 {% for setting in settings %} | 8 {% for setting in settings %} |
| 9 {{setting.type|to_passing_type}} get{{setting.name|upper_first}}() const { r
eturn m_{{setting.name}}; } \ | 9 {{setting.type|to_passing_type}} get{{setting.name|upper_first}}() const { r
eturn m_{{setting.name}}; } \ |
| 10 void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{sett
ing.name}}); \ | 10 void set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{sett
ing.name}}); \ |
| 11 {% endfor %} | 11 {% endfor %} |
| 12 void setFromStrings(const String& name, const String& value); | 12 void setFromStrings(const String& name, const String& value); |
| 13 // End of SETTINGS_GETTERS_AND_SETTERS. | 13 // End of SETTINGS_GETTERS_AND_SETTERS. |
| 14 | 14 |
| 15 #define SETTINGS_MEMBER_VARIABLES \ | 15 #define SETTINGS_MEMBER_VARIABLES \ |
| 16 {% for setting in settings if setting.type != 'bool' %} | 16 {% for setting in settings if setting.type != 'bool' %} |
| 17 {{setting.type}} m_{{setting.name}}; \ | 17 {{setting.type}} m_{{setting.name}}; \ |
| 18 {% endfor %} | 18 {% endfor %} |
| 19 {% for setting in settings if setting.type == 'bool' %} | 19 {% for setting in settings if setting.type == 'bool' %} |
| 20 bool m_{{setting.name}} : 1; \ | 20 bool m_{{setting.name}} : 1; \ |
| 21 {% endfor %} | 21 {% endfor %} |
| 22 // End of SETTINGS_MEMBER_VARIABLES. | 22 // End of SETTINGS_MEMBER_VARIABLES. |
| 23 | 23 |
| 24 #define SETTINGS_INITIALIZER_LIST \ | 24 #define SETTINGS_INITIALIZER_LIST \ |
| 25 {% for setting in settings if setting.initial and setting.type != 'bool' %} | 25 {% for setting in settings if setting.initial is not none and setting.type !
= 'bool' %} |
| 26 , m_{{setting.name}}({{setting.initial}}) \ | 26 , m_{{setting.name}}({{setting.initial}}) \ |
| 27 {% endfor %} | 27 {% endfor %} |
| 28 {% for setting in settings if setting.initial and setting.type == 'bool' %} | 28 {% for setting in settings if setting.initial is not none and setting.type =
= 'bool' %} |
| 29 , m_{{setting.name}}({{setting.initial}}) \ | 29 , m_{{setting.name}}({{setting.initial|cpp_bool}}) \ |
| 30 {% endfor %} | 30 {% endfor %} |
| 31 // End of SETTINGS_INITIALIZER_LIST. | 31 // End of SETTINGS_INITIALIZER_LIST. |
| 32 | 32 |
| 33 #define SETTINGS_SETTER_BODIES \ | 33 #define SETTINGS_SETTER_BODIES \ |
| 34 {% for setting in settings %} | 34 {% for setting in settings %} |
| 35 void Settings::set{{setting.name|upper_first}}({{setting.type|to_passing_type}}
{{setting.name}}) { \ | 35 void Settings::set{{setting.name|upper_first}}({{setting.type|to_passing_type}}
{{setting.name}}) { \ |
| 36 if (m_{{setting.name}} == {{setting.name}}) \ | 36 if (m_{{setting.name}} == {{setting.name}}) \ |
| 37 return; \ | 37 return; \ |
| 38 m_{{setting.name}} = {{setting.name}}; \ | 38 m_{{setting.name}} = {{setting.name}}; \ |
| 39 {% if setting.invalidate %} | 39 {% if setting.invalidate %} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 static_cast<{{setting.type}}>(value.toInt()) \ | 59 static_cast<{{setting.type}}>(value.toInt()) \ |
| 60 {% endif %} | 60 {% endif %} |
| 61 ); \ | 61 ); \ |
| 62 return; \ | 62 return; \ |
| 63 } \ | 63 } \ |
| 64 {% endfor %} | 64 {% endfor %} |
| 65 } | 65 } |
| 66 // End of SETTINGS_SETTER_BODIES. | 66 // End of SETTINGS_SETTER_BODIES. |
| 67 | 67 |
| 68 #endif // SettingsMacros_h | 68 #endif // SettingsMacros_h |
| OLD | NEW |