[
https://issues.apache.org/jira/browse/THRIFT-5843?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Tim Crews updated THRIFT-5843:
------------------------------
Description:
Add a *cpp:enum_classes* option to the C++ compiler so that a Thrift enum
declaration like this:
{{enum PrintDirection}}
{{{}}
{{ Down = 68,}}
{{ Up = 85}}
{{}}}
becomes a C++ [scoped
enumeration|https://en.cppreference.com/w/cpp/language/enum#Scoped_enumerations]
declaration like this:
{{enum class PrintDirection {}}
{{ Down = 68,}}
{{ Up = 85}}
{{};}}
This is very similar to the existing *cpp::pure_enums* option, but it addresses
the drawback that all of the enumerators (the values like Down and Up) are in
the same namespace as the enumerators from other enum types.
I already have a working implementation of this feature that I have been using
on a private fork of Thrift for about five years, so the only work required
would be to prepare the pull request.
was:
Add a cpp:enum_classes option to the C++ compiler so that a Thrift enum
declaration like this:
{{enum PrintDirection
{
Down = 68,
Up = 85
}}}
becomes a C++ [scoped
enumeration|https://en.cppreference.com/w/cpp/language/enum#Scoped_enumerations]
declaration like this:
{{enum class PrintDirection {
Down = 68,
Up = 85
};}}
This is very similar to the existing cpp::pure_enums option, but it addresses
the drawback that all of the enumerators (the values like Down and Up) are in
the same namespace as the enumerators from other enum types.
I already have a working implementation of this feature that I have been using
on a private fork of Thrift for about five years, so the only work required
would be to prepare the pull request.
> Represent Thrift enums as C++ enum classes
> ------------------------------------------
>
> Key: THRIFT-5843
> URL: https://issues.apache.org/jira/browse/THRIFT-5843
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Compiler
> Affects Versions: 0.21.0
> Reporter: Tim Crews
> Priority: Minor
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> Add a *cpp:enum_classes* option to the C++ compiler so that a Thrift enum
> declaration like this:
> {{enum PrintDirection}}
> {{{}}
> {{ Down = 68,}}
> {{ Up = 85}}
> {{}}}
> becomes a C++ [scoped
> enumeration|https://en.cppreference.com/w/cpp/language/enum#Scoped_enumerations]
> declaration like this:
> {{enum class PrintDirection {}}
> {{ Down = 68,}}
> {{ Up = 85}}
> {{};}}
> This is very similar to the existing *cpp::pure_enums* option, but it
> addresses the drawback that all of the enumerators (the values like Down and
> Up) are in the same namespace as the enumerators from other enum types.
> I already have a working implementation of this feature that I have been
> using on a private fork of Thrift for about five years, so the only work
> required would be to prepare the pull request.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)