package main import ( "strings" ) type CppParameter struct { ParameterName string ParameterType string } type CppProperty struct { PropertyName string PropertyType string Visibility string } type CppMethod struct { MethodName string ReturnType string Parameters []CppParameter } func (nm CppMethod) SafeMethodName() string { // Operator-overload methods have names not representable in binding // languages. Replace more specific cases first replacer := strings.NewReplacer( `==`, `Equal`, `>=`, `GreaterOrEqual`, `<=`, `LesserOrEqual`, `=`, `Assign`, `>`, `Greater`, `<`, `Lesser`, `+`, `Plus`, `-`, `Minus`, `*`, `Multiply`, `/`, `Divide`, `%`, `Modulo`, `&&`, `LogicalAnd`, `||`, `LogicalOr`, `!`, `Not`, `&`, `BitwiseAnd`, `|`, `BitwiseOr`, `~`, `BitwiseXor`, `^`, `BitwiseNot`, `->`, `PointerDereference`, `[]`, `Subscript`, `()`, `Call`, ) return replacer.Replace(nm.MethodName) } type CppClass struct { ClassName string Ctors []CppMethod // only use the parameters Extends []string Methods []CppMethod Props []CppProperty } type CppParsedHeader struct { Classes []CppClass }