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

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

Issue 2637393002: Make mojom-generated C++ string constants really constant. (Closed)
Patch Set: Created 3 years, 11 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 class {{export_attribute}} {{struct.name}} { 1 class {{export_attribute}} {{struct.name}} {
2 public: 2 public:
3 using DataView = {{struct.name}}DataView; 3 using DataView = {{struct.name}}DataView;
4 using Data_ = internal::{{struct.name}}_Data; 4 using Data_ = internal::{{struct.name}}_Data;
5 5
6 {#--- Enums #} 6 {#--- Enums #}
7 {%- for enum in struct.enums -%} 7 {%- for enum in struct.enums -%}
8 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}}; 8 using {{enum.name}} = {{enum|get_name_for_kind(flatten_nested_kind=True)}};
9 {%- endfor %} 9 {%- endfor %}
10 10
11 {#--- Constants #} 11 {#--- Constants #}
12 {%- for constant in struct.constants %} 12 {%- for constant in struct.constants %}
13 {%- if constant.kind|is_integral_kind %} 13 static {{constant|format_constant_declaration(nested=True)}};
14 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con stant_value}};
15 {%- else %}
16 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
17 {%- endif %}
18 {%- endfor %} 14 {%- endfor %}
19 15
20 static {{struct.name}}Ptr New(); 16 static {{struct.name}}Ptr New();
21 17
22 template <typename U> 18 template <typename U>
23 static {{struct.name}}Ptr From(const U& u) { 19 static {{struct.name}}Ptr From(const U& u) {
24 return mojo::TypeConverter<{{struct.name}}Ptr, U>::Convert(u); 20 return mojo::TypeConverter<{{struct.name}}Ptr, U>::Convert(u);
25 } 21 }
26 22
27 template <typename U> 23 template <typename U>
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 {%- set name = field.name %} 69 {%- set name = field.name %}
74 {{type}} {{name}}; 70 {{type}} {{name}};
75 {%- endfor %} 71 {%- endfor %}
76 72
77 {%- if struct|contains_move_only_members %} 73 {%- if struct|contains_move_only_members %}
78 private: 74 private:
79 DISALLOW_COPY_AND_ASSIGN({{struct.name}}); 75 DISALLOW_COPY_AND_ASSIGN({{struct.name}});
80 {%- endif %} 76 {%- endif %}
81 }; 77 };
82 78
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698