Closed Bug 924382 Opened 7 years ago Closed 6 years ago

Allow getting the integer type corresponding to a MOZ_BEGIN_ENUM_CLASS

Categories

(Core :: MFBT, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: bjacob, Assigned: bjacob)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Attached patch patchSplinter Review
I have some enum types defined by MOZ_BEGIN_ENUM_CLASS, that I want to use as the type of integral template parameters. On platforms where MOZ_BEGIN_ENUM_CLASS is needed, it produces types that are actual classes, not actual integral types, so it can't be used as the type of a template parameter. This patch adds a macro that allows getting the corresponding integer type, which is Name::Enum in the non-c++11 case.
Attachment #814372 - Flags: review?(jwalden+bmo)
The name of this macro is very confusing.  It doesn't give you the integer type, which is the second argument passed to MOZ_BEGIN_ENUM_CLASS.
Well, there are two integer types there. The enum type, and the 'underlying' integer type. I want the enum type (because strong typing). Please suggest a better name!
(In reply to comment #2)
> Well, there are two integer types there. The enum type, and the 'underlying'
> integer type. I want the enum type (because strong typing). Please suggest a
> better name!

MOZ_ENUM_CLASS_ENUM_TYPE?
Comment on attachment 814372 [details] [diff] [review]
patch

Review of attachment 814372 [details] [diff] [review]:
-----------------------------------------------------------------

Yuck.  Bring on the new compilers!
Attachment #814372 - Flags: review?(jwalden+bmo) → review+
MOZ_ENUM_CLASS_ENUM_TYPE does seem a better name, yeah.
http://hg.mozilla.org/integration/mozilla-inbound/rev/eeec720e003a
Assignee: nobody → bjacob
Target Milestone: --- → mozilla28
https://hg.mozilla.org/mozilla-central/rev/eeec720e003a
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.