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

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

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 {% from "enum_macros.tmpl" import enum_decl -%} 1 {% from "enum_macros.tmpl" import enum_decl -%}
2 2
3 class {{struct.name}}_Reader; 3 class {{struct.name}}_Reader;
4 4
5 class {{struct.name}} { 5 class {{struct.name}} {
6 public: 6 public:
7 using Data_ = internal::{{struct.name}}_Data; 7 using Data_ = internal::{{struct.name}}_Data;
8 using Reader = {{struct.name}}_Reader; 8 using Reader = {{struct.name}}_Reader;
9 9
10 {#--- Enums #} 10 {#--- Enums #}
11 {%- for enum in struct.enums -%} 11 {%- for enum in struct.enums -%}
12 {{enum_decl(enum, is_static=true)|indent(2)}} 12 {{enum_decl(enum)|indent(2)}}
13 {%- endfor %} 13 {%- endfor %}
14 14
15 {#--- Constants #} 15 {#--- Constants #}
16 {%- for constant in struct.constants %} 16 {%- for constant in struct.constants %}
17 {%- if constant.kind|is_integral_kind %} 17 {%- if constant.kind|is_integral_kind %}
18 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con stant_value}}; 18 static const {{constant.kind|cpp_pod_type}} {{constant.name}} = {{constant|con stant_value}};
19 {%- else %} 19 {%- else %}
20 static const {{constant.kind|cpp_pod_type}} {{constant.name}}; 20 static const {{constant.kind|cpp_pod_type}} {{constant.name}};
21 {%- endif %} 21 {%- endif %}
22 {%- endfor %} 22 {%- endfor %}
(...skipping 18 matching lines...) Expand all
41 {%- endif %} 41 {%- endif %}
42 bool Equals(const {{struct.name}}& other) const; 42 bool Equals(const {{struct.name}}& other) const;
43 43
44 {#--- Struct members #} 44 {#--- Struct members #}
45 {% for field in struct.fields %} 45 {% for field in struct.fields %}
46 {%- set type = field.kind|cpp_wrapper_type %} 46 {%- set type = field.kind|cpp_wrapper_type %}
47 {%- set name = field.name %} 47 {%- set name = field.name %}
48 {{type}} {{name}}; 48 {{type}} {{name}};
49 {%- endfor %} 49 {%- endfor %}
50 }; 50 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698