Merge pull request #21 from vikramrajkumar/phoenix
Make fc::reflector<ENUM>::to_string work with C++11 strongly typed enumerations
This commit is contained in:
commit
6b84b990b3
1 changed files with 24 additions and 16 deletions
|
|
@ -132,6 +132,14 @@ template<> struct reflector<ENUM> { \
|
||||||
}\
|
}\
|
||||||
return nullptr; \
|
return nullptr; \
|
||||||
} \
|
} \
|
||||||
|
static const char* to_string(ENUM elem) { \
|
||||||
|
switch( elem ) { \
|
||||||
|
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_TO_STRING, ENUM, FIELDS ) \
|
||||||
|
default: \
|
||||||
|
fc::throw_bad_enum_cast( BOOST_PP_STRINGIZE(elem), BOOST_PP_STRINGIZE(ENUM) ); \
|
||||||
|
}\
|
||||||
|
return nullptr; \
|
||||||
|
} \
|
||||||
static ENUM from_string( const char* s ) { \
|
static ENUM from_string( const char* s ) { \
|
||||||
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_FROM_STRING, ENUM, FIELDS ) \
|
BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_ENUM_FROM_STRING, ENUM, FIELDS ) \
|
||||||
fc::throw_bad_enum_cast( s, BOOST_PP_STRINGIZE(ENUM) ); \
|
fc::throw_bad_enum_cast( s, BOOST_PP_STRINGIZE(ENUM) ); \
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue