summaryrefslogtreecommitdiff
path: root/src/libical-glib/tools/xml-parser.h
blob: bccbb4d358e902a509f6562364d8825c73a28f43 (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
 * Copyright (C) 2015 William Yu <williamyu@gnome.org>
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of either:
 *
 *   The LGPL as published by the Free Software Foundation, version
 *   2.1, available at: https://www.gnu.org/licenses/lgpl-2.1.html
 *
 * Or:
 *
 *   The Mozilla Public License Version 2.0. You may obtain a copy of
 *   the License at https://www.mozilla.org/MPL/
 */

#ifndef XML_PARSER_H
#define XML_PARSER_H

#include <libxml/xmlreader.h>
#include <stdio.h>
#include <glib.h>

typedef struct Parameter {
    gchar *type;
    GList *annotations;
    gchar *comment;
    gchar *name;
    gchar *autofill;
    gchar *translator;
    GList *translatorArgus;
    gchar *native_op;
    gchar *owner_op;
} Parameter;

typedef struct Ret {
    gchar *type;
    GList *annotations;
    gchar *comment;
    gchar *translator;
    GList *translatorArgus;
    gchar *errorReturnValue;
} Ret;

typedef struct Method {
    gchar *name;
    gchar *corresponds;
    gchar *kind;
    gchar *since;
    GList *parameters;
    Ret *ret;
    gchar *comment;
    gchar *custom;
    GList *annotations;
} Method;

typedef struct Structure {
    gchar *nameSpace;
    gchar *name;
    gchar *native;
    GList *includes;
    GList *methods;
    gboolean isBare;
    gboolean isPossibleGlobal;
    gchar *new_full_extraCode;
    GList *enumerations;
    GHashTable *dependencies;
    gchar *destroyFunc;
    gchar *cloneFunc;
    gchar *defaultNative;
    GList *declarations;
} Structure;

typedef struct Declaration {
    gchar *position;
    gchar *content;
} Declaration;

typedef struct Enumeration {
    gchar *name;
    gchar *nativeName;
    GList *elements;
    gchar *defaultNative;
    gchar *comment;
} Enumeration;

Structure *structure_new();
void structure_free(Structure *structure);
Method *method_new();
void method_free(Method *method);
Parameter *parameter_new();
void parameter_free(Parameter *para);
Ret *ret_new();
void ret_free(Ret *ret);
Enumeration *enumeration_new();
void enumeration_free(Enumeration *enumeration);
Declaration *declaration_new();
void declaration_free(Declaration *declaration);

GList *get_list_from_string(const gchar *str);
gchar *get_true_type(const gchar *type);
void populate_dependencies(Structure *structure);
gboolean parse_parameters(xmlNode *node, Method *method);
gboolean parse_return(xmlNode *node, Method *method);
gboolean parse_comment(xmlNode *node, Method *method);
gboolean parse_method(xmlNode *node, Method *method);
gboolean parse_structure(xmlNode *node, Structure *structure);
gboolean parse_enumeration(xmlNode *node, Enumeration *enumeration);
gboolean parse_custom(xmlNode *node, Method *method);
gboolean parse_declaration(xmlNode *node, Declaration *declaration);

#endif  /* XML_PARSER_H */