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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/enum_macros.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/cpp_templates/enum_macros.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
deleted file mode 100644
index a68275d17055f60b694b65a7122b266de0866bc5..0000000000000000000000000000000000000000
--- a/mojo/public/tools/bindings/generators/cpp_templates/enum_macros.tmpl
+++ /dev/null
@@ -1,68 +0,0 @@
-{#---
- Macro for enum definition, and the declaration of associated functions.
- `is_static` is relevant if this enum declaration is defined within a class, in
- which case associated functions need to be static.
----#}
-{%- macro enum_decl(enum, is_static=false) %}
-enum class {{enum.name}} : int32_t {
-{%- for field in enum.fields %}
-{%- if field.value %}
- {{field.name}} = {{field.value|expression_to_text}},
-{%- else %}
- {{field.name}},
-{%- endif %}
-{%- endfor %}
-};
-{{is_valid_enum_decl(enum, is_static)}}
-{%- endmacro %}
-
-{#--- macros for the declaration & definitions of enum-associated functions.
- Namely:
- * {enum_name}_IsValidValue: returns true if the given enum has a valid value
- for this generated version of enum.
----#}
-
-{%- macro is_valid_enum_decl(enum, is_static=false) %}
-{% if is_static %}static {% endif -%}
-bool {{enum.name}}_IsValidValue({{enum.name}} value);
-{%- endmacro %}
-
-{%- macro is_valid_enum_def(enum, class_name = '') %}
-{% if class_name != '' -%}
-// static
-bool {{class_name}}::
-{%- else -%}
-{{"bool "}}
-{%- endif -%}
-{{enum.name}}_IsValidValue({{enum.name}} value) {
- switch (static_cast<int32_t>(value)) {
-{%- for enum_field in enum.fields|groupby('numeric_value') %}
- case {{enum_field[0]}}:
-{%- endfor %}
- return true;
- }
- return false;
-}
-{%- endmacro %}
-
-{%- macro global_enum_operators_decl(enum, class_name = '') %}
-{% if class_name != '' -%}
-std::ostream& operator<<(std::ostream& stream,
- const {{class_name}}::{{enum.name}}& val);
-{%- else -%}
-std::ostream& operator<<(std::ostream& stream, const {{enum.name}}& val);
-{%- endif -%}
-{%- endmacro %}
-
-{%- macro global_enum_operators_def(enum, class_name = '') %}
-{% if class_name != '' -%}
-std::ostream& operator<<(std::ostream& stream,
- const {{class_name}}::{{enum.name}}& val) {
- return (stream << static_cast<int32_t>(val));
-}
-{%- else -%}
-std::ostream& operator<<(std::ostream& stream, const {{enum.name}}& val) {
- return (stream << static_cast<int32_t>(val));
-}
-{%- endif -%}
-{%- endmacro %}
« no previous file with comments | « mojo/public/tools/bindings/BUILD.gn ('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