[
https://issues.apache.org/jira/browse/THRIFT-3921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15470433#comment-15470433
]
James E. King, III edited comment on THRIFT-3921 at 9/7/16 12:15 PM:
---------------------------------------------------------------------
In general, enumeration numbers should be more stable than enumeration names.
If the output stream operator is used exclusively for human readable printing,
making it print the name of the enumeration sounds like it would be fine and
useful.
Does THRIFT-3336 address your concern? That modifies the generated code to
make the output stream operator overridable by having it call a virtual method
(print is the name, I believe) that you can change to modify the behavior.
Given thrift enumerations in C++ are implemented within a structure, perhaps
the same change allows for customizable behavior here? (I haven't checked).
was (Author: jking3):
Does THRIFT-3336 address your concern? That modifies the generated code to
make the output stream operator overridable by having it call a virtual method
(print is the name, I believe) that you can change to modify the behavior.
> C++ code should print enums as strings
> --------------------------------------
>
> Key: THRIFT-3921
> URL: https://issues.apache.org/jira/browse/THRIFT-3921
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Compiler
> Reporter: Vivek Jain
>
> THRIFT-2067 added {{operator<<}} to the C++ generated code, which is great,
> but enums are printed as numbers rather than their string representation. It
> would be great if the generated code printed them as a string instead. There
> might be some backwards-compatibility concerns (if users have already defined
> their own versions, then thrift's version would cause compile errors), not
> sure how important you guys think those are.
> Other thoughts/concerns? I am willing to work on a patch if no one else is
> able to work on it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)