diff options
Diffstat (limited to 'eepg.h')
-rw-r--r-- | eepg.h | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -75,6 +75,37 @@ typedef struct { unsigned char * Text; } Summary_t; + +// -- InheritEnum.h +template <typename EnumT, typename BaseEnumT> +class InheritEnum +{ +public: + InheritEnum() {} + InheritEnum(EnumT e) + : enum_(e) + {} + + InheritEnum(BaseEnumT e) + : baseEnum_(e) + {} + + explicit InheritEnum( int val ) + : enum_(static_cast<EnumT>(val)) + {} + + operator EnumT() const { return enum_; } +private: + // Note - the value is declared as a union mainly for as a debugging aid. If + // the union is undesired and you have other methods of debugging, change it + // to either of EnumT and do a cast for the constructor that accepts BaseEnumT. + union + { + EnumT enum_; + BaseEnumT baseEnum_; + }; +}; + static const char *FileEquivalences[] = { "#", "# Simply add a list of the channels in this file with the following format:", |