mirror of
https://github.com/mappu/miqt.git
synced 2024-12-23 01:18:37 +00:00
genbindings/const: fixes for disambiguating calls to const methods
This commit is contained in:
parent
8da51d61f5
commit
7b5db7c7ea
@ -601,13 +601,7 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if m.ReturnType.QtClassType() && !m.ReturnType.Pointer {
|
} else if m.ReturnType.QtClassType() && !m.ReturnType.Pointer {
|
||||||
// Still need const/nonconst in order to properly call function overloads that are only disambiguated by const-ness
|
shouldReturn = m.ReturnType.ParameterType + " ret = "
|
||||||
// e.g. QCborArray::begin() can return an Iterator or a ConstIterator
|
|
||||||
if m.IsConst {
|
|
||||||
shouldReturn = "const " + m.ReturnType.ParameterType + " ret = "
|
|
||||||
} else {
|
|
||||||
shouldReturn = m.ReturnType.ParameterType + " ret = "
|
|
||||||
}
|
|
||||||
afterCall = "\t// Copy-construct value returned type into heap-allocated copy\n"
|
afterCall = "\t// Copy-construct value returned type into heap-allocated copy\n"
|
||||||
afterCall += "\treturn static_cast<" + m.ReturnType.ParameterType + "*>(new " + m.ReturnType.ParameterType + "(ret));\n"
|
afterCall += "\treturn static_cast<" + m.ReturnType.ParameterType + "*>(new " + m.ReturnType.ParameterType + "(ret));\n"
|
||||||
|
|
||||||
@ -631,6 +625,9 @@ extern "C" {
|
|||||||
callTarget := "self->"
|
callTarget := "self->"
|
||||||
if m.IsStatic {
|
if m.IsStatic {
|
||||||
callTarget = c.ClassName + "::"
|
callTarget = c.ClassName + "::"
|
||||||
|
|
||||||
|
} else if m.IsConst {
|
||||||
|
callTarget = "const_cast<const " + c.ClassName + "*>(self)->"
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.WriteString(fmt.Sprintf(
|
ret.WriteString(fmt.Sprintf(
|
||||||
|
Loading…
Reference in New Issue
Block a user