mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 08:58:37 +00:00
genbindings/typedefs: centralize exceptions
This commit is contained in:
parent
841605a279
commit
286cfa90c9
@ -5,6 +5,30 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
func InsertTypedefs() {
|
||||
|
||||
// Seed well-known typedefs
|
||||
|
||||
// QString is deleted from this binding
|
||||
KnownTypedefs["QStringList"] = CppTypedef{"QStringList", parseSingleTypeString("QList<QString>")}
|
||||
|
||||
// FIXME this isn't picked up automatically because QFile inherits QFileDevice and the name refers to its parent class
|
||||
KnownTypedefs["QFile::FileTime"] = CppTypedef{"QFile::FileTime", parseSingleTypeString("QFileDevice::FileTime")}
|
||||
|
||||
// n.b. Qt 5 only
|
||||
KnownTypedefs["QLineF::IntersectionType"] = CppTypedef{"QLineF::IntersectionType", parseSingleTypeString("QLineF::IntersectType")}
|
||||
|
||||
// Not sure the reason for this one
|
||||
KnownTypedefs["QSocketDescriptor::DescriptorType"] = CppTypedef{"QSocketDescriptor::DescriptorType", parseSingleTypeString("QSocketNotifier::Type")}
|
||||
|
||||
// QFlags<> typedef
|
||||
KnownTypedefs["QTouchEvent::TouchPoint::InfoFlags"] = CppTypedef{"QTouchEvent::TouchPoint::InfoFlags", parseSingleTypeString("QFlags<QTouchEvent::TouchPoint::InfoFlag>")}
|
||||
|
||||
// QFile doesn't see QFileDevice parent class enum
|
||||
KnownTypedefs["QFile::Permissions"] = CppTypedef{"QFile::Permissions", parseSingleTypeString("QFileDevice::Permissions")}
|
||||
KnownTypedefs["QFileDevice::Permissions"] = CppTypedef{"QFile::Permissions", parseSingleTypeString("QFlags<QFileDevice::Permission>")}
|
||||
}
|
||||
|
||||
func AllowHeader(fullpath string) bool {
|
||||
fname := filepath.Base(fullpath)
|
||||
|
||||
|
@ -15,25 +15,6 @@ func init() {
|
||||
KnownClassnames = make(map[string]struct{})
|
||||
KnownTypedefs = make(map[string]CppTypedef)
|
||||
KnownEnums = make(map[string]CppEnum)
|
||||
|
||||
// Seed well-known typedefs
|
||||
|
||||
KnownTypedefs["QRgb"] = CppTypedef{"QRgb", parseSingleTypeString("unsigned int")}
|
||||
|
||||
KnownTypedefs["WId"] = CppTypedef{"WId", parseSingleTypeString("uintptr_t")}
|
||||
|
||||
// QString is deleted from this binding
|
||||
KnownTypedefs["QStringList"] = CppTypedef{"QStringList", parseSingleTypeString("QList<QString>")}
|
||||
|
||||
// Not sure why this isn't picked up automatically
|
||||
// FIXME because QFile inherits QFileDevice(!!) and the name refers to its parent class
|
||||
KnownTypedefs["QFile::FileTime"] = CppTypedef{"QFile::FileTime", parseSingleTypeString("QFileDevice::FileTime")}
|
||||
|
||||
// n.b. Qt 5 only
|
||||
KnownTypedefs["QLineF::IntersectionType"] = CppTypedef{"QLineF::IntersectionType", parseSingleTypeString("QLineF::IntersectType")}
|
||||
|
||||
// Not sure the reason for this one
|
||||
KnownTypedefs["QSocketDescriptor::DescriptorType"] = CppTypedef{"QSocketDescriptor::DescriptorType", parseSingleTypeString("QSocketNotifier::Type")}
|
||||
}
|
||||
|
||||
type CppParameter struct {
|
||||
|
@ -88,6 +88,8 @@ func main() {
|
||||
preserve: make(map[string]*CppEnum),
|
||||
}
|
||||
|
||||
InsertTypedefs()
|
||||
|
||||
for _, inputHeader := range includeFiles {
|
||||
|
||||
// If we have a cached clang AST, use that instead
|
||||
|
@ -52,6 +52,9 @@ func TestTransformTypedefs(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
InsertTypedefs()
|
||||
KnownTypedefs["WId"] = CppTypedef{"WId", parseSingleTypeString("uintptr_t")}
|
||||
|
||||
runTest("WId", "uintptr_t")
|
||||
runTest("QList<WId>", "QList<uintptr_t>")
|
||||
runTest("QStringList", "QList<QString>")
|
||||
|
Loading…
Reference in New Issue
Block a user