mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 00:48:38 +00:00
393 lines
15 KiB
C++
393 lines
15 KiB
C++
#include <QByteArray>
|
|
#include <QDateTime>
|
|
#include <QList>
|
|
#include <QLocale>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <QTimeZone>
|
|
#define WORKAROUND_INNER_CLASS_DEFINITION_QTimeZone__OffsetData
|
|
#include <qtimezone.h>
|
|
#include "gen_qtimezone.h"
|
|
|
|
#ifndef _Bool
|
|
#define _Bool bool
|
|
#endif
|
|
#include "_cgo_export.h"
|
|
|
|
QTimeZone* QTimeZone_new() {
|
|
return new QTimeZone();
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new2(struct miqt_string ianaId) {
|
|
QByteArray ianaId_QByteArray(ianaId.data, ianaId.len);
|
|
return new QTimeZone(ianaId_QByteArray);
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new3(int offsetSeconds) {
|
|
return new QTimeZone(static_cast<int>(offsetSeconds));
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new4(struct miqt_string zoneId, int offsetSeconds, struct miqt_string name, struct miqt_string abbreviation) {
|
|
QByteArray zoneId_QByteArray(zoneId.data, zoneId.len);
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
QString abbreviation_QString = QString::fromUtf8(abbreviation.data, abbreviation.len);
|
|
return new QTimeZone(zoneId_QByteArray, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString);
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new5(QTimeZone* other) {
|
|
return new QTimeZone(*other);
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new6(struct miqt_string zoneId, int offsetSeconds, struct miqt_string name, struct miqt_string abbreviation, uint16_t territory) {
|
|
QByteArray zoneId_QByteArray(zoneId.data, zoneId.len);
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
QString abbreviation_QString = QString::fromUtf8(abbreviation.data, abbreviation.len);
|
|
return new QTimeZone(zoneId_QByteArray, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString, static_cast<QLocale::Territory>(territory));
|
|
}
|
|
|
|
QTimeZone* QTimeZone_new7(struct miqt_string zoneId, int offsetSeconds, struct miqt_string name, struct miqt_string abbreviation, uint16_t territory, struct miqt_string comment) {
|
|
QByteArray zoneId_QByteArray(zoneId.data, zoneId.len);
|
|
QString name_QString = QString::fromUtf8(name.data, name.len);
|
|
QString abbreviation_QString = QString::fromUtf8(abbreviation.data, abbreviation.len);
|
|
QString comment_QString = QString::fromUtf8(comment.data, comment.len);
|
|
return new QTimeZone(zoneId_QByteArray, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString, static_cast<QLocale::Territory>(territory), comment_QString);
|
|
}
|
|
|
|
void QTimeZone_OperatorAssign(QTimeZone* self, QTimeZone* other) {
|
|
self->operator=(*other);
|
|
}
|
|
|
|
void QTimeZone_Swap(QTimeZone* self, QTimeZone* other) {
|
|
self->swap(*other);
|
|
}
|
|
|
|
bool QTimeZone_IsValid(const QTimeZone* self) {
|
|
return self->isValid();
|
|
}
|
|
|
|
struct miqt_string QTimeZone_Id(const QTimeZone* self) {
|
|
QByteArray _qb = self->id();
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
uint16_t QTimeZone_Territory(const QTimeZone* self) {
|
|
QLocale::Territory _ret = self->territory();
|
|
return static_cast<uint16_t>(_ret);
|
|
}
|
|
|
|
uint16_t QTimeZone_Country(const QTimeZone* self) {
|
|
QLocale::Country _ret = self->country();
|
|
return static_cast<uint16_t>(_ret);
|
|
}
|
|
|
|
struct miqt_string QTimeZone_Comment(const QTimeZone* self) {
|
|
QString _ret = self->comment();
|
|
// 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 QTimeZone_DisplayName(const QTimeZone* self, QDateTime* atDateTime) {
|
|
QString _ret = self->displayName(*atDateTime);
|
|
// 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 QTimeZone_DisplayNameWithTimeType(const QTimeZone* self, int timeType) {
|
|
QString _ret = self->displayName(static_cast<QTimeZone::TimeType>(timeType));
|
|
// 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 QTimeZone_Abbreviation(const QTimeZone* self, QDateTime* atDateTime) {
|
|
QString _ret = self->abbreviation(*atDateTime);
|
|
// 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 QTimeZone_OffsetFromUtc(const QTimeZone* self, QDateTime* atDateTime) {
|
|
return self->offsetFromUtc(*atDateTime);
|
|
}
|
|
|
|
int QTimeZone_StandardTimeOffset(const QTimeZone* self, QDateTime* atDateTime) {
|
|
return self->standardTimeOffset(*atDateTime);
|
|
}
|
|
|
|
int QTimeZone_DaylightTimeOffset(const QTimeZone* self, QDateTime* atDateTime) {
|
|
return self->daylightTimeOffset(*atDateTime);
|
|
}
|
|
|
|
bool QTimeZone_HasDaylightTime(const QTimeZone* self) {
|
|
return self->hasDaylightTime();
|
|
}
|
|
|
|
bool QTimeZone_IsDaylightTime(const QTimeZone* self, QDateTime* atDateTime) {
|
|
return self->isDaylightTime(*atDateTime);
|
|
}
|
|
|
|
QTimeZone__OffsetData* QTimeZone_OffsetData(const QTimeZone* self, QDateTime* forDateTime) {
|
|
return new QTimeZone::OffsetData(self->offsetData(*forDateTime));
|
|
}
|
|
|
|
bool QTimeZone_HasTransitions(const QTimeZone* self) {
|
|
return self->hasTransitions();
|
|
}
|
|
|
|
QTimeZone__OffsetData* QTimeZone_NextTransition(const QTimeZone* self, QDateTime* afterDateTime) {
|
|
return new QTimeZone::OffsetData(self->nextTransition(*afterDateTime));
|
|
}
|
|
|
|
QTimeZone__OffsetData* QTimeZone_PreviousTransition(const QTimeZone* self, QDateTime* beforeDateTime) {
|
|
return new QTimeZone::OffsetData(self->previousTransition(*beforeDateTime));
|
|
}
|
|
|
|
struct miqt_array /* of QTimeZone__OffsetData* */ QTimeZone_Transitions(const QTimeZone* self, QDateTime* fromDateTime, QDateTime* toDateTime) {
|
|
QTimeZone::OffsetDataList _ret = self->transitions(*fromDateTime, *toDateTime);
|
|
// Convert QList<> from C++ memory to manually-managed C memory
|
|
QTimeZone__OffsetData** _arr = static_cast<QTimeZone__OffsetData**>(malloc(sizeof(QTimeZone__OffsetData*) * _ret.length()));
|
|
for (size_t i = 0, e = _ret.length(); i < e; ++i) {
|
|
_arr[i] = new QTimeZone::OffsetData(_ret[i]);
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_string QTimeZone_SystemTimeZoneId() {
|
|
QByteArray _qb = QTimeZone::systemTimeZoneId();
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
QTimeZone* QTimeZone_SystemTimeZone() {
|
|
return new QTimeZone(QTimeZone::systemTimeZone());
|
|
}
|
|
|
|
QTimeZone* QTimeZone_Utc() {
|
|
return new QTimeZone(QTimeZone::utc());
|
|
}
|
|
|
|
bool QTimeZone_IsTimeZoneIdAvailable(struct miqt_string ianaId) {
|
|
QByteArray ianaId_QByteArray(ianaId.data, ianaId.len);
|
|
return QTimeZone::isTimeZoneIdAvailable(ianaId_QByteArray);
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QTimeZone_AvailableTimeZoneIds() {
|
|
QList<QByteArray> _ret = QTimeZone::availableTimeZoneIds();
|
|
// 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) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QTimeZone_AvailableTimeZoneIdsWithTerritory(uint16_t territory) {
|
|
QList<QByteArray> _ret = QTimeZone::availableTimeZoneIds(static_cast<QLocale::Territory>(territory));
|
|
// 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) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QTimeZone_AvailableTimeZoneIdsWithOffsetSeconds(int offsetSeconds) {
|
|
QList<QByteArray> _ret = QTimeZone::availableTimeZoneIds(static_cast<int>(offsetSeconds));
|
|
// 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) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_string QTimeZone_IanaIdToWindowsId(struct miqt_string ianaId) {
|
|
QByteArray ianaId_QByteArray(ianaId.data, ianaId.len);
|
|
QByteArray _qb = QTimeZone::ianaIdToWindowsId(ianaId_QByteArray);
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_string QTimeZone_WindowsIdToDefaultIanaId(struct miqt_string windowsId) {
|
|
QByteArray windowsId_QByteArray(windowsId.data, windowsId.len);
|
|
QByteArray _qb = QTimeZone::windowsIdToDefaultIanaId(windowsId_QByteArray);
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_string QTimeZone_WindowsIdToDefaultIanaId2(struct miqt_string windowsId, uint16_t territory) {
|
|
QByteArray windowsId_QByteArray(windowsId.data, windowsId.len);
|
|
QByteArray _qb = QTimeZone::windowsIdToDefaultIanaId(windowsId_QByteArray, static_cast<QLocale::Territory>(territory));
|
|
struct miqt_string _ms;
|
|
_ms.len = _qb.length();
|
|
_ms.data = static_cast<char*>(malloc(_ms.len));
|
|
memcpy(_ms.data, _qb.data(), _ms.len);
|
|
return _ms;
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QTimeZone_WindowsIdToIanaIds(struct miqt_string windowsId) {
|
|
QByteArray windowsId_QByteArray(windowsId.data, windowsId.len);
|
|
QList<QByteArray> _ret = QTimeZone::windowsIdToIanaIds(windowsId_QByteArray);
|
|
// 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) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_array /* of struct miqt_string */ QTimeZone_WindowsIdToIanaIds2(struct miqt_string windowsId, uint16_t territory) {
|
|
QByteArray windowsId_QByteArray(windowsId.data, windowsId.len);
|
|
QList<QByteArray> _ret = QTimeZone::windowsIdToIanaIds(windowsId_QByteArray, static_cast<QLocale::Territory>(territory));
|
|
// 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) {
|
|
QByteArray _lv_qb = _ret[i];
|
|
struct miqt_string _lv_ms;
|
|
_lv_ms.len = _lv_qb.length();
|
|
_lv_ms.data = static_cast<char*>(malloc(_lv_ms.len));
|
|
memcpy(_lv_ms.data, _lv_qb.data(), _lv_ms.len);
|
|
_arr[i] = _lv_ms;
|
|
}
|
|
struct miqt_array _out;
|
|
_out.len = _ret.length();
|
|
_out.data = static_cast<void*>(_arr);
|
|
return _out;
|
|
}
|
|
|
|
struct miqt_string QTimeZone_DisplayName2(const QTimeZone* self, QDateTime* atDateTime, int nameType) {
|
|
QString _ret = self->displayName(*atDateTime, static_cast<QTimeZone::NameType>(nameType));
|
|
// 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 QTimeZone_DisplayName3(const QTimeZone* self, QDateTime* atDateTime, int nameType, QLocale* locale) {
|
|
QString _ret = self->displayName(*atDateTime, static_cast<QTimeZone::NameType>(nameType), *locale);
|
|
// 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 QTimeZone_DisplayName22(const QTimeZone* self, int timeType, int nameType) {
|
|
QString _ret = self->displayName(static_cast<QTimeZone::TimeType>(timeType), static_cast<QTimeZone::NameType>(nameType));
|
|
// 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 QTimeZone_DisplayName32(const QTimeZone* self, int timeType, int nameType, QLocale* locale) {
|
|
QString _ret = self->displayName(static_cast<QTimeZone::TimeType>(timeType), static_cast<QTimeZone::NameType>(nameType), *locale);
|
|
// 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;
|
|
}
|
|
|
|
void QTimeZone_Delete(QTimeZone* self, bool isSubclass) {
|
|
if (isSubclass) {
|
|
delete dynamic_cast<QTimeZone*>( self );
|
|
} else {
|
|
delete self;
|
|
}
|
|
}
|
|
|
|
QTimeZone__OffsetData* QTimeZone__OffsetData_new(QTimeZone__OffsetData* param1) {
|
|
return new QTimeZone::OffsetData(*param1);
|
|
}
|
|
|
|
void QTimeZone__OffsetData_OperatorAssign(QTimeZone__OffsetData* self, QTimeZone__OffsetData* param1) {
|
|
self->operator=(*param1);
|
|
}
|
|
|
|
void QTimeZone__OffsetData_Delete(QTimeZone__OffsetData* self, bool isSubclass) {
|
|
if (isSubclass) {
|
|
delete dynamic_cast<QTimeZone::OffsetData*>( self );
|
|
} else {
|
|
delete self;
|
|
}
|
|
}
|
|
|