forked from therecipe/qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enum.go
42 lines (35 loc) · 847 Bytes
/
enum.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
package parser
import "strings"
type Enum struct {
Name string `xml:"name,attr"`
Fullname string `xml:"fullname,attr"`
Status string `xml:"status,attr"`
Access string `xml:"access,attr"`
Typedef string `xml:"typedef,attr"`
Values []*Value `xml:"value"`
NoConst bool
}
type Value struct {
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
}
func (e *Enum) Class() (*Class, bool) {
var class, ok = State.ClassMap[e.ClassName()]
return class, ok
}
func (e *Enum) ClassName() string {
return strings.Split(e.Fullname, "::")[0]
}
func (e *Enum) register(m string) {
if c, ok := e.Class(); !ok {
State.ClassMap[e.ClassName()] = &Class{
Name: e.ClassName(),
Status: "commendable",
Module: m,
Access: "public",
Enums: []*Enum{e},
}
} else {
c.Enums = append(c.Enums, e)
}
}