miqt/qt/network/gen_qsslellipticcurve.cpp
Jacek Sieka a0c6344ecd Avoid dependency on exported go header
The expected type of the callback is already known from the AST - this
change reduces dependency on cgo specifics and makes the generated C ABI
entirely cgo-independent - in particular, there is no need to include
`_cgo_export.h` any more.
2025-01-07 12:55:40 +01:00

72 lines
2.0 KiB
C++

#include <QSslEllipticCurve>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qsslellipticcurve.h>
#include "gen_qsslellipticcurve.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* extern C */
#endif
QSslEllipticCurve* QSslEllipticCurve_new() {
return new QSslEllipticCurve();
}
QSslEllipticCurve* QSslEllipticCurve_new2(QSslEllipticCurve* param1) {
return new QSslEllipticCurve(*param1);
}
QSslEllipticCurve* QSslEllipticCurve_FromShortName(struct miqt_string name) {
QString name_QString = QString::fromUtf8(name.data, name.len);
return new QSslEllipticCurve(QSslEllipticCurve::fromShortName(name_QString));
}
QSslEllipticCurve* QSslEllipticCurve_FromLongName(struct miqt_string name) {
QString name_QString = QString::fromUtf8(name.data, name.len);
return new QSslEllipticCurve(QSslEllipticCurve::fromLongName(name_QString));
}
struct miqt_string QSslEllipticCurve_ShortName(const QSslEllipticCurve* self) {
QString _ret = self->shortName();
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
struct miqt_string _ms;
_ms.len = _b.length();
_ms.data = static_cast<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
struct miqt_string QSslEllipticCurve_LongName(const QSslEllipticCurve* self) {
QString _ret = self->longName();
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
QByteArray _b = _ret.toUtf8();
struct miqt_string _ms;
_ms.len = _b.length();
_ms.data = static_cast<char*>(malloc(_ms.len));
memcpy(_ms.data, _b.data(), _ms.len);
return _ms;
}
bool QSslEllipticCurve_IsValid(const QSslEllipticCurve* self) {
return self->isValid();
}
bool QSslEllipticCurve_IsTlsNamedCurve(const QSslEllipticCurve* self) {
return self->isTlsNamedCurve();
}
void QSslEllipticCurve_Delete(QSslEllipticCurve* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QSslEllipticCurve*>( self );
} else {
delete self;
}
}