-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatchFile.hx
More file actions
105 lines (94 loc) · 2.64 KB
/
PatchFile.hx
File metadata and controls
105 lines (94 loc) · 2.64 KB
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
/*
* doxygen2hxcpp - Extern generator for hxcpp using doxygen xml output
* Copyright 2015 Valentin Lemière, Guillaume Desquesnes
*
* This file is part of doxygen2hxcpp.
*
* doxygen2hxcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* doxygen2hxcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with doxygen2hxcpp. If not, see <http://www.gnu.org/licenses/>.
*/
import data.*;
class PatchFile
{
var ignored = new Map<String, Bool>();
public var typedefs = new Array<TypedefData>();
public var vars = new Map<String, Array<VariableData>>();
public var vars_static = new Map<String, Array<VariableData>>();
public var updated_vars = new Map<String, String>();
public function new (?xml:Xml)
{
if (xml == null)
{
// no patch
}
else
{
// read patches
var root = xml.elementsNamed("root").next();
for (operation in root.elements())
{
switch (operation.nodeName)
{
case "ignore":
for (e in operation.elementsNamed("item"))
{
ignored.set(e.get("name"), true);
}
case "add":
for (e in operation.elements())
{
switch (e.nodeName)
{
case "typedef":
typedefs.push({ name: e.get("name"), value: Haxe(e.get("is")), doc: null });
case "var":
var file = e.get("file");
var obj = { name: e.get("name"), native: "", initializer: e.get("value"), type: TypeValue.Haxe(e.get("type")), doc: null };
if (e.get("static") == "true")
{
if (!vars_static.exists(file))
{
vars_static.set(file,new Array<VariableData>());
}
vars_static.get(file).push(obj);
}
else
{
if (!vars.exists(file))
{
vars.set(file, new Array<VariableData>());
}
vars.get(file).push(obj);
}
}
}
case "set" :
for (e in operation.elements())
{
switch (e.nodeName)
{
case "var":
var name = e.get("name");
var key = e.get("file") + "." + name;
updated_vars.set(key, e.get("value"));
}
}
}
}
}
}
public inline function ignores (name:String) : Bool
{
return ignored.exists(name);
}
}