1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
|