miqt/qt/network/gen_qsslerror.cpp

73 lines
1.7 KiB
C++
Raw Normal View History

2024-11-04 22:53:04 +13:00
#include <QSslCertificate>
#include <QSslError>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qsslerror.h>
#include "gen_qsslerror.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
} /* extern C */
#endif
2024-11-04 22:53:04 +13:00
2024-12-07 17:15:57 +13:00
QSslError* QSslError_new() {
return new QSslError();
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QSslError* QSslError_new2(int error) {
return new QSslError(static_cast<QSslError::SslError>(error));
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QSslError* QSslError_new3(int error, QSslCertificate* certificate) {
return new QSslError(static_cast<QSslError::SslError>(error), *certificate);
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QSslError* QSslError_new4(QSslError* other) {
return new QSslError(*other);
2024-11-04 22:53:04 +13:00
}
2025-02-01 13:45:16 +13:00
void QSslError_swap(QSslError* self, QSslError* other) {
2024-11-04 22:53:04 +13:00
self->swap(*other);
}
2025-02-01 13:45:16 +13:00
void QSslError_operatorAssign(QSslError* self, QSslError* other) {
2024-11-04 22:53:04 +13:00
self->operator=(*other);
}
2025-02-01 13:45:16 +13:00
bool QSslError_operatorEqual(const QSslError* self, QSslError* other) {
return (*self == *other);
2024-11-04 22:53:04 +13:00
}
2025-02-01 13:45:16 +13:00
bool QSslError_operatorNotEqual(const QSslError* self, QSslError* other) {
return (*self != *other);
2024-11-04 22:53:04 +13:00
}
2025-02-01 13:45:16 +13:00
int QSslError_error(const QSslError* self) {
2024-11-04 22:53:04 +13:00
QSslError::SslError _ret = self->error();
return static_cast<int>(_ret);
}
2025-02-01 13:45:16 +13:00
struct miqt_string QSslError_errorString(const QSslError* self) {
2024-11-04 22:53:04 +13:00
QString _ret = self->errorString();
// 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;
}
2025-02-01 13:45:16 +13:00
QSslCertificate* QSslError_certificate(const QSslError* self) {
2024-11-04 22:53:04 +13:00
return new QSslCertificate(self->certificate());
}
2025-02-01 13:45:16 +13:00
void QSslError_delete(QSslError* self) {
delete self;
2024-11-04 22:53:04 +13:00
}