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_declaration.tmpl

Issue 615063003: Mojo cpp bindings: support Clone() for structs and arrays which don't contain handles. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 1
2 class {{struct.name}} { 2 class {{struct.name}} {
3 public: 3 public:
4 typedef internal::{{struct.name}}_Data Data_; 4 typedef internal::{{struct.name}}_Data Data_;
5 5
6 {#--- Constants #} 6 {#--- Constants #}
7 {%- for constant in struct.constants %} 7 {%- for constant in struct.constants %}
8 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; 8 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
9 {%- endfor %} 9 {%- endfor %}
10 {#--- Enums #} 10 {#--- Enums #}
11 {%- for enum in struct.enums -%} 11 {%- for enum in struct.enums -%}
12 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %} 12 {% macro enum_def() %}{% include "enum_declaration.tmpl" %}{% endmacro %}
13 {{enum_def()|indent(2)}} 13 {{enum_def()|indent(2)}}
14 {%- endfor %} 14 {%- endfor %}
15 static {{struct.name}}Ptr New(); 15 static {{struct.name}}Ptr New();
16 16
17 template <typename U> 17 template <typename U>
18 static {{struct.name}}Ptr From(const U& u) { 18 static {{struct.name}}Ptr From(const U& u) {
19 return mojo::TypeConverter<{{struct.name}}Ptr, U>::Convert(u); 19 return mojo::TypeConverter<{{struct.name}}Ptr, U>::Convert(u);
20 } 20 }
21 21
22 {{struct.name}}(); 22 {{struct.name}}();
23 ~{{struct.name}}(); 23 ~{{struct.name}}();
24 {% if struct|is_cloneable_kind %}
25 {{struct.name}}Ptr Clone() const;
darin (slow to review) 2014/10/02 20:14:13 Doesn't this potentially conflict with a user defi
Aaron Boodman 2014/10/10 20:27:47 It seems like it would. Since I am going to add Eq
yzshen1 2014/10/10 20:30:21 This question has been resolved. Clone() is defin
Aaron Boodman 2014/10/10 21:04:15 per our IM chat, this isn't resolved -- it is poss
darin (slow to review) 2014/10/12 17:57:30 Right, good catch. I'd be OK dictating that field
26 {%- endif %}
24 27
25 {#--- Getters #} 28 {#--- Getters #}
26 {% for field in struct.fields %} 29 {% for field in struct.fields %}
27 {%- set type = field.kind|cpp_wrapper_type %} 30 {%- set type = field.kind|cpp_wrapper_type %}
28 {%- set name = field.name %} 31 {%- set name = field.name %}
29 {{type}} {{name}}; 32 {{type}} {{name}};
30 {%- endfor %} 33 {%- endfor %}
31 }; 34 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698