Add helper functions and macros for dealing with enums

- toUnderlying -- automatically cast enum class to its underlying type
- toUnderlyingRef -- as above, but cast to a reference type
- EnumClass -- defines a new class with semantics similar to an enum class
  from C++11; also defines a suitable hashing function to use in QHash
  containers and defines a static method labels() which returns a QVector
  with all the constants from this pseudo-enum class
- EnumSubClass -- defines a class inheriting from EnumClass containing
  a subset of base class' constants