genbindings/intermediate: add Void() helper method

This commit is contained in:
mappu 2024-11-15 14:25:17 +13:00
parent 4fbf4c702a
commit 5a3c3556a1
4 changed files with 7 additions and 3 deletions

View File

@ -171,7 +171,7 @@ func AllowClass(className string) bool {
} }
func AllowSignal(mm CppMethod) bool { func AllowSignal(mm CppMethod) bool {
if mm.ReturnType.ParameterType != "void" { if !mm.ReturnType.Void() {
// This affects how we cast the signal function pointer for connect // This affects how we cast the signal function pointer for connect
// It would be fixable, but, real signals always have void return types anyway // It would be fixable, but, real signals always have void return types anyway
return false return false

View File

@ -343,7 +343,7 @@ func emitAssignCppToCabi(assignExpression string, p CppParameter, rvalue string)
namePrefix := makeNamePrefix(p.ParameterName) namePrefix := makeNamePrefix(p.ParameterName)
if p.ParameterType == "void" && !p.Pointer { if p.Void() {
shouldReturn = "" shouldReturn = ""
} else if p.ParameterType == "QString" { } else if p.ParameterType == "QString" {

View File

@ -404,7 +404,7 @@ func (gfs *goFileState) emitCabiToGo(assignExpr string, rt CppParameter, rvalue
afterword := "" afterword := ""
namePrefix := makeNamePrefix(rt.ParameterName) namePrefix := makeNamePrefix(rt.ParameterName)
if rt.ParameterType == "void" && !rt.Pointer { if rt.Void() {
shouldReturn = "" shouldReturn = ""
return shouldReturn + " " + rvalue + "\n" + afterword return shouldReturn + " " + rvalue + "\n" + afterword

View File

@ -207,6 +207,10 @@ func (p CppParameter) IntType() bool {
} }
} }
func (p CppParameter) Void() bool {
return p.ParameterType == "void" && !p.Pointer
}
type CppProperty struct { type CppProperty struct {
PropertyName string PropertyName string
PropertyType string PropertyType string