aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/AnnotationTypes.hpp23
-rw-r--r--include/Enum2String.hpp15
2 files changed, 38 insertions, 0 deletions
diff --git a/include/AnnotationTypes.hpp b/include/AnnotationTypes.hpp
new file mode 100644
index 0000000..d61de08
--- /dev/null
+++ b/include/AnnotationTypes.hpp
@@ -0,0 +1,23 @@
+#if ( !defined(ANNOTATIONTYPES_HPP) || defined(GENERATE_ENUM_STRINGS) )
+
+#if (!defined(GENERATE_ENUM_STRINGS))
+#define ANNOTATIONTYPES_HPP
+#endif
+
+#include "Enum2String.hpp"
+
+///////////////////////////////
+// The enum declaration
+///////////////////////////////
+namespace Reply {
+ BEGIN_ENUM(AnnotationType) {
+ DECL_ENUM_ELEMENT(none),
+ DECL_ENUM_ELEMENT(bold),
+ DECL_ENUM_ELEMENT(italics),
+ DECL_ENUM_ELEMENT(strikethrough),
+ DECL_ENUM_ELEMENT(underline),
+ DECL_ENUM_ELEMENT(link),
+ } END_ENUM(AnnotationType)
+}
+
+#endif // (!defined(ANNOTATIONTYPES_HPP) || defined(GENERATE_ENUM_STRINGS)) \ No newline at end of file
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