genbindings: move QFlag<> handling into normal emitgo/emitcabi emission

This commit is contained in:
mappu 2024-08-27 18:44:44 +12:00
parent 150dab7c46
commit 64e46e1978
3 changed files with 8 additions and 6 deletions

View File

@ -626,10 +626,6 @@ func tokenizeMultipleParameters(p string) []string {
func parseSingleTypeString(p string) CppParameter {
if strings.HasPrefix(p, "QFlag<") {
return CppParameter{ParameterType: "int"}
}
if strings.Contains(p, "(*)") {
return CppParameter{ParameterType: "uintptr"} // Function pointer, nonrepresentible
}

View File

@ -45,7 +45,10 @@ func (p CppParameter) RenderTypeCabi() string {
ret = "ptrdiff_t"
}
if strings.Contains(p.ParameterType, `::`) {
if strings.HasPrefix(p.ParameterType, `QFlags<`) {
ret = "int"
} else if strings.Contains(p.ParameterType, `::`) {
if _, ok := KnownClassnames[p.ParameterType]; ok {
// Inner class
ret = cabiClassName(p.ParameterType)

View File

@ -81,7 +81,10 @@ func (p CppParameter) RenderTypeGo() string {
ret += "uintptr"
default:
if strings.Contains(p.ParameterType, `::`) {
if strings.HasPrefix(p.ParameterType, `QFlags<`) {
ret += "int"
} else if strings.Contains(p.ParameterType, `::`) {
if _, ok := KnownClassnames[p.ParameterType]; ok {
// Inner class
ret += cabiClassName(p.ParameterType)