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:
pb::constants::EnumName_descriptor()->FindValueByNumber()->name()

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?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to