mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings: add QtClassType() helper
This commit is contained in:
parent
d5e6a21ae4
commit
2dc9d1bab7
@ -26,7 +26,7 @@ func emitParametersCpp(params []CppParameter, selfType string) string {
|
||||
// Declare that we take two parameters
|
||||
tmp = append(tmp, "const char* "+p.ParameterName+", size_t "+p.ParameterName+"_Strlen")
|
||||
|
||||
} else if (p.ByRef || p.Pointer) && p.ParameterType[0] == 'Q' {
|
||||
} else if (p.ByRef || p.Pointer) && p.QtClassType() {
|
||||
// Pointer to Qt type
|
||||
// Replace with taking our PQ typedef by value
|
||||
tmp = append(tmp, "P"+p.ParameterType+" "+p.ParameterName)
|
||||
|
@ -48,7 +48,7 @@ func emitParametersGo2CABIForwarding(params []CppParameter) (preamble string, fo
|
||||
preamble += "defer C.free(" + p.ParameterName + "_Cstring)\n"
|
||||
tmp = append(tmp, p.ParameterName+"_Cstring")
|
||||
|
||||
} else if (p.Pointer || p.ByRef) && p.ParameterType[0] == 'Q' {
|
||||
} else if (p.Pointer || p.ByRef) && p.QtClassType() {
|
||||
// The C++ type is a pointer to Qt class
|
||||
// We want our functions to accept the Go wrapper type, and forward as cPointer()
|
||||
tmp = append(tmp, p.ParameterName+".cPointer()")
|
||||
|
@ -13,6 +13,10 @@ type CppParameter struct {
|
||||
Optional bool
|
||||
}
|
||||
|
||||
func (p CppParameter) QtClassType() bool {
|
||||
return p.ParameterType[0] == 'Q'
|
||||
}
|
||||
|
||||
type CppProperty struct {
|
||||
PropertyName string
|
||||
PropertyType string
|
||||
|
Loading…
Reference in New Issue
Block a user