mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/types: pointer and return type fixes
This commit is contained in:
parent
c6381d40e8
commit
eca87471ee
@ -35,6 +35,9 @@ func (p CppParameter) RenderTypeCabi() string {
|
||||
return "struct miqt_map " + cppComment("tuple of "+inner1.RenderTypeCabi()+" and "+inner2.RenderTypeCabi())
|
||||
|
||||
} else if (p.Pointer || p.ByRef) && p.QtClassType() {
|
||||
if p.PointerCount > 1 {
|
||||
return cabiClassName(p.ParameterType) + strings.Repeat("*", p.PointerCount)
|
||||
}
|
||||
return cabiClassName(p.ParameterType) + "*"
|
||||
|
||||
} else if p.QtClassType() && !p.Pointer {
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
func goReservedWord(s string) bool {
|
||||
switch s {
|
||||
case "default", "const", "func", "var", "type", "len", "new", "copy", "import", "range", "string", "map", "int", "select",
|
||||
"ret": // not a language-reserved word, but a binding-reserved word
|
||||
"super", "ret": // not language-reserved words, but a binding-reserved words
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
@ -154,6 +154,20 @@ func (p CppParameter) RenderTypeGo(gfs *goFileState) string {
|
||||
return ret // ignore const
|
||||
}
|
||||
|
||||
func (p CppParameter) renderReturnTypeGo(gfs *goFileState) string {
|
||||
ret := p.RenderTypeGo(gfs)
|
||||
if ret == "void" {
|
||||
ret = ""
|
||||
}
|
||||
|
||||
if p.QtClassType() && p.ParameterType != "QString" && p.ParameterType != "QByteArray" && !(p.Pointer || p.ByRef) {
|
||||
// FIXME normalize this part
|
||||
ret = "*" + ret
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
||||
func (p CppParameter) parameterTypeCgo() string {
|
||||
if p.ParameterType == "QString" {
|
||||
return "C.struct_miqt_string"
|
||||
@ -703,6 +717,8 @@ import "C"
|
||||
|
||||
goClassName := cabiClassName(c.ClassName)
|
||||
|
||||
// Type definition
|
||||
|
||||
ret.WriteString(`
|
||||
type ` + goClassName + ` struct {
|
||||
h *C.` + goClassName + `
|
||||
|
Loading…
Reference in New Issue
Block a user