Tuesday, October 30, 2012

C++ Enumeration to String

Hacked together a script which transforms a C++ enumeration to some simple c-strings or something else.

If you have an enumeration enum [tag] [: type] {enum-list} then you can convert the enum-list part to something like case some_entry: return "some_entry"; for each entry in enum-list, if the operation is set to: case $: return "$";
Whereas the character $ is the replacement position for the actual enumeration entry.

Operation

Enumeration-List


Output below