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

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

Issue 1410053006: Move third_party/mojo/src/mojo/public to mojo/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge 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 {#--- 1 {#---
2 Macro for enum definition, and the declaration of associated functions. 2 Macro for enum definition, and the declaration of associated functions.
3 `is_static` is relevant if this enum declaration is defined within a class, in 3 `is_static` is relevant if this enum declaration is defined within a class, in
4 which case associated functions need to be static. 4 which case associated functions need to be static.
5 ---#} 5 ---#}
6 {%- macro enum_decl(enum, is_static=false) %} 6 {%- macro enum_decl(enum, is_static=false) %}
7 enum {{enum.name}} : int32_t { 7 enum {{enum.name}} : int32_t {
8 {%- for field in enum.fields %} 8 {%- for field in enum.fields %}
9 {%- if field.value %} 9 {%- if field.value %}
10 {{enum.name|to_all_caps}}_{{field.name}} = {{field.value|expression_to_text}}, 10 {{enum.name|to_all_caps}}_{{field.name}} = {{field.value|expression_to_text}},
(...skipping 26 matching lines...) Expand all
37 {{enum.name}}_IsValidValue({{enum.name}} value) { 37 {{enum.name}}_IsValidValue({{enum.name}} value) {
38 switch (static_cast<int32_t>(value)) { 38 switch (static_cast<int32_t>(value)) {
39 {%- for enum_field in enum.fields|groupby('numeric_value') %} 39 {%- for enum_field in enum.fields|groupby('numeric_value') %}
40 case {{enum_field[0]}}: 40 case {{enum_field[0]}}:
41 {%- endfor %} 41 {%- endfor %}
42 return true; 42 return true;
43 } 43 }
44 return false; 44 return false;
45 } 45 }
46 {%- endmacro %} 46 {%- endmacro %}
OLDNEW
« no previous file with comments | « mojo/public/third_party/ply/yacc.py ('k') | mojo/public/tools/bindings/generators/cpp_templates/interface_declaration.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698