genbindings: more exceptions

This commit is contained in:
mappu 2024-08-29 19:01:21 +12:00
parent d8c7e9e770
commit 1e539748e6
2 changed files with 15 additions and 2 deletions

View File

@ -108,6 +108,9 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
if strings.HasPrefix(p.ParameterType, "QGenericMatrix<") { if strings.HasPrefix(p.ParameterType, "QGenericMatrix<") {
return ErrTooComplex // e.g. qmatrix4x4.h return ErrTooComplex // e.g. qmatrix4x4.h
} }
if strings.HasPrefix(p.ParameterType, "QUrlTwoFlags<") {
return ErrTooComplex // e.g. qurl.h
}
if strings.HasPrefix(p.ParameterType, "std::") { if strings.HasPrefix(p.ParameterType, "std::") {
// std::initializer e.g. qcborarray.h // std::initializer e.g. qcborarray.h
// std::string QByteArray->toStdString(). There are QString overloads already // std::string QByteArray->toStdString(). There are QString overloads already
@ -147,8 +150,16 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
return ErrTooComplex // e.g. qformlayout. The cast doesn't survive through a pointer parameter return ErrTooComplex // e.g. qformlayout. The cast doesn't survive through a pointer parameter
} }
if p.ParameterType != "char" && p.Pointer && p.PointerCount >= 2 { // Out-parameters if p.Pointer && p.PointerCount >= 2 { // Out-parameters
return ErrTooComplex // e.g. QGraphicsItem_IsBlockedByModalPanel1 if p.ParameterType != "char" {
return ErrTooComplex // e.g. QGraphicsItem_IsBlockedByModalPanel1
}
if p.ParameterType == "char" && p.ParameterName == "xpm" {
// Array parameters:
// - QPixmap and QImage ctors from an xpm char*[]
// TODO support these
return ErrTooComplex
}
} }
switch p.ParameterType { switch p.ParameterType {
@ -177,6 +188,7 @@ func CheckComplexity(p CppParameter, isReturnType bool) error {
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ???? "QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
"QAbstractUndoItem", // e.g. Defined in qtextdocument.h "QAbstractUndoItem", // e.g. Defined in qtextdocument.h
"QTextObjectInterface", // e.g. qabstracttextdocumentlayout.h "QTextObjectInterface", // e.g. qabstracttextdocumentlayout.h
"QUrl::FormattingOptions", // e.g. QUrl.h. Typedef for a complex template type
"QXmlStreamEntityDeclarations", // e.g. qxmlstream.h. The class definition was blacklisted for ???? reason so don't allow it as a parameter either "QXmlStreamEntityDeclarations", // e.g. qxmlstream.h. The class definition was blacklisted for ???? reason so don't allow it as a parameter either
"QXmlStreamNamespaceDeclarations", // e.g. qxmlstream.h. As above "QXmlStreamNamespaceDeclarations", // e.g. qxmlstream.h. As above
"QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above "QXmlStreamNotationDeclarations", // e.g. qxmlstream.h. As above

View File

@ -78,6 +78,7 @@ func (p CppParameter) IsFlagType() bool {
switch p.ParameterType { switch p.ParameterType {
case "QTouchEvent::TouchPoint::InfoFlags", case "QTouchEvent::TouchPoint::InfoFlags",
"QFile::Permissions", "QFile::Permissions",
"QWizard::WizardButton",
"QFormLayout::ItemRole", "QFormLayout::ItemRole",
"QFormLayout::RowWrapPolicy": "QFormLayout::RowWrapPolicy":
return true return true