Is there a way to assign alternate names to enumeration values? I have
a piece of C++ code that processes protocol buffer messages which have
a lot of enums in them, and I need to print out the contents in a user-
friendly, readable way.

I know that I can get the enum value name by doing something like:

But if my enum value name is "DEVICE_CATEGORY_TABLET", I would rather
output something like "Tablet". I can make a bunch of big maps of enum
values to strings in my C++ code, but this means that any time I
change the protocol buffers I need to update the C++ code. If there is
no "alternate name" available, is there perhaps a better way to
approach this where I don't have to make updates in two places for
every change?


You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to