mirror of
https://github.com/mappu/miqt.git
synced 2025-01-03 14:18: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.
|
// not filled in.
|
||||||
func parseTypeString(typeString string) (CppParameter, []CppParameter, error) {
|
func parseTypeString(typeString string) (CppParameter, []CppParameter, error) {
|
||||||
|
|
||||||
if strings.Contains(typeString, `::`) {
|
|
||||||
return CppParameter{}, nil, ErrTooComplex
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(typeString, `&&`) { // TODO Rvalue references
|
if strings.Contains(typeString, `&&`) { // TODO Rvalue references
|
||||||
return CppParameter{}, nil, ErrTooComplex
|
return CppParameter{}, nil, ErrTooComplex
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ func (p CppParameter) RenderTypeCabi() string {
|
|||||||
ret = "unsigned int"
|
ret = "unsigned int"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.Contains(p.ParameterType, `::`) {
|
||||||
|
ret = "int"
|
||||||
|
}
|
||||||
|
|
||||||
if p.Pointer || p.ByRef {
|
if p.Pointer || p.ByRef {
|
||||||
ret += "*"
|
ret += "*"
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,13 @@ func (p CppParameter) RenderTypeGo() string {
|
|||||||
case "qintptr", "uintptr_t", "intptr_t", "quintptr":
|
case "qintptr", "uintptr_t", "intptr_t", "quintptr":
|
||||||
ret += "uintptr"
|
ret += "uintptr"
|
||||||
default:
|
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 {
|
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) {
|
func (p CppParameter) QListOf() (CppParameter, bool) {
|
||||||
@ -46,6 +46,10 @@ func (p CppParameter) QSetOf() bool {
|
|||||||
|
|
||||||
func (p CppParameter) IntType() bool {
|
func (p CppParameter) IntType() bool {
|
||||||
|
|
||||||
|
if strings.Contains(p.ParameterType, `::`) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
switch p.ParameterType {
|
switch p.ParameterType {
|
||||||
case "int", "unsigned int", "uint",
|
case "int", "unsigned int", "uint",
|
||||||
"short", "unsigned short", "ushort", "qint16", "quint16",
|
"short", "unsigned short", "ushort", "qint16", "quint16",
|
||||||
|
@ -5,6 +5,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (p CppParameter) renderTypeForMethod() string {
|
||||||
|
return strings.NewReplacer(" ", "", "::", "").Replace(p.ParameterType)
|
||||||
|
}
|
||||||
|
|
||||||
// astTransformOverloads renames methods if another method exists with the same
|
// astTransformOverloads renames methods if another method exists with the same
|
||||||
// name.
|
// name.
|
||||||
func astTransformOverloads(parsed *CppParsedHeader) {
|
func astTransformOverloads(parsed *CppParsedHeader) {
|
||||||
@ -40,7 +44,7 @@ func astTransformOverloads(parsed *CppParsedHeader) {
|
|||||||
proposedName = originalProposal + "With" + titleCase(m.Parameters[0].ParameterName)
|
proposedName = originalProposal + "With" + titleCase(m.Parameters[0].ParameterName)
|
||||||
} else {
|
} else {
|
||||||
// Try the type instead
|
// 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 {
|
if _, ok := existing[proposedName]; !ok {
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user