From b5b8de1b3005ff6c6e3659d32b851a85f6671d88 Mon Sep 17 00:00:00 2001 From: Niklas Halle Date: Sun, 23 Aug 2020 17:40:25 +0200 Subject: added some helper functions and a nice enum for annotation handling, as well as an more complex reply example (multi annotaion, link annotation --- include/Enum2String.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 include/Enum2String.hpp (limited to 'include/Enum2String.hpp') 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 -- cgit v1.2.3-54-g00ecf