genbindings: more exceptions, merge existing exceptions

This commit is contained in:
mappu 2024-08-29 17:38:34 +12:00
parent a4baeabbcb
commit 3b65e1fc6f
2 changed files with 10 additions and 18 deletions

View File

@ -347,24 +347,6 @@ nextMethod:
// an existing class instance
mm.IsStatic = true
// Some QFoo constructors take a QFooPrivate
for _, p := range mm.Parameters {
if strings.Contains(p.ParameterType, "Private") {
log.Printf("Skipping constructor taking Private type")
continue 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
}
if ret.ClassName == "QXmlStreamWriter" && len(mm.Parameters) == 1 && mm.Parameters[0].ParameterType == "QString" && mm.Parameters[0].Pointer {
log.Printf("Skipping ctor taking QString pointer") // qxmlstream.h 4th constructor overload
continue nextMethod
}
ret.Ctors = append(ret.Ctors, mm)
case "CXXDestructorDecl":

View File

@ -126,7 +126,14 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
return ErrTooComplex // e.g. QAbstractItemModel::QPrivateSignal
}
// Some QFoo constructors take a QFooPrivate
if p.ParameterType[0] == 'Q' && strings.HasSuffix(p.ParameterType, "Private") && !isReturnType {
return ErrTooComplex
}
// If any parameters are QString*, skip the method
// QDebug constructor
// QXmlStreamWriter constructor
// QFile::moveToTrash
// QLockFile::getLockInfo
// QTextDecoder::toUnicode
@ -159,6 +166,9 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
"char16_t", // e.g. QChar() constructor overload, just unnecessary
"char32_t", // e.g. QDebug().operator<< overload, unnecessary
"wchar_t", // e.g. qstringview.h overloads, unnecessary
"QStringView::const_pointer", // e.g. qstringview.h data()
"QStringView::const_iterator", // e.g. qstringview.h
"QStringView::value_type", // e.g. qstringview.h
"FILE", // e.g. qfile.h constructors
"qInternalCallback", // e.g. qnamespace.h
"picture_io_handler", // e.g. QPictureIO::DefineIOHandler callback function