summaryrefslogtreecommitdiff
path: root/enum.h
diff options
context:
space:
mode:
Diffstat (limited to 'enum.h')
-rw-r--r--enum.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/enum.h b/enum.h
new file mode 100644
index 0000000..68bbc99
--- /dev/null
+++ b/enum.h
@@ -0,0 +1,37 @@
+#ifndef _ENUM_
+#define _ENUM_
+
+#include <string.h>
+
+typedef enum {
+ ANIME,
+ MANGA,
+} target_e;
+
+typedef enum {
+ GET,
+ SET,
+ ADD,
+} mode_e;
+
+static const struct {
+ mode_e val;
+ const char *str;
+} conversion_mode [] = {
+ {GET, "get"},
+ {SET, "set"},
+ {ADD, "add"},
+};
+
+static const struct {
+ target_e val;
+ const char *str;
+} conversion_target [] = {
+ {ANIME, "anime"},
+ {MANGA, "manga"},
+};
+
+mode_e str2enum_mode(const char *str);
+target_e str2enum_target(const char *str);
+
+#endif