[ 
https://issues.apache.org/jira/browse/THRIFT-3921?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15471201#comment-15471201
 ] 

Vivek Jain commented on THRIFT-3921:
------------------------------------

Yes, the idea is to use this just for human-readable printing.

I saw THRIFT-3336 before, but as far as I am aware a similar strategy cannot be 
used for enums because C++ enums cannot be subclassed. You could, of course, 
subclass the struct containing the enum but then to actually change the enum 
type you'd have to copy and paste its contents into the subclass.

I have a working version (turned out to be simpler than I expected – the 
generator code is well-written and easy to modify) and will open a PR soon.

> 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)

Reply via email to