genbindings: move transformblacklist into exceptions.go

This commit is contained in:
mappu 2024-08-19 19:12:13 +12:00
parent 043db615b1
commit bdbeb3d1e5
4 changed files with 23 additions and 19 deletions

View File

@ -51,8 +51,8 @@ func parseHeader(topLevel []interface{}) (*CppParsedHeader, error) {
}
}
// Also skip over any QFooPrivate classes
if nodename[0] == 'Q' && strings.HasSuffix(nodename, "Private") {
// Also skip over any custom exceptions
if !AllowClass(nodename) {
continue
}

View File

@ -38,6 +38,27 @@ func ImportHeaderForClass(className string) bool {
return true
}
func AllowClass(className string) bool {
if className[0] != 'Q' {
return false
}
if strings.HasSuffix(className, "Private") {
return false
}
switch className {
case
"QException", // Extends std::exception, too hard
"QItemSelection", // Extends a QList<>, too hard
"QXmlStreamAttributes", // Extends a QList<>, too hard
"QPolygon", "QPolygonF": // Extends a QVector<QPoint> template class, too hard
return false
}
return true
}
func CheckComplexity(p CppParameter) error {
if p.QMapOf() {

View File

@ -175,7 +175,6 @@ func main() {
}
// AST transforms on our IL
astTransformBlacklist(parsed)
astTransformOptional(parsed)
astTransformOverloads(parsed)

View File

@ -1,16 +0,0 @@
package main
// astTransformBlacklist filters out things we do not want to parse.
func astTransformBlacklist(parsed *CppParsedHeader) {
var keep []CppClass
for _, c := range parsed.Classes {
if c.ClassName[0] != 'Q' {
continue
}
keep = append(keep, c)
}
parsed.Classes = keep
}