mirror of
https://github.com/mappu/miqt.git
synced 2025-01-18 12:50:41 +00:00
genbindings: move 'qt_' prefix renaming into SafeMethodName()
This commit is contained in:
parent
6d09ef795b
commit
33b26204f8
@ -265,10 +265,6 @@ nextMethod:
|
|||||||
|
|
||||||
var mm CppMethod
|
var mm CppMethod
|
||||||
mm.MethodName = methodName
|
mm.MethodName = methodName
|
||||||
if strings.HasPrefix(methodName, "qt_") { // Strip redundant Qt prefix, we know these are all Qt functions
|
|
||||||
mm.OverrideMethodName = methodName
|
|
||||||
mm.MethodName = methodName[3:]
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(methodName, `QGADGET`) {
|
if strings.Contains(methodName, `QGADGET`) {
|
||||||
log.Printf("Skipping method %q with weird QGADGET behaviour\n", mm.MethodName)
|
log.Printf("Skipping method %q with weird QGADGET behaviour\n", mm.MethodName)
|
||||||
|
@ -105,6 +105,14 @@ func (nm CppMethod) IsReceiverMethod() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (nm CppMethod) SafeMethodName() string {
|
func (nm CppMethod) SafeMethodName() string {
|
||||||
|
|
||||||
|
tmp := nm.MethodName
|
||||||
|
|
||||||
|
// Strip redundant Qt prefix, we know these are all Qt functions
|
||||||
|
if strings.HasPrefix(tmp, "qt_") {
|
||||||
|
tmp = tmp[3:]
|
||||||
|
}
|
||||||
|
|
||||||
// Operator-overload methods have names not representable in binding
|
// Operator-overload methods have names not representable in binding
|
||||||
// languages. Replace more specific cases first
|
// languages. Replace more specific cases first
|
||||||
replacer := strings.NewReplacer(
|
replacer := strings.NewReplacer(
|
||||||
@ -138,8 +146,7 @@ func (nm CppMethod) SafeMethodName() string {
|
|||||||
`[]`, `Subscript`,
|
`[]`, `Subscript`,
|
||||||
`()`, `Call`,
|
`()`, `Call`,
|
||||||
)
|
)
|
||||||
|
tmp = replacer.Replace(tmp)
|
||||||
tmp := replacer.Replace(nm.MethodName)
|
|
||||||
|
|
||||||
// Also make the first letter uppercase so it becomes public in Go
|
// Also make the first letter uppercase so it becomes public in Go
|
||||||
tmp = titleCase(tmp)
|
tmp = titleCase(tmp)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user