From 28b66840046fa6186160cba21840f47cf9637ebc Mon Sep 17 00:00:00 2001 From: mappu Date: Sun, 18 Aug 2024 15:27:03 +1200 Subject: [PATCH] genbindings: better names for push_back(), fix_neg_rect() --- cmd/genbindings/intermediate.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/genbindings/intermediate.go b/cmd/genbindings/intermediate.go index 6cde9a48..a62daf1e 100644 --- a/cmd/genbindings/intermediate.go +++ b/cmd/genbindings/intermediate.go @@ -1,6 +1,7 @@ package main import ( + "regexp" "strings" ) @@ -116,7 +117,12 @@ func (nm CppMethod) SafeMethodName() string { tmp := replacer.Replace(nm.MethodName) // 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 {