mirror of
https://github.com/mappu/miqt.git
synced 2025-04-02 11:50:23 +00:00
qnetwork: add support in genbindings
This commit is contained in:
parent
910babe1d2
commit
e41f991a23
@ -865,6 +865,10 @@ func parseSingleTypeString(p string) CppParameter {
|
|||||||
} else if tok == "const" {
|
} else if tok == "const" {
|
||||||
insert.Const = true
|
insert.Const = true
|
||||||
|
|
||||||
|
} else if tok == "class" {
|
||||||
|
// QNetwork has some references to 'class QSslCertificate'. Flatten
|
||||||
|
continue
|
||||||
|
|
||||||
} else if tok == "&" { // U+0026
|
} else if tok == "&" { // U+0026
|
||||||
insert.ByRef = true
|
insert.ByRef = true
|
||||||
|
|
||||||
|
@ -244,6 +244,14 @@ func AllowType(p CppParameter, isReturnType bool) error {
|
|||||||
if err := AllowType(vType, isReturnType); err != nil {
|
if err := AllowType(vType, isReturnType); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
// Additionally, Go maps do not support []byte keys
|
||||||
|
// This affects qnetwork qsslconfiguration BackendConfiguration
|
||||||
|
if kType.ParameterType == "QByteArray" {
|
||||||
|
return ErrTooComplex
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if p.QMultiMapOf() {
|
||||||
|
return ErrTooComplex // e.g. Qt5 QNetwork qsslcertificate.h has a QMultiMap<QSsl::AlternativeNameEntryType, QString>
|
||||||
}
|
}
|
||||||
|
|
||||||
if !AllowClass(p.ParameterType) {
|
if !AllowClass(p.ParameterType) {
|
||||||
@ -379,6 +387,7 @@ func AllowType(p CppParameter, isReturnType bool) error {
|
|||||||
"char32_t", // e.g. QDebug().operator<< overload, unnecessary
|
"char32_t", // e.g. QDebug().operator<< overload, unnecessary
|
||||||
"wchar_t", // e.g. qstringview.h overloads, unnecessary
|
"wchar_t", // e.g. qstringview.h overloads, unnecessary
|
||||||
"FILE", // e.g. qfile.h constructors
|
"FILE", // e.g. qfile.h constructors
|
||||||
|
"sockaddr", // Qt network Qhostaddress. Should be possible to make this work but may be platform-specific
|
||||||
"qInternalCallback", // e.g. qnamespace.h
|
"qInternalCallback", // e.g. qnamespace.h
|
||||||
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
|
"QGraphicsEffectSource", // e.g. used by qgraphicseffect.h, but the definition is in ????
|
||||||
"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
|
||||||
|
@ -66,6 +66,18 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
|||||||
ClangMatchSameHeaderDefinitionOnly,
|
ClangMatchSameHeaderDefinitionOnly,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
generate(
|
||||||
|
"qt/network",
|
||||||
|
[]string{
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt5/QtNetwork",
|
||||||
|
},
|
||||||
|
AllowAllHeaders,
|
||||||
|
clangBin,
|
||||||
|
pkgConfigCflags("Qt5Network"),
|
||||||
|
outDir,
|
||||||
|
ClangMatchSameHeaderDefinitionOnly,
|
||||||
|
)
|
||||||
|
|
||||||
// Depends on QtCore/Gui/Widgets, QPrintSupport
|
// Depends on QtCore/Gui/Widgets, QPrintSupport
|
||||||
generate(
|
generate(
|
||||||
"qt-restricted-extras/qscintilla",
|
"qt-restricted-extras/qscintilla",
|
||||||
@ -152,4 +164,23 @@ func ProcessLibraries(clangBin, outDir, extraLibsDir string) {
|
|||||||
outDir,
|
outDir,
|
||||||
ClangMatchSameHeaderDefinitionOnly,
|
ClangMatchSameHeaderDefinitionOnly,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Qt 6 QtNetwork
|
||||||
|
generate(
|
||||||
|
"qt6/network",
|
||||||
|
[]string{
|
||||||
|
"/usr/include/x86_64-linux-gnu/qt6/QtNetwork",
|
||||||
|
},
|
||||||
|
func(fullpath string) bool {
|
||||||
|
fname := filepath.Base(fullpath)
|
||||||
|
if fname == "qtnetwork-config.h" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
},
|
||||||
|
clangBin,
|
||||||
|
"--std=c++17 "+pkgConfigCflags("Qt6Network"),
|
||||||
|
outDir,
|
||||||
|
ClangMatchSameHeaderDefinitionOnly,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
@ -232,7 +232,13 @@ func emitCABI2CppForwarding(p CppParameter, indent string) (preamble string, for
|
|||||||
preamble += indent + "\t" + nameprefix + "_QList.push_back(" + addFwd + ");\n"
|
preamble += indent + "\t" + nameprefix + "_QList.push_back(" + addFwd + ");\n"
|
||||||
|
|
||||||
preamble += indent + "}\n"
|
preamble += indent + "}\n"
|
||||||
return preamble, nameprefix + "_QList"
|
|
||||||
|
// Support passing QList<>* (very rare, but used in qnetwork)
|
||||||
|
if p.Pointer {
|
||||||
|
return preamble, "&" + nameprefix + "_QList"
|
||||||
|
} else {
|
||||||
|
return preamble, nameprefix + "_QList"
|
||||||
|
}
|
||||||
|
|
||||||
} else if kType, vType, ok := p.QMapOf(); ok {
|
} else if kType, vType, ok := p.QMapOf(); ok {
|
||||||
preamble += indent + p.GetQtCppType().ParameterType + " " + nameprefix + "_QMap;\n"
|
preamble += indent + p.GetQtCppType().ParameterType + " " + nameprefix + "_QMap;\n"
|
||||||
|
@ -191,6 +191,15 @@ func (p CppParameter) QSetOf() (CppParameter, bool) {
|
|||||||
return CppParameter{}, false
|
return CppParameter{}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p CppParameter) QMultiMapOf() bool {
|
||||||
|
if strings.HasPrefix(p.ParameterType, `QMultiMap<`) ||
|
||||||
|
strings.HasPrefix(p.ParameterType, `QMultiHash<`) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (p CppParameter) IntType() bool {
|
func (p CppParameter) IntType() bool {
|
||||||
|
|
||||||
if p.IsKnownEnum() {
|
if p.IsKnownEnum() {
|
||||||
|
@ -32,7 +32,7 @@ func astTransformOptional(parsed *CppParsedHeader) {
|
|||||||
|
|
||||||
// Add method copies
|
// Add method copies
|
||||||
for x := optionalStart; x < len(m.Parameters); x++ {
|
for x := optionalStart; x < len(m.Parameters); x++ {
|
||||||
dupMethod := m // copy
|
dupMethod := m // shallow copy
|
||||||
dupMethod.Rename(m.MethodName + fmt.Sprintf("%d", x+1))
|
dupMethod.Rename(m.MethodName + fmt.Sprintf("%d", x+1))
|
||||||
dupMethod.Parameters = m.Parameters[0 : x+1]
|
dupMethod.Parameters = m.Parameters[0 : x+1]
|
||||||
dupMethod.HiddenParams = m.Parameters[x+1:]
|
dupMethod.HiddenParams = m.Parameters[x+1:]
|
||||||
@ -68,7 +68,7 @@ func astTransformOptional(parsed *CppParsedHeader) {
|
|||||||
|
|
||||||
// Add ctor copies
|
// Add ctor copies
|
||||||
for x := optionalStart; x < len(m.Parameters); x++ {
|
for x := optionalStart; x < len(m.Parameters); x++ {
|
||||||
dupCtor := m // copy
|
dupCtor := m // shallow copy
|
||||||
dupCtor.Parameters = m.Parameters[0 : x+1]
|
dupCtor.Parameters = m.Parameters[0 : x+1]
|
||||||
dupCtor.HiddenParams = m.Parameters[x+1:]
|
dupCtor.HiddenParams = m.Parameters[x+1:]
|
||||||
c.Ctors = append(c.Ctors, dupCtor)
|
c.Ctors = append(c.Ctors, dupCtor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user