miqt/qt/network/gen_qhstspolicy.cpp

96 lines
2.8 KiB
C++
Raw Normal View History

2024-11-04 09:53:04 +00:00
#include <QDateTime>
#include <QHstsPolicy>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qhstspolicy.h>
#include "gen_qhstspolicy.h"
#include "_cgo_export.h"
2024-12-07 04:15:57 +00:00
QHstsPolicy* QHstsPolicy_new() {
return new QHstsPolicy();
2024-11-04 09:53:04 +00:00
}
2024-12-07 04:15:57 +00:00
QHstsPolicy* QHstsPolicy_new2(QDateTime* expiry, int flags, struct miqt_string host) {
2024-11-04 09:53:04 +00:00
QString host_QString = QString::fromUtf8(host.data, host.len);
2024-12-07 04:15:57 +00:00
return new QHstsPolicy(*expiry, static_cast<QHstsPolicy::PolicyFlags>(flags), host_QString);
2024-11-04 09:53:04 +00:00
}
2024-12-07 04:15:57 +00:00
QHstsPolicy* QHstsPolicy_new3(QHstsPolicy* rhs) {
return new QHstsPolicy(*rhs);
2024-11-04 09:53:04 +00:00
}
2024-12-07 04:15:57 +00:00
QHstsPolicy* QHstsPolicy_new4(QDateTime* expiry, int flags, struct miqt_string host, int mode) {
2024-11-04 09:53:04 +00:00
QString host_QString = QString::fromUtf8(host.data, host.len);
2024-12-07 04:15:57 +00:00
return new QHstsPolicy(*expiry, static_cast<QHstsPolicy::PolicyFlags>(flags), host_QString, static_cast<QUrl::ParsingMode>(mode));
2024-11-04 09:53:04 +00:00
}
void QHstsPolicy_OperatorAssign(QHstsPolicy* self, QHstsPolicy* rhs) {
self->operator=(*rhs);
}
void QHstsPolicy_Swap(QHstsPolicy* self, QHstsPolicy* other) {
self->swap(*other);
}
void QHstsPolicy_SetHost(QHstsPolicy* self, struct miqt_string host) {
QString host_QString = QString::fromUtf8(host.data, host.len);
self->setHost(host_QString);
}
struct miqt_string QHstsPolicy_Host(const QHstsPolicy* self) {
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;
}
void QHstsPolicy_SetExpiry(QHstsPolicy* self, QDateTime* expiry) {
self->setExpiry(*expiry);
}
QDateTime* QHstsPolicy_Expiry(const QHstsPolicy* self) {
return new QDateTime(self->expiry());
}
void QHstsPolicy_SetIncludesSubDomains(QHstsPolicy* self, bool include) {
self->setIncludesSubDomains(include);
}
bool QHstsPolicy_IncludesSubDomains(const QHstsPolicy* self) {
return self->includesSubDomains();
}
bool QHstsPolicy_IsExpired(const QHstsPolicy* self) {
return self->isExpired();
}
void QHstsPolicy_SetHost2(QHstsPolicy* self, struct miqt_string host, int mode) {
QString host_QString = QString::fromUtf8(host.data, host.len);
self->setHost(host_QString, static_cast<QUrl::ParsingMode>(mode));
}
struct miqt_string QHstsPolicy_Host1(const QHstsPolicy* self, int options) {
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;
}
2024-11-19 06:29:06 +00:00
void QHstsPolicy_Delete(QHstsPolicy* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QHstsPolicy*>( self );
} else {
delete self;
}
2024-11-04 09:53:04 +00:00
}