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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.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
(Empty)
1 {%- from "enum_macros.tmpl" import is_valid_enum_def %}
2 {%- from "enum_macros.tmpl" import global_enum_operators_def %}
3
4 {#--- Enums #}
5 {%- for enum in struct.enums -%}
6 {{is_valid_enum_def(enum, class_name=struct.name)}}
7 {{global_enum_operators_def(enum, class_name=struct.name)}}
8 {%- endfor %}
9
10 // static
11 {{struct.name}}Ptr {{struct.name}}::New() {
12 {{struct.name}}Ptr rv;
13 mojo::internal::StructHelper<{{struct.name}}>::Initialize(&rv);
14 return rv;
15 }
16
17 {{struct.name}}::{{struct.name}}()
18 {%- for field in struct.fields %}
19 {% if loop.first %}:{% else %} {% endif %} {{field.name}}({{field|default_va lue}}){% if not loop.last %},{% endif %}
20 {%- endfor %} {
21 }
22
23 {{struct.name}}::~{{struct.name}}() {
24 }
25
26 {% if struct|is_cloneable_kind %}
27 {{struct.name}}Ptr {{struct.name}}::Clone() const {
28 {{struct.name}}Ptr rv(New());
29 {%- for field in struct.fields %}
30 {%- if field.kind|is_object_kind and not field.kind|is_string_kind %}
31 rv->{{field.name}} = {{field.name}}.Clone();
32 {%- else %}
33 rv->{{field.name}} = {{field.name}};
34 {%- endif %}
35 {%- endfor %}
36 return rv;
37 }
38 {% endif %}
39
40 bool {{struct.name}}::Equals(const {{struct.name}}& other) const {
41 {%- for field in struct.fields %}
42 if (!mojo::internal::ValueTraits<{{field.kind|cpp_wrapper_type}}>::Equals(this ->{{field.name}}, other.{{field.name}}))
43 return false;
44 {%- endfor %}
45 return true;
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698