forked from therecipe/qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helper.go
74 lines (60 loc) · 1.44 KB
/
helper.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package templater
import (
"strings"
"github.com/ilius/qt/internal/binding/parser"
"github.com/ilius/qt/internal/utils"
)
func hasUnimplementedPureVirtualFunctions(className string) bool {
for _, f := range parser.State.ClassMap[className].Functions {
if !f.Checked {
cppFunction(f)
goFunction(f)
f.Checked = true
}
if f.Virtual == parser.PURE && !f.IsSupported() {
return true
}
}
return false
}
func goModule(module string) string {
return strings.ToLower(strings.TrimPrefix(module, "Qt"))
}
func UseStub(force bool, module string, mode int) bool {
return force || (utils.QT_STUB() && mode == NONE && !(module == "QtAndroidExtras" || module == "QtSailfish"))
}
func UseJs() bool { return parser.UseJs() } //TODO: remove
func buildTags(module string, stub bool, mode int, tags string) string {
switch {
case stub:
{
if module == "QtAndroidExtras" || module == "androidextras" {
return "// +build !android,!android_emulator"
}
return "// +build !sailfish,!sailfish_emulator"
}
case mode == MINIMAL:
{
return "// +build minimal"
}
case mode == MOC:
{
if tags != "" {
return "// +build " + tags
}
return ""
}
case module == "QtAndroidExtras", module == "androidextras":
{
return "// +build android android_emulator"
}
case module == "QtSailfish", module == "sailfish":
{
return "// +build sailfish sailfish_emulator"
}
default:
{
return "// +build !minimal"
}
}
}