Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support kCamelCase names for enum values #59

Closed
acsaeed opened this issue Nov 23, 2022 · 1 comment
Closed

Support kCamelCase names for enum values #59

acsaeed opened this issue Nov 23, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@acsaeed
Copy link
Contributor

acsaeed commented Nov 23, 2022

Currently, enum values are always SHOUTY_CASE. The Google C++ style guide prefers kCamelCase for enum names, so we would like to migrate our Emboss enum names to this style eventually. A possible implementation is adding a configuration option for enum name style at the top of .emb files.

@reventlov reventlov added the enhancement New feature or request label Mar 21, 2023
@jasongraffius
Copy link
Contributor

jasongraffius commented Jun 29, 2023

As of #89 this should be implemented. To use kCamelCase enum names for all enums in a module, you should be able to add:

[(cpp) $default enum_case: "kCamelCase"]

To the top of the module (alongside other attributes like namespace and default endianness, if applicable). If you need to transition between the two, you should be able to use:

[(cpp) $default enum_case: "SHOUTY_CASE, kCamelCase"]

Then update all references from SHOUTY_CASE to kCamelCase, and remove the "SHOUTY_CASE" entry from the enum cases.

Note: You can also apply this only to specific enum values, or all enum values in an enum, or all enums within a struct or bits, etc. by putting the annotation at the appropriate level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants