Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: mojo/public/tools/bindings/generators/cpp_templates/wrapper_class_declaration.tmpl

Issue 2247083003: Mojo C++ bindings: extract code shared by different variants. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 {% from "enum_macros.tmpl" import enum_decl -%}
2
3 class {{export_attribute}} {{struct.name}} { 1 class {{export_attribute}} {{struct.name}} {
4 public: 2 public:
5 using DataView = {{struct.name}}DataView; 3 using DataView = {{struct.name}}DataView;
6 using Data_ = internal::{{struct.name}}_Data; 4 using Data_ = internal::{{struct.name}}_Data;
7 5
8 {#--- Enums #} 6 {#--- Enums #}
9 {%- for enum in struct.enums -%} 7 {%- for enum in struct.enums -%}
10 {%- if enum|is_native_only_kind %} 8 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}};
11 using {{enum.name}} = mojo::NativeEnum;
12 {%- else %}
13 {{enum_decl(enum)|indent(2)}}
14 {%- endif %}
15 {%- endfor %} 9 {%- endfor %}
16 10
17 {#--- Constants #} 11 {#--- Constants #}
18 {%- for constant in struct.constants %} 12 {%- for constant in struct.constants %}
19 {%- if constant.kind|is_integral_kind %} 13 {%- if constant.kind|is_integral_kind %}
20 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con stant_value}}; 14 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con stant_value}};
21 {%- else %} 15 {%- else %}
22 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; 16 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
23 {%- endif %} 17 {%- endif %}
24 {%- endfor %} 18 {%- endfor %}
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 64 }
71 65
72 {#--- Struct members #} 66 {#--- Struct members #}
73 {% for field in struct.fields %} 67 {% for field in struct.fields %}
74 {%- set type = field.kind|cpp_wrapper_type %} 68 {%- set type = field.kind|cpp_wrapper_type %}
75 {%- set name = field.name %} 69 {%- set name = field.name %}
76 {{type}} {{name}}; 70 {{type}} {{name}};
77 {%- endfor %} 71 {%- endfor %}
78 }; 72 };
79 73
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698