OLD | NEW |
(Empty) | |
| 1 {% from "constant_definition.tmpl" import constant_def %} |
| 2 {% from "enum_definition.tmpl" import enum_def %} |
| 3 |
| 4 {% macro struct_def(struct, inner_class=False) %} |
| 5 {{'static' if inner_class else 'public'}} final class {{struct|name}} extends or
g.chromium.mojo.bindings.Struct { |
| 6 {% for constant in struct.constants %} |
| 7 |
| 8 {{constant_def(constant)|indent(4)}} |
| 9 {% endfor %} |
| 10 {% for enum in struct.enums %} |
| 11 |
| 12 {{enum_def(enum, false)|indent(4)}} |
| 13 {% endfor %} |
| 14 {% if struct.fields %} |
| 15 |
| 16 {% for field in struct.fields %} |
| 17 public {{field.kind|java_type}} {{field|name}}; |
| 18 {% endfor %} |
| 19 {% endif %} |
| 20 |
| 21 public {{struct|name}}() { |
| 22 {% for field in struct.fields %} |
| 23 {% if field.default %} |
| 24 {{field|name}} = {{field|default_value}}; |
| 25 {% elif field.kind|is_handle %} |
| 26 {{field|name}} = org.chromium.mojo.system.InvalidHandle.INSTANCE; |
| 27 {% endif %} |
| 28 {% endfor %} |
| 29 } |
| 30 |
| 31 } |
| 32 {% endmacro %} |
OLD | NEW |