Enum key stripping
Could you add an option to strip the prefix from the enumeration keys. For example given following C code:
enum abc_some_enum {
abc_some_enum_key1,
abc_some_enum_key2,
abc_some_enum_key3,
};
The expected C# output is following:
enum abc_some_enum {
key1,
key2,
key3,
};
My best guess is that generator should cut maximum common prefix from the enum key name.
This can be achieved via remapping today.
A new option to explicitly trim out some prefixes would also be possible, but there are many cases this won't work. This includes where the prefix is non-obvious, where it is instead a common postfix, where the first letter after the prefix is a number, etc.
I'll leave this open and up-for-grabs in case someone wants to do it, but I expect it would need to look like: -config prefix-strip-enum
Alternatively, or in addition, the existing --prefixStrip could be expanded to support specifying a common prefix to remove per enum.
In many cases the prefix is the enum member type name. So, in order to keep it simple, I suggest --config strip-enum-type-from-member-name which would simply strip the enum member type name (and following underscore) from the enum member name. That would satisfy the above example.
I am working on this now, will submit PR soon.
It's worth noting one of the "best" ways to consume these types is simply to do using static abc_some_enum; at which point you can just use abc_some_enum_key1 as is, unqualified.
This is ultimately very consistent with C/C++ (which can help with porting) and fits in if C# ever gets the proposed feature to allow contextual access to enum members without having to qualify the type name.