mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings: bind all Qt::constants as int
This commit is contained in:
parent
a6f0a3cca5
commit
b4df6d06f9
@ -510,10 +510,6 @@ func parseMethod(node map[string]interface{}, mm *CppMethod) error {
|
||||
// not filled in.
|
||||
func parseTypeString(typeString string) (CppParameter, []CppParameter, error) {
|
||||
|
||||
if strings.Contains(typeString, `::`) {
|
||||
return CppParameter{}, nil, ErrTooComplex
|
||||
}
|
||||
|
||||
if strings.Contains(typeString, `&&`) { // TODO Rvalue references
|
||||
return CppParameter{}, nil, ErrTooComplex
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ func (p CppParameter) RenderTypeCabi() string {
|
||||
ret = "unsigned int"
|
||||
}
|
||||
|
||||
if strings.Contains(p.ParameterType, `::`) {
|
||||
ret = "int"
|
||||
}
|
||||
|
||||
if p.Pointer || p.ByRef {
|
||||
ret += "*"
|
||||
}
|
||||
|
@ -86,8 +86,13 @@ func (p CppParameter) RenderTypeGo() string {
|
||||
case "qintptr", "uintptr_t", "intptr_t", "quintptr":
|
||||
ret += "uintptr"
|
||||
default:
|
||||
// Do not transform this type
|
||||
ret += p.ParameterType
|
||||
|
||||
if strings.Contains(p.ParameterType, `::`) {
|
||||
ret += "int"
|
||||
} else {
|
||||
// Do not transform this type
|
||||
ret += p.ParameterType
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ type CppParameter struct {
|
||||
}
|
||||
|
||||
func (p CppParameter) QtClassType() bool {
|
||||
return (p.ParameterType[0] == 'Q') && p.ParameterType != "QRgb"
|
||||
return (p.ParameterType[0] == 'Q') && p.ParameterType != "QRgb" && !strings.Contains(p.ParameterType, `::`)
|
||||
}
|
||||
|
||||
func (p CppParameter) QListOf() (CppParameter, bool) {
|
||||
@ -46,6 +46,10 @@ func (p CppParameter) QSetOf() bool {
|
||||
|
||||
func (p CppParameter) IntType() bool {
|
||||
|
||||
if strings.Contains(p.ParameterType, `::`) {
|
||||
return true
|
||||
}
|
||||
|
||||
switch p.ParameterType {
|
||||
case "int", "unsigned int", "uint",
|
||||
"short", "unsigned short", "ushort", "qint16", "quint16",
|
||||
|
@ -5,6 +5,10 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (p CppParameter) renderTypeForMethod() string {
|
||||
return strings.NewReplacer(" ", "", "::", "").Replace(p.ParameterType)
|
||||
}
|
||||
|
||||
// astTransformOverloads renames methods if another method exists with the same
|
||||
// name.
|
||||
func astTransformOverloads(parsed *CppParsedHeader) {
|
||||
@ -40,7 +44,7 @@ func astTransformOverloads(parsed *CppParsedHeader) {
|
||||
proposedName = originalProposal + "With" + titleCase(m.Parameters[0].ParameterName)
|
||||
} else {
|
||||
// Try the type instead
|
||||
proposedName = originalProposal + "With" + titleCase(strings.Replace(m.Parameters[0].ParameterType, " ", "", -1))
|
||||
proposedName = originalProposal + "With" + titleCase(m.Parameters[0].renderTypeForMethod())
|
||||
}
|
||||
if _, ok := existing[proposedName]; !ok {
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user