-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS_ENUM Defaults #46
Comments
You are correct, there is no support for initial values. The enum support needs some love if anyone out there has the time. |
I have been toying with this problem, and I think a new parser macro for enumeration classes might be the way to go. I tried improving JS_ENUM by extending populateEnumNames(), but the parser quickly gets complicated, or it has to impose restrictions on how enumerations are declared. I also looked into variadic macros and reflection, but that's tricky business.. So instead I'm using plain enumerations like @jorgen, if that sounds interesting, would you be open to a pull request? |
Ah, cool! Sure thing👍 |
Done. I've completed some rudimentary testing on my own, but if this looks usable, let me know if you want help creating test cases. |
how can I setenum defaults like this
JS_ENUM(Color, Red = 0x01, Green = 0x02, Blue = 0x03, Yellow4 = 0x04, Purple = 0x05)
struct ColorData {
Color color;
};
JS_ENUM_DECLARE_STRING_PARSER(Color)
Compilation can pass, but running or have assert in source code 4438 lines.
I looked at the code and probably understood that this is looking for the name of the enumeration member, but there is no related '=' processing。
Does this library support enumerations with initial values?
The text was updated successfully, but these errors were encountered: