forked from go-gl/glow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
overload.go
52 lines (41 loc) · 1.03 KB
/
overload.go
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
package main
import (
"encoding/xml"
"os"
)
type xmlOverloads struct {
Overloads []xmlOverload `xml:"overload"`
}
type xmlOverload struct {
Name string `xml:"name,attr"`
OverloadName string `xml:"overloadName,attr"`
ParameterChanges []xmlParameterChange `xml:"parameterChanges>change"`
}
type xmlParameterChange struct {
// Index is the zero-based index of the parameter list.
Index int `xml:"index,attr"`
// Name describes a change of the parameter name.
Name *xmlNameChange `xml:"name"`
// Type describes a change of the parameter type.
Type *xmlTypeChange `xml:"type"`
}
type xmlNameChange struct {
Value string `xml:"value,attr"`
}
type xmlTypeChange struct {
Signature string `xml:"signature,attr"`
}
func readOverloadFile(file string) (xmlOverloads, error) {
var overloads xmlOverloads
_, err := os.Stat(file)
if err != nil {
return overloads, nil
}
f, err := os.Open(file)
if err != nil {
return overloads, err
}
defer f.Close()
err = xml.NewDecoder(f).Decode(&overloads)
return overloads, err
}