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

Side by Side Diff: mojo/public/tools/bindings/generators/java_templates/enum_definition.tmpl

Issue 306893010: Generate java bindings for structs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Follow review Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 {%- macro enum_value(enum, field, index) -%}
2 {%- if field.value -%}
3 (int) ({{field.value|expression_to_text(enum.module)}})
4 {%- elif index == 0 -%}
5 0
6 {%- else -%}
7 {{enum.fields[index - 1].name}} + 1
8 {%- endif -%}
9 {%- endmacro -%}
10
11 {%- macro enum_def(enum, top_level) -%}
12 public {{ 'static ' if not top_level }}final class {{enum|name}} {
13
14 {% for field in enum.fields %}
15 public static final int {{field.name}} = {{enum_value(enum, field, loop.inde x0)}};
16 {% endfor %}
17
18 private {{enum|name}}() {}
19
20 }
21 {%- endmacro -%}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698