genbindings: many more exceptions

This commit is contained in:
mappu 2024-08-18 19:02:43 +12:00
parent f8a1ae98e6
commit d6ea4ccf80
2 changed files with 25 additions and 2 deletions

View File

@ -282,6 +282,17 @@ nextMethod:
return CppClass{}, err
}
for _, p := range mm.Parameters {
if strings.HasSuffix(p.ParameterType, "Private") {
log.Printf("Skipping method %q taking Private type", mm.MethodName)
continue nextMethod
}
}
if strings.HasSuffix(mm.ReturnType.ParameterType, "Private") {
log.Printf("Skipping method %q returning Private type", mm.MethodName)
continue nextMethod
}
mm.IsSignal = isSignal && !mm.IsStatic && mm.MethodName != `metaObject`
if mm.IsReceiverMethod() {
@ -466,7 +477,7 @@ func parseSingleTypeString(p string) CppParameter {
insert.ParameterType += " uintptr_t"
} else if tok == "QStringList" {
insert.ParameterType += " QList<QString>"
} else if len(tok) > 4 && strings.HasSuffix(tok, "List") {
} else if len(tok) > 4 && strings.HasSuffix(tok, "List") && tok != "QTextList" {
// Typedef e.g. QObjectList
// QObjectList is a pointer, but QStringList is a whole custom class
insert.ParameterType += " QList<" + tok[0:len(tok)-4] + " *>"

View File

@ -6,7 +6,11 @@ import (
func AllowDelete(c CppClass) bool {
switch c.ClassName {
case "QClipboard":
case "QClipboard",
"QSessionManager",
"QTextObject",
"QTextBlockGroup",
"QInputMethod":
return false // The destructor is marked private. TODO grab this from the AST
}
return true
@ -52,15 +56,23 @@ func CheckComplexity(p CppParameter) error {
case
"QList<QVariant>", // e.g. QVariant constructor - this has a deleted copy-constructor so we can't get it over the CABI boundary by value
"QPolygon", "QPolygonF", // QPolygon extends a template type
"QGenericMatrix", "QMatrix3x3", // extends a template type
"QLatin1String", "QStringView", // e.g. QColor constructors and QColor::SetNamedColor() overloads. These are usually optional alternatives to QString
"QStringRef", // e.g. QLocale::toLongLong and similar overloads. As above
"QGradientStop", "QGradientStops", // QPair<>-related types, but we can't see through the typedef to block based on QPair alone
"void **", // e.g. qobjectdefs.h QMetaObject->Activate()
"QGraphicsItem **", // e.g. QGraphicsItem::IsBlockedByModalPanel() overload
"char *&", // e.g. QDataStream.operator<<()
"qfloat16", // e.g. QDataStream - there is no such half-float type in C or Go
"char16_t", // e.g. QChar() constructor overload, just unnecessary
"picture_io_handler", // e.g. QPictureIO::DefineIOHandler callback function
"QPlatformNativeInterface", // e.g. QGuiApplication::platformNativeInterface(). Private type, could probably expose as uintptr. n.b. Changes in Qt6
"QFunctionPointer", // e.g. QGuiApplication_PlatformFunction
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
"QAbstractUndoItem", // e.g. Defined in qtextdocument.h
"QPlatformPixmap", // e.g. qpixmap.h. as below
"QPlatformScreen", // e.g. qscreen.h. as below
"QPlatformSurface", // e.g. qsurface.h. as below
"QPlatformMenu": // e.g. QMenu_PlatformMenu. Defined in the QPA, could probably expose as uintptr
return ErrTooComplex
}