1{% from 'templates/fields/field.tmpl' import encode, decode, const_ref, nonconst_ref, getter_expression, setter_expression, set_if_changed %}
2
3{% macro decl_getter_method(field) -%}
4{% if 'getter' not in field.computed_style_custom_functions %}
5{{const_ref(field)}} {{field.getter_method_name}}() const {
6  return {{decode(field, getter_expression(field))}};
7}
8{% endif %}
9{%- endmacro %}
10
11{% macro decl_setter_method(field) -%}
12{% if 'setter' not in field.computed_style_custom_functions %}
13void {{field.setter_method_name}}({{const_ref(field)}} v) {
14  {{set_if_changed(field, encode(field, "v"))|indent(2)}}
15}
16{% endif %}
17{%- endmacro %}
18
19{% macro decl_resetter_method(field) -%}
20{% if 'resetter' not in field.computed_style_custom_functions %}
21inline void {{field.resetter_method_name}}() {
22  {{setter_expression(field)}} = {{encode(field, field.default_value)}};
23}
24{% endif %}
25{%- endmacro %}
26
27{% macro decl_mutable_method(field) -%}
28{% if 'mutable' not in field.computed_style_custom_functions %}
29{{nonconst_ref(field)}} {{field.internal_mutable_method_name}}() {
30  return {{decode(field, setter_expression(field))}};
31}
32{% endif %}
33{%- endmacro %}
34
35{% macro decl_internal_getter_method(field) -%}
36{% if 'getter' in field.computed_style_custom_functions %}
37{{const_ref(field)}} {{field.internal_getter_method_name}}() const {
38  return {{decode(field, getter_expression(field))}};
39}
40{% endif %}
41{%- endmacro %}
42
43{% macro decl_internal_setter_method(field) -%}
44{% if 'setter' in field.computed_style_custom_functions %}
45void {{field.internal_setter_method_name}}({{const_ref(field)}} v) {
46  {{set_if_changed(field, encode(field, "v"))|indent(2)}}
47}
48{% endif %}
49{%- endmacro %}
50