aboutsummaryrefslogtreecommitdiffstats
path: root/include/Enum2String.hpp
blob: 4992e0d32db22b71153efba0fbf0b1431b0b9fd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#undef DECL_ENUM_ELEMENT
#undef BEGIN_ENUM
#undef END_ENUM

#ifndef GENERATE_ENUM_STRINGS
#define DECL_ENUM_ELEMENT( element ) element
#define BEGIN_ENUM( ENUM_NAME ) typedef enum tag##ENUM_NAME
#define END_ENUM( ENUM_NAME ) ENUM_NAME; \
            std::string GetString##ENUM_NAME(enum tag##ENUM_NAME index);
#else
#define DECL_ENUM_ELEMENT( element ) #element
    #define BEGIN_ENUM( ENUM_NAME ) std::string gs_##ENUM_NAME [] =
    #define END_ENUM( ENUM_NAME ) ; std::string GetString##ENUM_NAME(\
            tag##ENUM_NAME index){ return gs_##ENUM_NAME [index]; }
#endif