-
Notifications
You must be signed in to change notification settings - Fork 1
/
r3_args.h
57 lines (51 loc) · 1.56 KB
/
r3_args.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*! Разбор списка аргументов, совместим с glib
*/
#if !defined(R3_ARGS_H_INCLUDED) && !defined(__G_LIB_H__)
#define R3_ARGS_H_INCLUDED
typedef enum
{
G_OPTION_ARG_NONE,
G_OPTION_ARG_STRING,
G_OPTION_ARG_INT,
G_OPTION_ARG_CALLBACK,
G_OPTION_ARG_FILENAME,
G_OPTION_ARG_STRING_ARRAY,
G_OPTION_ARG_FILENAME_ARRAY,
G_OPTION_ARG_DOUBLE,
G_OPTION_ARG_INT64
} GOptionArg;
typedef enum
{
G_OPTION_ERROR_UNKNOWN_OPTION,
G_OPTION_ERROR_BAD_VALUE,
G_OPTION_ERROR_FAILED
} GOptionError;
typedef enum
{
G_OPTION_FLAG_HIDDEN = 1 << 0,
G_OPTION_FLAG_IN_MAIN = 1 << 1,
G_OPTION_FLAG_REVERSE = 1 << 2,
G_OPTION_FLAG_NO_ARG = 1 << 3,
G_OPTION_FLAG_FILENAME = 1 << 4,
G_OPTION_FLAG_OPTIONAL_ARG = 1 << 5,
G_OPTION_FLAG_NOALIAS = 1 << 6
} GOptionFlags;
#define G_OPTION_REMAINING ""
typedef struct _GOptionEntry GOptionEntry;
struct _GOptionEntry {
const char *long_name;
char short_name;
int flags;
GOptionArg arg;
void* arg_data;
const char *description;
const char *arg_description;
};
typedef struct _GOptionContext GOptionContext;
GOptionContext*
g_option_context_new (char* title);
void g_option_context_add_main_entries (GOptionContext *context, GOptionEntry *entries, void* nu/*GETTEXT_PACKAGE*/);
void g_option_context_set_summary (GOptionContext *context, const char *summary);
int g_option_context_parse (GOptionContext *context, int *argc, char***argv, void* error);
void g_option_context_free (GOptionContext *context);
#endif // R3_ARGS_H_INCLUDED