Index: mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
diff --git a/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl b/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
deleted file mode 100644 |
index ea9c0e9b2c5f53cbceca38258bea1c0e81dba1b1..0000000000000000000000000000000000000000 |
--- a/mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl |
+++ /dev/null |
@@ -1,65 +0,0 @@ |
-{%- set class_name = struct.name -%} |
-{%- set dtor_name = [] %} |
-{%- if struct|is_struct_with_handles %} |
-{%- set _ = dtor_name.append("&internal::%s_Data_Destructor"|format(struct.name)) %} |
-{%- else %} |
-{%- set _ = dtor_name.append("NULL") %} |
-{%- endif %} |
- |
-{%- macro set_default(kind, value, depth) -%} |
-{#--- Strings ---#} |
-{%- if kind|is_string_kind -%} |
-{{caller("mojo::String(" ~ value|expression_to_text(module) ~ ")")}} |
-{#--- Arrays ---#} |
-{%- elif kind|is_array_kind %} |
-{%- set _ = value|verify_token_type("ARRAY") %} |
-{ |
- {{kind|cpp_wrapper_type}}::Builder tmp{{depth}}({{value[1]|length}}); |
-{%- for element in value[1] %} |
-{%- filter indent(2) %} |
-{%- call(result) set_default(kind.kind, element, depth+1) %} |
-tmp{{depth}}[{{loop.index0}}] = {{result}}; |
-{%- endcall %} |
-{%- endfilter %} |
-{%- endfor -%} |
- {{caller("tmp" ~ depth ~ ".Finish()")|indent(2)}} |
-} |
-{#--- Objects ---#} |
-{%- elif kind|is_object_kind %} |
-{%- set _ = value|verify_token_type("OBJECT") %} |
-{ |
- {{kind|cpp_wrapper_type}}::Builder tmp{{depth}}; |
-{%- set struct = kinds[kind.spec] %} |
-{%- for element in value[1] %} |
-{#- Use struct.packed_fields to order struct values by ordinal number #} |
-{%- set subfield = struct.fields[loop.index0] %} |
-{%- filter indent(2) %} |
-{%- call(result) set_default(subfield.kind, element, depth+1) %} |
-tmp{{depth}}.set_{{subfield.name}}({{result}}); |
-{%- endcall %} |
-{%- endfilter %} |
-{%- endfor -%} |
- {{caller("tmp" ~ depth ~ ".Finish()")|indent(2)}} |
-} |
-{#--- POD types ---#} |
-{%- else -%} |
-{{caller(value|expression_to_text(module))}} |
-{%- endif %} |
-{%- endmacro %} |
- |
-{{class_name}}::Builder::Builder(mojo::Buffer* buf) |
- : data_(Data::New(buf, {{dtor_name[0]}})) { |
-{%- for pf in struct.packed.packed_fields if pf.field.default %} |
-{%- filter indent(2) %} |
-{%- call(result) set_default(pf.field.kind, pf.field.default, 0) %} |
-set_{{pf.field.name}}({{result}}); |
-{%- endcall %} |
-{%- endfilter %} |
-{%- endfor %} |
-} |
- |
-{{class_name}} {{class_name}}::Builder::Finish() { |
- Data* data = NULL; |
- std::swap(data, data_); |
- return mojo::internal::Wrap(data); |
-} |