genbindings: better names for push_back(), fix_neg_rect()

This commit is contained in:
mappu 2024-08-18 15:27:03 +12:00
parent d8145be2da
commit 28b6684004

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"regexp"
"strings" "strings"
) )
@ -116,7 +117,12 @@ func (nm CppMethod) SafeMethodName() string {
tmp := replacer.Replace(nm.MethodName) 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
return titleCase(tmp) tmp = titleCase(tmp)
// Also replace any underscore_case with CamelCase
tmp = regexp.MustCompile(`_([a-z])`).ReplaceAllStringFunc(tmp, func(match string) string { return strings.ToUpper(match[1:]) })
return tmp
} }
type CppClass struct { type CppClass struct {