2024-08-25 04:08:24 +00:00
|
|
|
#include <QChar>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QList>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QUrl>
|
|
|
|
#include <QUrlQuery>
|
2024-10-16 05:07:56 +00:00
|
|
|
#include <qurlquery.h>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qurlquery.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QUrlQuery* QUrlQuery_new() {
|
|
|
|
return new QUrlQuery();
|
|
|
|
}
|
|
|
|
|
|
|
|
QUrlQuery* QUrlQuery_new2(QUrl* url) {
|
|
|
|
return new QUrlQuery(*url);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
QUrlQuery* QUrlQuery_new3(struct miqt_string queryString) {
|
|
|
|
QString queryString_QString = QString::fromUtf8(queryString.data, queryString.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QUrlQuery(queryString_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QUrlQuery* QUrlQuery_new4(QUrlQuery* other) {
|
|
|
|
return new QUrlQuery(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QUrlQuery_OperatorAssign(QUrlQuery* self, QUrlQuery* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QUrlQuery_OperatorEqual(const QUrlQuery* self, QUrlQuery* other) {
|
|
|
|
return self->operator==(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QUrlQuery_OperatorNotEqual(const QUrlQuery* self, QUrlQuery* other) {
|
|
|
|
return self->operator!=(*other);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QUrlQuery_Swap(QUrlQuery* self, QUrlQuery* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QUrlQuery_IsEmpty(const QUrlQuery* self) {
|
|
|
|
return self->isEmpty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QUrlQuery_IsDetached(const QUrlQuery* self) {
|
|
|
|
return self->isDetached();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QUrlQuery_Clear(QUrlQuery* self) {
|
|
|
|
self->clear();
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_Query(const QUrlQuery* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->query();
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QUrlQuery_SetQuery(QUrlQuery* self, struct miqt_string queryString) {
|
|
|
|
QString queryString_QString = QString::fromUtf8(queryString.data, queryString.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setQuery(queryString_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_ToString(const QUrlQuery* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toString();
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QUrlQuery_SetQueryDelimiters(QUrlQuery* self, QChar* valueDelimiter, QChar* pairDelimiter) {
|
|
|
|
self->setQueryDelimiters(*valueDelimiter, *pairDelimiter);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QUrlQuery_QueryValueDelimiter(const QUrlQuery* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QChar(self->queryValueDelimiter());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QChar* QUrlQuery_QueryPairDelimiter(const QUrlQuery* self) {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QChar(self->queryPairDelimiter());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
bool QUrlQuery_HasQueryItem(const QUrlQuery* self, struct miqt_string key) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->hasQueryItem(key_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QUrlQuery_AddQueryItem(QUrlQuery* self, struct miqt_string key, struct miqt_string value) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
|
|
|
QString value_QString = QString::fromUtf8(value.data, value.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->addQueryItem(key_QString, value_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QUrlQuery_RemoveQueryItem(QUrlQuery* self, struct miqt_string key) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->removeQueryItem(key_QString);
|
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_QueryItemValue(const QUrlQuery* self, struct miqt_string key) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->queryItemValue(key_QString);
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_array* QUrlQuery_AllQueryItemValues(const QUrlQuery* self, struct miqt_string key) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->allQueryItemValues(key_QString);
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
void QUrlQuery_RemoveAllQueryItems(QUrlQuery* self, struct miqt_string key) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->removeAllQueryItems(key_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QUrlQuery_DefaultQueryValueDelimiter() {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QChar(QUrlQuery::defaultQueryValueDelimiter());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QChar* QUrlQuery_DefaultQueryPairDelimiter() {
|
2024-09-17 06:29:11 +00:00
|
|
|
return new QChar(QUrlQuery::defaultQueryPairDelimiter());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_Query1(const QUrlQuery* self, int encoding) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->query(static_cast<QUrl::ComponentFormattingOptions>(encoding));
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_ToString1(const QUrlQuery* self, int encoding) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->toString(static_cast<QUrl::ComponentFormattingOptions>(encoding));
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string QUrlQuery_QueryItemValue2(const QUrlQuery* self, struct miqt_string key, int encoding) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-09-14 22:29:05 +00:00
|
|
|
QString _ret = self->queryItemValue(key_QString, static_cast<QUrl::ComponentFormattingOptions>(encoding));
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _b = _ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
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-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_array* QUrlQuery_AllQueryItemValues2(const QUrlQuery* self, struct miqt_string key, int encoding) {
|
|
|
|
QString key_QString = QString::fromUtf8(key.data, key.len);
|
2024-09-14 22:29:05 +00:00
|
|
|
QStringList _ret = self->allQueryItemValues(key_QString, static_cast<QUrl::ComponentFormattingOptions>(encoding));
|
2024-09-17 06:29:11 +00:00
|
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
|
2024-09-14 22:29:05 +00:00
|
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
|
|
QString _lv_ret = _ret[i];
|
2024-08-29 07:01:51 +00:00
|
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
2024-09-14 22:29:05 +00:00
|
|
|
QByteArray _lv_b = _lv_ret.toUtf8();
|
2024-10-18 23:53:33 +00:00
|
|
|
struct miqt_string _lv_ms;
|
|
|
|
_lv_ms.len = _lv_b.length();
|
|
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
|
|
memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len);
|
|
|
|
_arr[i] = _lv_ms;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_array* _out = static_cast<struct miqt_array*>(malloc(sizeof(struct miqt_array)));
|
|
|
|
_out->len = _ret.length();
|
|
|
|
_out->data = static_cast<void*>(_arr);
|
|
|
|
return _out;
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QUrlQuery_Delete(QUrlQuery* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|