You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.
I searched issues but I didn't see anything about stringizing enumeration while generating native C++ sources.
In my case, I need to get the enumerations' description to show to upper layer. I'm not sure that whether there is the same demand for others?
To achieving this, one way is to define the enumeration strings manually, the second way is to stringize enumerations automatically in djinni. In my opinion, the second way is preferred be cause: it can get the string mapped to enum easily, and also, if djinni plans to support metaprogramming, it will be helpful.
For example, defining enum In djinni file:
Version = enum {
v_1_0;
v_2_0;
v_3_0;
}
it will produced C++ hpp:
enum class Version : int {
V_1_0,
V_2_0,
V_3_0,
};
If I want to return the description of certain enumeration, it needs to define a enumeration string table to achieve this:
But the works above are bored and horrible if there are so many enumerations, so I suggest to auto generating the codes above into enum hpp files, the expected new hpp file for enum:
expected new produced C++ hpp for enum maybe look like:
I searched issues but I didn't see anything about stringizing enumeration while generating native C++ sources.
In my case, I need to get the enumerations' description to show to upper layer. I'm not sure that whether there is the same demand for others?
To achieving this, one way is to define the enumeration strings manually, the second way is to stringize enumerations automatically in djinni. In my opinion, the second way is preferred be cause: it can get the string mapped to enum easily, and also, if djinni plans to support metaprogramming, it will be helpful.
For example, defining enum In djinni file:
it will produced C++ hpp:
If I want to return the description of certain enumeration, it needs to define a enumeration string table to achieve this:
But the works above are bored and horrible if there are so many enumerations, so I suggest to auto generating the codes above into enum hpp files, the expected new hpp file for enum:
expected new produced C++ hpp for enum maybe look like:
So is it possible to stringize enumerations automatically in djinn or support it with a djinni compiling option?
thanks~
The text was updated successfully, but these errors were encountered: