mirror of
https://github.com/mappu/miqt.git
synced 2025-03-14 11:20:23 +00:00
genbindings: change simple operator== to use infix syntax
This commit is contained in:
parent
33c5bbaafb
commit
2a502f24ff
@ -1026,6 +1026,14 @@ func emitBindingCpp(src *CppParsedHeader, filename string) (string, error) {
|
|||||||
|
|
||||||
callTarget += m.CppCallTarget() + "(" + forwarding + ")"
|
callTarget += m.CppCallTarget() + "(" + forwarding + ")"
|
||||||
|
|
||||||
|
// Qt 6.8 moved many operator== implementations from class methods
|
||||||
|
// into global operators.
|
||||||
|
// By using infix syntax, either can be called
|
||||||
|
if m.IsReadonlyOperator() && len(m.Parameters) == 1 {
|
||||||
|
operator := m.CppCallTarget()[8:]
|
||||||
|
callTarget = "(*self " + operator + " " + forwarding + ")"
|
||||||
|
}
|
||||||
|
|
||||||
if m.LinuxOnly {
|
if m.LinuxOnly {
|
||||||
ret.WriteString(fmt.Sprintf(
|
ret.WriteString(fmt.Sprintf(
|
||||||
"%s %s_%s(%s) {\n"+
|
"%s %s_%s(%s) {\n"+
|
||||||
|
@ -348,6 +348,16 @@ func (nm CppMethod) SafeMethodName() string {
|
|||||||
return tmp
|
return tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (nm CppMethod) IsReadonlyOperator() bool {
|
||||||
|
targ := nm.CppCallTarget()
|
||||||
|
switch targ {
|
||||||
|
case "operator==", "operator!=",
|
||||||
|
"operator<", "operator<=", "operator>", "operator>=":
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
type CppEnumEntry struct {
|
type CppEnumEntry struct {
|
||||||
EntryName string
|
EntryName string
|
||||||
EntryValue string
|
EntryValue string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user