/// \class EnumClass
/// \brief Type safe enum (workaround SWIG not supporting enum class)
/// \code
- /// struct EColorDef { enum Enum { R, G ,B }; };
- /// typedef EnumClass<EColorDef> Color;
+ /// struct _ColorDef { enum Enum { R, G ,B }; };
+ /// typedef EnumClass<_ColorDef> Color;
/// \endcode
/// Conversion to from string can be easily added, e.g. like this:
/// \code
- /// struct EColorDef {
+ /// struct _ColorDef {
/// enum Enum { R, G ,B };
/// static Enum fromString( const std::string & val_r );
/// static const std::string & asString( Enum val_r );
/// };
- /// std::ostream & operator<<( std::ostream & str, const EColorDef & obj )
- /// { return str << EColorDef::asString( obj.inSwitch() ); }
+ /// std::ostream & operator<<( std::ostream & str, const _ColorDef & obj )
+ /// { return str << _ColorDef::asString( obj.inSwitch() ); }
///
- /// typedef EnumClass<EColorDef> Color;
+ /// typedef EnumClass<_ColorDef> Color;
/// Color red = Color::fromString("red");
/// cout << red << endl; // "red"
/// \endcode
///////////////////////////////////////////////////////////////////
- template<typename TEnumDef>
- class EnumClass : public TEnumDef
+ template<typename _EnumDef>
+ class EnumClass : public _EnumDef
{
public:
- typedef typename TEnumDef::Enum Enum; ///< The underlying enum type
+ typedef typename _EnumDef::Enum Enum; ///< The underlying enum type
typedef typename std::underlying_type<Enum>::type Integral;///< The underlying integral type
EnumClass( Enum val_r ) : _val( val_r ) {}
/** Underlying enum value for use in switch
* \code
- * struct EColorDef { enum Enum { R, G ,B }; }
- * typedef EnumClass<EColorDef> Color;
+ * struct _ColorDef { enum Enum { R, G ,B }; }
+ * typedef EnumClass<_ColorDef> Color;
*
* Color a;
* switch ( a.asEnum() )
/** Underlying integral value (e.g. array index)
* \code
- * struct EColorDef { enum Enum { R, G ,B }; }
- * typedef EnumClass<EColorDef> Color;
+ * struct _ColorDef { enum Enum { R, G ,B }; }
+ * typedef EnumClass<_ColorDef> Color;
*
* Color a;
* std::string table[] = { "red", "green", "blue" };