diff options
author | Niklas Halle <niklas@niklashalle.net> | 2020-08-23 17:40:25 +0200 |
---|---|---|
committer | Niklas Halle <niklas@niklashalle.net> | 2020-08-23 17:40:25 +0200 |
commit | b5b8de1b3005ff6c6e3659d32b851a85f6671d88 (patch) | |
tree | 6f2a54196a3b2c2d29dfaeaf7e6a8b9e43f33ba6 /include/Enum2String.hpp | |
parent | b3e3f3f50e49c6d21032e44565a93ed96d99801b (diff) | |
download | n_core-b5b8de1b3005ff6c6e3659d32b851a85f6671d88.tar.gz n_core-b5b8de1b3005ff6c6e3659d32b851a85f6671d88.zip |
added some helper functions and a nice enum for annotation handling, as well as an more complex reply example (multi annotaion, link annotation
Diffstat (limited to 'include/Enum2String.hpp')
-rw-r--r-- | include/Enum2String.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/Enum2String.hpp b/include/Enum2String.hpp new file mode 100644 index 0000000..4992e0d --- /dev/null +++ b/include/Enum2String.hpp @@ -0,0 +1,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
\ No newline at end of file |