miqt/qt/gen_qurlquery.cpp

193 lines
7.0 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>
2024-08-29 07:01:51 +00:00
#include "qurlquery.h"
#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();
return miqt_strdup(_b.data(), _b.length());
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();
return miqt_strdup(_b.data(), _b.length());
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) {
QChar _ret = self->queryValueDelimiter();
// Copy-construct value returned type into heap-allocated copy
return static_cast<QChar*>(new QChar(_ret));
}
QChar* QUrlQuery_QueryPairDelimiter(const QUrlQuery* self) {
QChar _ret = self->queryPairDelimiter();
// Copy-construct value returned type into heap-allocated copy
return static_cast<QChar*>(new QChar(_ret));
}
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();
return miqt_strdup(_b.data(), _b.length());
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);
2024-08-29 07:01:51 +00:00
// Convert QStringList 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();
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
2024-08-29 07:01:51 +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
}
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() {
QChar _ret = QUrlQuery::defaultQueryValueDelimiter();
// Copy-construct value returned type into heap-allocated copy
return static_cast<QChar*>(new QChar(_ret));
}
QChar* QUrlQuery_DefaultQueryPairDelimiter() {
QChar _ret = QUrlQuery::defaultQueryPairDelimiter();
// Copy-construct value returned type into heap-allocated copy
return static_cast<QChar*>(new QChar(_ret));
}
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();
return miqt_strdup(_b.data(), _b.length());
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();
return miqt_strdup(_b.data(), _b.length());
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();
return miqt_strdup(_b.data(), _b.length());
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));
2024-08-29 07:01:51 +00:00
// Convert QStringList 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();
_arr[i] = miqt_strdup(_lv_b.data(), _lv_b.length());
2024-08-29 07:01:51 +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
}
void QUrlQuery_Delete(QUrlQuery* self) {
delete self;
}