cutego/internal/binding/templater/helper.go

75 lines
1.4 KiB
Go
Raw Normal View History

package templater
import (
"strings"
"github.com/therecipe/qt/internal/binding/parser"
"github.com/therecipe/qt/internal/utils"
)
func hasUnimplementedPureVirtualFunctions(className string) bool {
2017-01-02 19:01:18 +03:00
for _, f := range parser.State.ClassMap[className].Functions {
2017-01-18 21:28:40 +03:00
if !f.Checked {
cppFunction(f)
goFunction(f)
f.Checked = true
}
if f.Virtual == parser.PURE && !f.IsSupported() {
return true
}
}
return false
}
2017-01-02 19:01:18 +03:00
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"))
}
2016-12-14 23:12:51 +03:00
func UseJs() bool { return parser.UseJs() } //TODO: remove
2018-06-09 03:31:50 +03:00
func buildTags(module string, stub bool, mode int, tags string) string {
2016-12-14 23:12:51 +03:00
switch {
2017-01-18 21:28:40 +03:00
case stub:
{
if module == "QtAndroidExtras" || module == "androidextras" {
return "// +build !android,!android_emulator"
2017-01-18 21:28:40 +03:00
}
return "// +build !sailfish,!sailfish_emulator"
}
case mode == MINIMAL:
2016-12-14 23:12:51 +03:00
{
return "// +build minimal"
}
case mode == MOC:
2016-12-14 23:12:51 +03:00
{
if tags != "" {
return "// +build " + tags
}
2016-12-14 23:12:51 +03:00
return ""
}
2017-01-18 21:28:40 +03:00
case module == "QtAndroidExtras", module == "androidextras":
2016-12-14 23:12:51 +03:00
{
return "// +build android android_emulator"
2016-12-14 23:12:51 +03:00
}
2017-01-18 21:28:40 +03:00
case module == "QtSailfish", module == "sailfish":
2016-12-14 23:12:51 +03:00
{
return "// +build sailfish sailfish_emulator"
}
default:
{
return "// +build !minimal"
}
}
}