#include #include #include #include #include #include #include #include #include #include #include #include "gen_qstringlistmodel.h" #include "_cgo_export.h" QStringListModel* QStringListModel_new() { return new QStringListModel(); } QStringListModel* QStringListModel_new2(struct miqt_array /* of struct miqt_string */ strings) { QStringList strings_QList; strings_QList.reserve(strings.len); struct miqt_string* strings_arr = static_cast(strings.data); for(size_t i = 0; i < strings.len; ++i) { QString strings_arr_i_QString = QString::fromUtf8(strings_arr[i].data, strings_arr[i].len); strings_QList.push_back(strings_arr_i_QString); } return new QStringListModel(strings_QList); } QStringListModel* QStringListModel_new3(QObject* parent) { return new QStringListModel(parent); } QStringListModel* QStringListModel_new4(struct miqt_array /* of struct miqt_string */ strings, QObject* parent) { QStringList strings_QList; strings_QList.reserve(strings.len); struct miqt_string* strings_arr = static_cast(strings.data); for(size_t i = 0; i < strings.len; ++i) { QString strings_arr_i_QString = QString::fromUtf8(strings_arr[i].data, strings_arr[i].len); strings_QList.push_back(strings_arr_i_QString); } return new QStringListModel(strings_QList, parent); } QMetaObject* QStringListModel_MetaObject(const QStringListModel* self) { return (QMetaObject*) self->metaObject(); } void* QStringListModel_Metacast(QStringListModel* self, const char* param1) { return self->qt_metacast(param1); } struct miqt_string QStringListModel_Tr(const char* s) { QString _ret = QStringListModel::tr(s); // 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(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } int QStringListModel_RowCount(const QStringListModel* self) { return self->rowCount(); } QModelIndex* QStringListModel_Sibling(const QStringListModel* self, int row, int column, QModelIndex* idx) { return new QModelIndex(self->sibling(static_cast(row), static_cast(column), *idx)); } QVariant* QStringListModel_Data(const QStringListModel* self, QModelIndex* index) { return new QVariant(self->data(*index)); } bool QStringListModel_SetData(QStringListModel* self, QModelIndex* index, QVariant* value) { return self->setData(*index, *value); } bool QStringListModel_ClearItemData(QStringListModel* self, QModelIndex* index) { return self->clearItemData(*index); } int QStringListModel_Flags(const QStringListModel* self, QModelIndex* index) { Qt::ItemFlags _ret = self->flags(*index); return static_cast(_ret); } bool QStringListModel_InsertRows(QStringListModel* self, int row, int count) { return self->insertRows(static_cast(row), static_cast(count)); } bool QStringListModel_RemoveRows(QStringListModel* self, int row, int count) { return self->removeRows(static_cast(row), static_cast(count)); } bool QStringListModel_MoveRows(QStringListModel* self, QModelIndex* sourceParent, int sourceRow, int count, QModelIndex* destinationParent, int destinationChild) { return self->moveRows(*sourceParent, static_cast(sourceRow), static_cast(count), *destinationParent, static_cast(destinationChild)); } struct miqt_map QStringListModel_ItemData(const QStringListModel* self, QModelIndex* index) { QMap _ret = self->itemData(*index); // Convert QMap<> from C++ memory to manually-managed C memory int* _karr = static_cast(malloc(sizeof(int) * _ret.size())); QVariant** _varr = static_cast(malloc(sizeof(QVariant*) * _ret.size())); int _ctr = 0; for (auto _itr = _ret.keyValueBegin(); _itr != _ret.keyValueEnd(); ++_itr) { _karr[_ctr] = _itr->first; _varr[_ctr] = new QVariant(_itr->second); _ctr++; } struct miqt_map _out; _out.len = _ret.size(); _out.keys = static_cast(_karr); _out.values = static_cast(_varr); return _out; } bool QStringListModel_SetItemData(QStringListModel* self, QModelIndex* index, struct miqt_map roles) { QMap roles_QMap; int* roles_karr = static_cast(roles.keys); QVariant** roles_varr = static_cast(roles.values); for(size_t i = 0; i < roles.len; ++i) { roles_QMap[static_cast(roles_karr[i])] = *(roles_varr[i]); } return self->setItemData(*index, roles_QMap); } void QStringListModel_Sort(QStringListModel* self, int column) { self->sort(static_cast(column)); } struct miqt_array QStringListModel_StringList(const QStringListModel* self) { QStringList _ret = self->stringList(); // Convert QList<> from C++ memory to manually-managed C memory struct miqt_string* _arr = static_cast(malloc(sizeof(struct miqt_string) * _ret.length())); for (size_t i = 0, e = _ret.length(); i < e; ++i) { QString _lv_ret = _ret[i]; // 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(malloc(_lv_ms.len)); memcpy(_lv_ms.data, _lv_b.data(), _lv_ms.len); _arr[i] = _lv_ms; } struct miqt_array _out; _out.len = _ret.length(); _out.data = static_cast(_arr); return _out; } void QStringListModel_SetStringList(QStringListModel* self, struct miqt_array /* of struct miqt_string */ strings) { QStringList strings_QList; strings_QList.reserve(strings.len); struct miqt_string* strings_arr = static_cast(strings.data); for(size_t i = 0; i < strings.len; ++i) { QString strings_arr_i_QString = QString::fromUtf8(strings_arr[i].data, strings_arr[i].len); strings_QList.push_back(strings_arr_i_QString); } self->setStringList(strings_QList); } int QStringListModel_SupportedDropActions(const QStringListModel* self) { Qt::DropActions _ret = self->supportedDropActions(); return static_cast(_ret); } struct miqt_string QStringListModel_Tr2(const char* s, const char* c) { QString _ret = QStringListModel::tr(s, c); // 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(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } struct miqt_string QStringListModel_Tr3(const char* s, const char* c, int n) { QString _ret = QStringListModel::tr(s, c, static_cast(n)); // 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(malloc(_ms.len)); memcpy(_ms.data, _b.data(), _ms.len); return _ms; } int QStringListModel_RowCount1(const QStringListModel* self, QModelIndex* parent) { return self->rowCount(*parent); } QVariant* QStringListModel_Data2(const QStringListModel* self, QModelIndex* index, int role) { return new QVariant(self->data(*index, static_cast(role))); } bool QStringListModel_SetData3(QStringListModel* self, QModelIndex* index, QVariant* value, int role) { return self->setData(*index, *value, static_cast(role)); } bool QStringListModel_InsertRows3(QStringListModel* self, int row, int count, QModelIndex* parent) { return self->insertRows(static_cast(row), static_cast(count), *parent); } bool QStringListModel_RemoveRows3(QStringListModel* self, int row, int count, QModelIndex* parent) { return self->removeRows(static_cast(row), static_cast(count), *parent); } void QStringListModel_Sort2(QStringListModel* self, int column, int order) { self->sort(static_cast(column), static_cast(order)); } void QStringListModel_Delete(QStringListModel* self) { delete self; }