mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
Serialisable enums can be converted to int
This commit is contained in:
parent
a37e71f362
commit
f7db342f49
@ -152,14 +152,14 @@ friend inline std::ostream & operator << (std::ostream &os, const cname &obj ) {
|
||||
class name: public Serializable\
|
||||
{\
|
||||
public:\
|
||||
enum EnumType\
|
||||
enum\
|
||||
{\
|
||||
GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_ENUMVAL,__VA_ARGS__))\
|
||||
undefname = -1\
|
||||
};\
|
||||
public:\
|
||||
name(void): value_(undefname) {};\
|
||||
name(EnumType value): value_(value) {};\
|
||||
name(int value): value_(value) {};\
|
||||
template <typename T>\
|
||||
static inline void write(Writer<T> &WR,const std::string &s, const name &obj)\
|
||||
{\
|
||||
@ -179,7 +179,7 @@ public:\
|
||||
GRID_MACRO_EVAL(GRID_MACRO_MAP(GRID_MACRO_ENUMTEST,__VA_ARGS__))\
|
||||
else {obj = name::undefname;}\
|
||||
}\
|
||||
inline operator EnumType(void) const\
|
||||
inline operator int(void) const\
|
||||
{\
|
||||
return value_;\
|
||||
}\
|
||||
@ -192,7 +192,7 @@ public:\
|
||||
return os;\
|
||||
}\
|
||||
private:\
|
||||
EnumType value_;\
|
||||
int value_;\
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user