Commit f5882938 authored by Alan Ding's avatar Alan Ding Committed by Commit Bot

mojo: Update C++ generator bindings to emit camel case for union tags

Update union tag bindings to support C++ code style recommendation.
Keep previous style until there is enough support for camel case to
deprecate *_VALUE enums.

This CL was done as part of Chrome U 2020 codelabs exercise.

BUG=chromium:1093757
TEST=builds, deployed, and git cl try.

Change-Id: Ifbab11199dd64354be8fb84d2f8ee173c572ef5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533323Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Alan Ding <alanding@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827191}
parent 040b8ef6
......@@ -63,10 +63,16 @@ class {{export_attribute}} {{class_name}} {
data.unknown = 0U;
}
// TODO(crbug.com/1148486): SHOUTY_CASE values are being deprecated per C++ code style
// guidelines (https://google.github.io/styleguide/cppguide.html#Enumerator_Names),
// please use kCamelCase values instead. Cleanup NULL_VALUE, BOOL_VALUE, INT_VALUE, etc.
// generation once codebase is transitioned to kNullValue, kBoolValue, kIntValue, etc.
enum class {{enum_name}} : uint32_t {
{% for field in union.fields %}
{{ kythe_annotation("%s.%s"|format(union|get_full_mojom_name_for_kind(), field.name)) }}
{{field.name|upper}},
{{ kythe_annotation("%s.%s"|format(union|get_full_mojom_name_for_kind(), field.name)) }}
k{{field.name|under_to_camel}} = {{field.name|upper}},
{%- endfor %}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment