2024-08-25 04:08:24 +00:00
|
|
|
#include <QMetaObject>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSharedMemory>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qsharedmemory.h"
|
|
|
|
#include "gen_qsharedmemory.h"
|
2024-09-14 22:29:05 +00:00
|
|
|
#include "_cgo_export.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
QSharedMemory* QSharedMemory_new() {
|
|
|
|
return new QSharedMemory();
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QSharedMemory* QSharedMemory_new2(struct miqt_string* key) {
|
|
|
|
QString key_QString = QString::fromUtf8(&key->data, key->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QSharedMemory(key_QString);
|
|
|
|
}
|
|
|
|
|
|
|
|
QSharedMemory* QSharedMemory_new3(QObject* parent) {
|
|
|
|
return new QSharedMemory(parent);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
QSharedMemory* QSharedMemory_new4(struct miqt_string* key, QObject* parent) {
|
|
|
|
QString key_QString = QString::fromUtf8(&key->data, key->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
return new QSharedMemory(key_QString, parent);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QMetaObject* QSharedMemory_MetaObject(const QSharedMemory* self) {
|
|
|
|
return (QMetaObject*) self->metaObject();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_Tr(const char* s) {
|
|
|
|
QString _ret = QSharedMemory::tr(s);
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_TrUtf8(const char* s) {
|
|
|
|
QString _ret = QSharedMemory::trUtf8(s);
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QSharedMemory_SetKey(QSharedMemory* self, struct miqt_string* key) {
|
|
|
|
QString key_QString = QString::fromUtf8(&key->data, key->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setKey(key_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_Key(const QSharedMemory* self) {
|
|
|
|
QString _ret = self->key();
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
void QSharedMemory_SetNativeKey(QSharedMemory* self, struct miqt_string* key) {
|
|
|
|
QString key_QString = QString::fromUtf8(&key->data, key->len);
|
2024-08-25 04:08:24 +00:00
|
|
|
self->setNativeKey(key_QString);
|
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_NativeKey(const QSharedMemory* self) {
|
|
|
|
QString _ret = self->nativeKey();
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
bool QSharedMemory_Create(QSharedMemory* self, int size) {
|
|
|
|
return self->create(static_cast<int>(size));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QSharedMemory_Size(const QSharedMemory* self) {
|
|
|
|
return self->size();
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QSharedMemory_Attach(QSharedMemory* self) {
|
|
|
|
return self->attach();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QSharedMemory_IsAttached(const QSharedMemory* self) {
|
|
|
|
return self->isAttached();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool QSharedMemory_Detach(QSharedMemory* self) {
|
|
|
|
return self->detach();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QSharedMemory_Lock(QSharedMemory* self) {
|
|
|
|
return self->lock();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QSharedMemory_Unlock(QSharedMemory* self) {
|
|
|
|
return self->unlock();
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
int QSharedMemory_Error(const QSharedMemory* self) {
|
2024-09-14 22:29:05 +00:00
|
|
|
QSharedMemory::SharedMemoryError _ret = self->error();
|
2024-09-18 00:12:02 +00:00
|
|
|
return static_cast<int>(_ret);
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_ErrorString(const QSharedMemory* self) {
|
|
|
|
QString _ret = self->errorString();
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_Tr2(const char* s, const char* c) {
|
|
|
|
QString _ret = QSharedMemory::tr(s, c);
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_Tr3(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QSharedMemory::tr(s, c, static_cast<int>(n));
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_TrUtf82(const char* s, const char* c) {
|
|
|
|
QString _ret = QSharedMemory::trUtf8(s, c);
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
struct miqt_string* QSharedMemory_TrUtf83(const char* s, const char* c, int n) {
|
|
|
|
QString _ret = QSharedMemory::trUtf8(s, c, static_cast<int>(n));
|
2024-08-25 04:08:24 +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();
|
|
|
|
return miqt_strdup(_b.data(), _b.length());
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
bool QSharedMemory_Create2(QSharedMemory* self, int size, int mode) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return self->create(static_cast<int>(size), static_cast<QSharedMemory::AccessMode>(mode));
|
|
|
|
}
|
|
|
|
|
2024-09-18 00:12:02 +00:00
|
|
|
bool QSharedMemory_Attach1(QSharedMemory* self, int mode) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return self->attach(static_cast<QSharedMemory::AccessMode>(mode));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QSharedMemory_Delete(QSharedMemory* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|