diff --git a/cmd/genbindings/clang2il.go b/cmd/genbindings/clang2il.go index cc773e84..a69e2b3c 100644 --- a/cmd/genbindings/clang2il.go +++ b/cmd/genbindings/clang2il.go @@ -510,10 +510,6 @@ func parseMethod(node map[string]interface{}, mm *CppMethod) error { // not filled in. func parseTypeString(typeString string) (CppParameter, []CppParameter, error) { - if strings.Contains(typeString, `::`) { - return CppParameter{}, nil, ErrTooComplex - } - if strings.Contains(typeString, `&&`) { // TODO Rvalue references return CppParameter{}, nil, ErrTooComplex } diff --git a/cmd/genbindings/emitcabi.go b/cmd/genbindings/emitcabi.go index 4aea9d25..99e31f78 100644 --- a/cmd/genbindings/emitcabi.go +++ b/cmd/genbindings/emitcabi.go @@ -45,6 +45,10 @@ func (p CppParameter) RenderTypeCabi() string { ret = "unsigned int" } + if strings.Contains(p.ParameterType, `::`) { + ret = "int" + } + if p.Pointer || p.ByRef { ret += "*" } diff --git a/cmd/genbindings/emitgo.go b/cmd/genbindings/emitgo.go index 14e61165..af28ae93 100644 --- a/cmd/genbindings/emitgo.go +++ b/cmd/genbindings/emitgo.go @@ -86,8 +86,13 @@ func (p CppParameter) RenderTypeGo() string { case "qintptr", "uintptr_t", "intptr_t", "quintptr": ret += "uintptr" default: - // Do not transform this type - ret += p.ParameterType + + if strings.Contains(p.ParameterType, `::`) { + ret += "int" + } else { + // Do not transform this type + ret += p.ParameterType + } } diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 17ecbed0..175754ce 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -16,7 +16,7 @@ type CppParameter struct { } func (p CppParameter) QtClassType() bool { - return (p.ParameterType[0] == 'Q') && p.ParameterType != "QRgb" + return (p.ParameterType[0] == 'Q') && p.ParameterType != "QRgb" && !strings.Contains(p.ParameterType, `::`) } func (p CppParameter) QListOf() (CppParameter, bool) { @@ -46,6 +46,10 @@ func (p CppParameter) QSetOf() bool { func (p CppParameter) IntType() bool { + if strings.Contains(p.ParameterType, `::`) { + return true + } + switch p.ParameterType { case "int", "unsigned int", "uint", "short", "unsigned short", "ushort", "qint16", "quint16", diff --git a/cmd/genbindings/transformoverload.go b/cmd/genbindings/transformoverload.go index bef2f2fc..ceb4f598 100644 --- a/cmd/genbindings/transformoverload.go +++ b/cmd/genbindings/transformoverload.go @@ -5,6 +5,10 @@ import ( "strings" ) +func (p CppParameter) renderTypeForMethod() string { + return strings.NewReplacer(" ", "", "::", "").Replace(p.ParameterType) +} + // astTransformOverloads renames methods if another method exists with the same // name. func astTransformOverloads(parsed *CppParsedHeader) { @@ -40,7 +44,7 @@ func astTransformOverloads(parsed *CppParsedHeader) { proposedName = originalProposal + "With" + titleCase(m.Parameters[0].ParameterName) } else { // Try the type instead - proposedName = originalProposal + "With" + titleCase(strings.Replace(m.Parameters[0].ParameterType, " ", "", -1)) + proposedName = originalProposal + "With" + titleCase(m.Parameters[0].renderTypeForMethod()) } if _, ok := existing[proposedName]; !ok { break