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

Unified Diff: mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl b/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
deleted file mode 100644
index 991837b2eeb718211018401246b4bf7a762617ce..0000000000000000000000000000000000000000
--- a/mojo/public/tools/bindings/generators/dart_templates/enum_definition.tmpl
+++ /dev/null
@@ -1,57 +0,0 @@
-{%- macro enum_def(enum, typepkg, package) %}
-class {{enum|name}} extends bindings.MojoEnum {
-{%- for field in enum.fields %}
- static const {{enum|name}} {{field|name}} = const {{enum|name}}._({{field.resolved_value}});
-{%- endfor %}
-
- const {{enum|name}}._(int v) : super(v);
-
- static const Map<String, {{enum|name}}> valuesMap = const {
-{%- for field in enum.fields %}
- "{{field|name}}": {{field|name}},
-{%- endfor %}
- };
- static const List<{{enum|name}}> values = const [
-{%- for field in enum.fields %}
- {{field|name}},
-{%- endfor %}
- ];
-
- static {{enum|name}} valueOf(String name) => valuesMap[name];
-
- factory {{enum|name}}(int v) {
- switch (v) {
-{%- for field in enum.fields %}
- case {{field.resolved_value}}:
- return {{enum|name}}.{{field|name}};
-{%- endfor %}
- default:
- return null;
- }
- }
-
- static {{enum|name}} decode(bindings.Decoder decoder0, int offset) {
- int v = decoder0.decodeUint32(offset);
- {{enum|name}} result = new {{enum|name}}(v);
- if (result == null) {
- throw new bindings.MojoCodecError(
- 'Bad value $v for enum {{enum|name}}.');
- }
- return result;
- }
-
- String toString() {
- switch(this) {
-{%- for field in enum.fields %}
- case {{field|name}}:
- return '{{enum|name}}.{{field|name}}';
-{%- endfor %}
- default:
- return null;
- }
- }
-
- int toJson() => mojoEnumValue;
-}
-
-{%- endmacro %}

Powered by Google App Engine
This is Rietveld 408576698