summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:20:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:28:57 +0000
commitd17ea114e5ef69ad5d5d7413280a13e6428098aa (patch)
tree2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
parent8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff)
downloadqtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl')
-rw-r--r--chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl70
1 files changed, 70 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
new file mode 100644
index 00000000000..efbb2fa3127
--- /dev/null
+++ b/chromium/third_party/blink/renderer/build/scripts/templates/settings_macros.h.tmpl
@@ -0,0 +1,70 @@
+{% from "templates/macros.tmpl" import license, source_files_for_generated_file %}
+{{ license() }}
+
+{{source_files_for_generated_file(template_file, input_files)}}
+
+#ifndef SettingsMacros_h
+#define SettingsMacros_h
+
+#define SETTINGS_GETTERS_AND_SETTERS \
+ {% for setting in settings %}
+ {{setting.type|to_passing_type}} Get{{setting.name|upper_first}}() const { return {{setting.name}}_; } \
+ void Set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}); \
+ {% endfor %}
+ void SetFromStrings(const String& name, const String& value);
+// End of SETTINGS_GETTERS_AND_SETTERS.
+
+#define SETTINGS_MEMBER_VARIABLES \
+ {% for setting in settings if setting.type != 'bool' %}
+ {{setting.type}} {{setting.name}}_; \
+ {% endfor %}
+ {% for setting in settings if setting.type == 'bool' %}
+ bool {{setting.name}}_ : 1; \
+ {% endfor %}
+// End of SETTINGS_MEMBER_VARIABLES.
+
+#define SETTINGS_INITIALIZER_LIST \
+ {% for setting in settings if setting.initial is not none and setting.type != 'bool' %}
+ , {{setting.name}}_({{setting.initial}}) \
+ {% endfor %}
+ {% for setting in settings if setting.initial is not none and setting.type == 'bool' %}
+ , {{setting.name}}_({{setting.initial|cpp_bool}}) \
+ {% endfor %}
+// End of SETTINGS_INITIALIZER_LIST.
+
+#define SETTINGS_SETTER_BODIES \
+{% for setting in settings %}
+void Settings::Set{{setting.name|upper_first}}({{setting.type|to_passing_type}} {{setting.name}}) { \
+ if ({{setting.name}}_ == {{setting.name}}) \
+ return; \
+ {{setting.name}}_ = {{setting.name}}; \
+ {% if setting.invalidate %}
+ Invalidate(SettingsDelegate::k{{setting.invalidate}}Change); \
+ {% endif %}
+} \
+{% endfor %}
+void Settings::SetFromStrings(const String& name, const String& value) { \
+ {% for setting in settings %}
+ if (name == "{{setting.name}}") { \
+ Set{{setting.name|upper_first}}( \
+ {% if setting.type == 'String' %}
+ value \
+ {% elif setting.type == 'bool' %}
+ value.IsEmpty() || value == "true" \
+ {% elif setting.type == 'int' %}
+ value.ToInt() \
+ {% elif setting.type == 'float' %}
+ value.ToFloat() \
+ {% elif setting.type == 'double' %}
+ value.ToDouble() \
+ {% else %}
+ static_cast<{{setting.type}}>(value.ToInt()) \
+ {% endif %}
+ ); \
+ return; \
+ } \
+ {% endfor %}
+}
+// End of SETTINGS_SETTER_BODIES.
+
+#endif // SettingsMacros_h