miqt/qt6/network/gen_qhstspolicy.cpp

99 lines
2.8 KiB
C++
Raw Normal View History

2024-11-04 22:53:04 +13:00
#include <QDateTime>
#include <QHstsPolicy>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qhstspolicy.h>
#include "gen_qhstspolicy.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
QHstsPolicy* QHstsPolicy_new() {
return new QHstsPolicy();
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QHstsPolicy* QHstsPolicy_new2(QDateTime* expiry, int flags, struct miqt_string host) {
2024-11-04 22:53:04 +13:00
QString host_QString = QString::fromUtf8(host.data, host.len);
2024-12-07 17:15:57 +13:00
return new QHstsPolicy(*expiry, static_cast<QHstsPolicy::PolicyFlags>(flags), host_QString);
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QHstsPolicy* QHstsPolicy_new3(QHstsPolicy* rhs) {
return new QHstsPolicy(*rhs);
2024-11-04 22:53:04 +13:00
}
2024-12-07 17:15:57 +13:00
QHstsPolicy* QHstsPolicy_new4(QDateTime* expiry, int flags, struct miqt_string host, int mode) {
2024-11-04 22:53:04 +13:00
QString host_QString = QString::fromUtf8(host.data, host.len);
2024-12-07 17:15:57 +13:00
return new QHstsPolicy(*expiry, static_cast<QHstsPolicy::PolicyFlags>(flags), host_QString, static_cast<QUrl::ParsingMode>(mode));
2024-11-04 22:53:04 +13:00
}
2025-02-01 13:45:16 +13:00
void QHstsPolicy_operatorAssign(QHstsPolicy* self, QHstsPolicy* rhs) {
2024-11-04 22:53:04 +13:00
self->operator=(*rhs);
}
2025-02-01 13:45:16 +13:00
void QHstsPolicy_swap(QHstsPolicy* self, QHstsPolicy* other) {
2024-11-04 22:53:04 +13:00
self->swap(*other);
}
2025-02-01 13:45:16 +13:00
void QHstsPolicy_setHost(QHstsPolicy* self, struct miqt_string host) {
2024-11-04 22:53:04 +13:00
QString host_QString = QString::fromUtf8(host.data, host.len);
self->setHost(host_QString);
}
2025-02-01 13:45:16 +13:00
struct miqt_string QHstsPolicy_host(const QHstsPolicy* self) {
2024-11-04 22:53:04 +13:00
QString _ret = self->host();
// 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
void QHstsPolicy_setExpiry(QHstsPolicy* self, QDateTime* expiry) {
2024-11-04 22:53:04 +13:00
self->setExpiry(*expiry);
}
2025-02-01 13:45:16 +13:00
QDateTime* QHstsPolicy_expiry(const QHstsPolicy* self) {
2024-11-04 22:53:04 +13:00
return new QDateTime(self->expiry());
}
2025-02-01 13:45:16 +13:00
void QHstsPolicy_setIncludesSubDomains(QHstsPolicy* self, bool include) {
2024-11-04 22:53:04 +13:00
self->setIncludesSubDomains(include);
}
2025-02-01 13:45:16 +13:00
bool QHstsPolicy_includesSubDomains(const QHstsPolicy* self) {
2024-11-04 22:53:04 +13:00
return self->includesSubDomains();
}
2025-02-01 13:45:16 +13:00
bool QHstsPolicy_isExpired(const QHstsPolicy* self) {
2024-11-04 22:53:04 +13:00
return self->isExpired();
}
2025-02-01 13:45:16 +13:00
void QHstsPolicy_setHost2(QHstsPolicy* self, struct miqt_string host, int mode) {
2024-11-04 22:53:04 +13:00
QString host_QString = QString::fromUtf8(host.data, host.len);
self->setHost(host_QString, static_cast<QUrl::ParsingMode>(mode));
}
2025-02-01 13:45:16 +13:00
struct miqt_string QHstsPolicy_host1(const QHstsPolicy* self, unsigned int options) {
2024-11-04 22:53:04 +13:00
QString _ret = self->host(static_cast<QUrl::ComponentFormattingOptions>(options));
// 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
void QHstsPolicy_delete(QHstsPolicy* self) {
delete self;
2024-11-04 22:53:04 +13:00
}