use enums

Distilled some parts out of #650.
Enables nice VS .natvis debugger visualization (btw would people be interested in a shared natvis?)

I also turned STC into an enum, but the values are >32 bits so not sure what happens then in C++03.
`OutBuffer *buf`