2016-04-28 20:43:44 +03:00
|
|
|
package templater
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/therecipe/qt/internal/binding/parser"
|
2016-10-26 17:44:27 +03:00
|
|
|
"github.com/therecipe/qt/internal/utils"
|
2016-04-28 20:43:44 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func hasUnimplementedPureVirtualFunctions(className string) bool {
|
2017-01-02 19:01:18 +03:00
|
|
|
for _, f := range parser.State.ClassMap[className].Functions {
|
2016-04-28 20:43:44 +03:00
|
|
|
|
2017-01-18 21:28:40 +03:00
|
|
|
if !f.Checked {
|
|
|
|
cppFunction(f)
|
|
|
|
goFunction(f)
|
|
|
|
f.Checked = true
|
|
|
|
}
|
|
|
|
|
2017-01-27 22:22:58 +03:00
|
|
|
if f.Virtual == parser.PURE && !f.IsSupported() {
|
2016-04-28 20:43:44 +03:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2017-01-02 19:01:18 +03:00
|
|
|
func goModule(module string) string {
|
2016-04-28 20:43:44 +03:00
|
|
|
return strings.ToLower(strings.TrimPrefix(module, "Qt"))
|
|
|
|
}
|
|
|
|
|
2017-03-16 22:18:32 +03:00
|
|
|
func UseStub(force bool, module string, mode int) bool {
|
|
|
|
return force || (utils.QT_STUB() && mode == NONE && !(module == "QtAndroidExtras" || module == "QtSailfish"))
|
2016-10-26 17:44:27 +03:00
|
|
|
}
|
2016-12-14 23:12:51 +03:00
|
|
|
|
2018-10-30 18:53:05 +03:00
|
|
|
func UseJs() bool { return parser.UseJs() } //TODO: remove
|
2018-06-09 03:31:50 +03:00
|
|
|
|
2017-05-16 01:06:35 +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" {
|
2017-04-17 20:21:21 +03:00
|
|
|
return "// +build !android,!android_emulator"
|
2017-01-18 21:28:40 +03:00
|
|
|
}
|
|
|
|
return "// +build !sailfish,!sailfish_emulator"
|
|
|
|
}
|
|
|
|
|
2017-03-04 21:01:53 +03:00
|
|
|
case mode == MINIMAL:
|
2016-12-14 23:12:51 +03:00
|
|
|
{
|
|
|
|
return "// +build minimal"
|
|
|
|
}
|
|
|
|
|
2017-03-04 21:01:53 +03:00
|
|
|
case mode == MOC:
|
2016-12-14 23:12:51 +03:00
|
|
|
{
|
2017-05-16 01:06:35 +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
|
|
|
{
|
2017-04-17 20:21:21 +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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|