I have a bunch of enums (from libvirt library if you are wondering) that look like this:
enum whatever {
VAL_A = 1
VAL_B = 2
...
}
How do I convert these to meaningful strings? That is, VAL_A has a state meaning "meaning_A", VAL_B has a state meaning "meaning_B" and so on. In php or perl or python, I would generate a key:val pair and return the results in O(1) time. Is there an efficient way to map these to meaningful strings in C? I was thinking of a switch statement, but was wondering about better approaches.
Thanks,
Vik.