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

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

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

Powered by Google App Engine
This is Rietveld 408576698