genbindings: more exceptions

This commit is contained in:
mappu 2024-08-20 20:19:15 +12:00
parent 7e78b73517
commit 306abe1fb6
2 changed files with 21 additions and 7 deletions

View File

@ -266,6 +266,11 @@ nextMethod:
}
}
if ret.ClassName == "QDebug" && len(mm.Parameters) == 1 && mm.Parameters[0].ParameterType == "QString" && mm.Parameters[0].Pointer {
log.Printf("Skipping ctor taking QString pointer")
continue nextMethod
}
ret.Ctors = append(ret.Ctors, mm)
case "CXXDestructorDecl":
@ -338,6 +343,12 @@ nextMethod:
continue nextMethod
}
if ret.ClassName == "QFile" && mm.MethodName == "moveToTrash" && len(mm.Parameters) == 2 && mm.Parameters[1].ParameterType == "QString" && mm.Parameters[1].Pointer {
// @ref https://doc.qt.io/qt-6/qfile.html#moveToTrash-1
log.Printf("Skipping method %q using complex return type by pointer argument", mm.MethodName) // TODO support this
continue nextMethod
}
ret.Methods = append(ret.Methods, mm)
default:
@ -566,18 +577,15 @@ func parseSingleTypeString(p string) CppParameter {
insert.TypeAlias = tok
insert.ParameterType += " uintptr_t"
} else if tok == "QStringList" {
insert.ParameterType += " QList<QString>"
} else if len(tok) > 4 && strings.HasSuffix(tok, "List") {
// Classes ending in --List are usually better represented as a QList
// type directly, so that the binding uses proper Go slices
// Typedef e.g. QObjectList
insert.TypeAlias = tok
switch tok {
case "QModelIndexList":
case "QStringList", "QModelIndexList", "QVariantList", "QFileInfoList":
// These types are defined as a QList of values
insert.ParameterType += " QList<QModelIndex>"
insert.ParameterType += " QList<" + tok[0:len(tok)-4] + ">"
case "QTextList":
// This is really a custom class, preserve as-is
insert.ParameterType += " " + tok

View File

@ -18,8 +18,7 @@ func AllowHeader(fullpath string) bool {
}
switch fname {
case // QtCore
"qatomic_bootstrap.h",
case "qatomic_bootstrap.h",
"qatomic_cxx11.h",
"qatomic_msvc.h",
"qgenericatomic.h", // Clang error
@ -129,6 +128,13 @@ func CheckComplexity(p CppParameter) error {
"QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above
"QVariantMap", // e.g. qcbormap.h
"QVariantHash", // e.g. qcbormap.h
"QCborTag", // e.g. qcborstreamreader.h.TODO Needs support for enums
"QCborSimpleType", // e.g. qcborstreamreader.h TODO Needs support for enums
"QCborKnownTags", // e.g. qcborstreamreader.h TODO Needs support for enums
"QCborNegativeInteger", // e.g. qcborstreamreader.h TODO Needs support for enums
"QtMsgType", // e.g. qdebug.h TODO Needs support for enums
"QTextStreamFunction", // e.g. qdebug.h
"QFactoryInterface", // qfactoryinterface.h
"QPlatformPixmap", // e.g. qpixmap.h. as below
"QPlatformScreen", // e.g. qscreen.h. as below
"QPlatformSurface", // e.g. qsurface.h. as below