miqt/qt/gen_qurlquery.cpp

217 lines
7.2 KiB
C++
Raw Normal View History

#include <QChar>
2024-08-29 07:01:51 +00:00
#include <QList>
#include <QString>
2024-08-29 07:01:51 +00:00
#include <QByteArray>
#include <cstring>
#include <QUrl>
#include <QUrlQuery>
#include <qurlquery.h>
2024-08-29 07:01:51 +00:00
#include "gen_qurlquery.h"
#include "_cgo_export.h"
QUrlQuery* QUrlQuery_new() {
return new QUrlQuery();
}
QUrlQuery* QUrlQuery_new2(QUrl* url) {
return new QUrlQuery(*url);
}
QUrlQuery* QUrlQuery_new3(struct miqt_string queryString) {
QString queryString_QString = QString::fromUtf8(queryString.data, queryString.len);
return new QUrlQuery(queryString_QString);
}
QUrlQuery* QUrlQuery_new4(QUrlQuery* other) {
return new QUrlQuery(*other);
}
void QUrlQuery_OperatorAssign(QUrlQuery* self, QUrlQuery* other) {
self->operator=(*other);
}
bool QUrlQuery_OperatorEqual(const QUrlQuery* self, QUrlQuery* other) {
return self->operator==(*other);
}
bool QUrlQuery_OperatorNotEqual(const QUrlQuery* self, QUrlQuery* other) {
return self->operator!=(*other);
}
void QUrlQuery_Swap(QUrlQuery* self, QUrlQuery* other) {
self->swap(*other);
}
bool QUrlQuery_IsEmpty(const QUrlQuery* self) {
return self->isEmpty();
}
bool QUrlQuery_IsDetached(const QUrlQuery* self) {
return self->isDetached();
}
void QUrlQuery_Clear(QUrlQuery* self) {
self->clear();
}
struct miqt_string QUrlQuery_Query(const QUrlQuery* self) {
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
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-08-29 07:01:51 +00:00
}
void QUrlQuery_SetQuery(QUrlQuery* self, struct miqt_string queryString) {
QString queryString_QString = QString::fromUtf8(queryString.data, queryString.len);
self->setQuery(queryString_QString);
}
struct miqt_string QUrlQuery_ToString(const QUrlQuery* self) {
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
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-08-29 07:01:51 +00:00
}
void QUrlQuery_SetQueryDelimiters(QUrlQuery* self, QChar* valueDelimiter, QChar* pairDelimiter) {
self->setQueryDelimiters(*valueDelimiter, *pairDelimiter);
}
QChar* QUrlQuery_QueryValueDelimiter(const QUrlQuery* self) {
return new QChar(self->queryValueDelimiter());
}
QChar* QUrlQuery_QueryPairDelimiter(const QUrlQuery* self) {
return new QChar(self->queryPairDelimiter());
}
bool QUrlQuery_HasQueryItem(const QUrlQuery* self, struct miqt_string key) {
QString key_QString = QString::fromUtf8(key.data, key.len);
return self->hasQueryItem(key_QString);
}
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);
self->addQueryItem(key_QString, value_QString);
}
void QUrlQuery_RemoveQueryItem(QUrlQuery* self, struct miqt_string key) {
QString key_QString = QString::fromUtf8(key.data, key.len);
self->removeQueryItem(key_QString);
}
struct miqt_string QUrlQuery_QueryItemValue(const QUrlQuery* self, struct miqt_string key) {
QString key_QString = QString::fromUtf8(key.data, key.len);
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
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-08-29 07:01:51 +00:00
}
struct miqt_array QUrlQuery_AllQueryItemValues(const QUrlQuery* self, struct miqt_string key) {
QString key_QString = QString::fromUtf8(key.data, key.len);
QStringList _ret = self->allQueryItemValues(key_QString);
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
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
QByteArray _lv_b = _lv_ret.toUtf8();
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
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
2024-08-29 07:01:51 +00:00
}
void QUrlQuery_RemoveAllQueryItems(QUrlQuery* self, struct miqt_string key) {
QString key_QString = QString::fromUtf8(key.data, key.len);
self->removeAllQueryItems(key_QString);
}
QChar* QUrlQuery_DefaultQueryValueDelimiter() {
return new QChar(QUrlQuery::defaultQueryValueDelimiter());
}
QChar* QUrlQuery_DefaultQueryPairDelimiter() {
return new QChar(QUrlQuery::defaultQueryPairDelimiter());
}
struct miqt_string QUrlQuery_Query1(const QUrlQuery* self, int encoding) {
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
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-08-29 07:01:51 +00:00
}
struct miqt_string QUrlQuery_ToString1(const QUrlQuery* self, int encoding) {
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
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-08-29 07:01:51 +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);
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
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-08-29 07:01:51 +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);
QStringList _ret = self->allQueryItemValues(key_QString, static_cast<QUrl::ComponentFormattingOptions>(encoding));
// Convert QList<> from C++ memory to manually-managed C memory
struct miqt_string* _arr = static_cast<struct miqt_string*>(malloc(sizeof(struct miqt_string) * _ret.length()));
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
QByteArray _lv_b = _lv_ret.toUtf8();
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
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
2024-08-29 07:01:51 +00:00
}
void QUrlQuery_Delete(QUrlQuery* self) {
delete self;
}