miqt/qt/multimedia/gen_qcamerainfo.cpp

114 lines
3.2 KiB
C++
Raw Normal View History

2024-11-04 10:15:32 +00:00
#include <QByteArray>
#include <QCamera>
#include <QCameraInfo>
#include <QList>
#include <QString>
#include <QByteArray>
#include <cstring>
#include <qcamerainfo.h>
#include "gen_qcamerainfo.h"
#include "_cgo_export.h"
2024-12-07 04:15:57 +00:00
QCameraInfo* QCameraInfo_new() {
return new QCameraInfo();
2024-11-04 10:15:32 +00:00
}
2024-12-07 04:15:57 +00:00
QCameraInfo* QCameraInfo_new2(QCamera* camera) {
return new QCameraInfo(*camera);
2024-11-04 10:15:32 +00:00
}
2024-12-07 04:15:57 +00:00
QCameraInfo* QCameraInfo_new3(QCameraInfo* other) {
return new QCameraInfo(*other);
2024-11-04 10:15:32 +00:00
}
2024-12-07 04:15:57 +00:00
QCameraInfo* QCameraInfo_new4(struct miqt_string name) {
2024-11-04 10:15:32 +00:00
QByteArray name_QByteArray(name.data, name.len);
2024-12-07 04:15:57 +00:00
return new QCameraInfo(name_QByteArray);
2024-11-04 10:15:32 +00:00
}
void QCameraInfo_OperatorAssign(QCameraInfo* self, QCameraInfo* other) {
self->operator=(*other);
}
bool QCameraInfo_OperatorEqual(const QCameraInfo* self, QCameraInfo* other) {
return (*self == *other);
2024-11-04 10:15:32 +00:00
}
bool QCameraInfo_OperatorNotEqual(const QCameraInfo* self, QCameraInfo* other) {
return (*self != *other);
2024-11-04 10:15:32 +00:00
}
bool QCameraInfo_IsNull(const QCameraInfo* self) {
return self->isNull();
}
struct miqt_string QCameraInfo_DeviceName(const QCameraInfo* self) {
QString _ret = self->deviceName();
// 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;
}
struct miqt_string QCameraInfo_Description(const QCameraInfo* self) {
QString _ret = self->description();
// 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;
}
int QCameraInfo_Position(const QCameraInfo* self) {
QCamera::Position _ret = self->position();
return static_cast<int>(_ret);
}
int QCameraInfo_Orientation(const QCameraInfo* self) {
return self->orientation();
}
QCameraInfo* QCameraInfo_DefaultCamera() {
return new QCameraInfo(QCameraInfo::defaultCamera());
}
struct miqt_array /* of QCameraInfo* */ QCameraInfo_AvailableCameras() {
2024-11-04 10:15:32 +00:00
QList<QCameraInfo> _ret = QCameraInfo::availableCameras();
// Convert QList<> from C++ memory to manually-managed C memory
QCameraInfo** _arr = static_cast<QCameraInfo**>(malloc(sizeof(QCameraInfo*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QCameraInfo(_ret[i]);
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
struct miqt_array /* of QCameraInfo* */ QCameraInfo_AvailableCameras1(int position) {
2024-11-04 10:15:32 +00:00
QList<QCameraInfo> _ret = QCameraInfo::availableCameras(static_cast<QCamera::Position>(position));
// Convert QList<> from C++ memory to manually-managed C memory
QCameraInfo** _arr = static_cast<QCameraInfo**>(malloc(sizeof(QCameraInfo*) * _ret.length()));
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
_arr[i] = new QCameraInfo(_ret[i]);
}
struct miqt_array _out;
_out.len = _ret.length();
_out.data = static_cast<void*>(_arr);
return _out;
}
2024-11-19 06:29:06 +00:00
void QCameraInfo_Delete(QCameraInfo* self, bool isSubclass) {
if (isSubclass) {
delete dynamic_cast<QCameraInfo*>( self );
} else {
delete self;
}
2024-11-04 10:15:32 +00:00
}