#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"

extern "C" {
    extern void miqt_exec_callback(void* cb, int argc, void* argv);
}

QTimeZone* QTimeZone_new() {
	return new QTimeZone();
}

QTimeZone* QTimeZone_new2(QByteArray* ianaId) {
	return new QTimeZone(*ianaId);
}

QTimeZone* QTimeZone_new3(int offsetSeconds) {
	return new QTimeZone(static_cast<int>(offsetSeconds));
}

QTimeZone* QTimeZone_new4(QByteArray* zoneId, int offsetSeconds, const char* name, size_t name_Strlen, const char* abbreviation, size_t abbreviation_Strlen) {
	QString name_QString = QString::fromUtf8(name, name_Strlen);
	QString abbreviation_QString = QString::fromUtf8(abbreviation, abbreviation_Strlen);
	return new QTimeZone(*zoneId, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString);
}

QTimeZone* QTimeZone_new5(QTimeZone* other) {
	return new QTimeZone(*other);
}

QTimeZone* QTimeZone_new6(QByteArray* zoneId, int offsetSeconds, const char* name, size_t name_Strlen, const char* abbreviation, size_t abbreviation_Strlen, uintptr_t country) {
	QString name_QString = QString::fromUtf8(name, name_Strlen);
	QString abbreviation_QString = QString::fromUtf8(abbreviation, abbreviation_Strlen);
	return new QTimeZone(*zoneId, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString, static_cast<QLocale::Country>(country));
}

QTimeZone* QTimeZone_new7(QByteArray* zoneId, int offsetSeconds, const char* name, size_t name_Strlen, const char* abbreviation, size_t abbreviation_Strlen, uintptr_t country, const char* comment, size_t comment_Strlen) {
	QString name_QString = QString::fromUtf8(name, name_Strlen);
	QString abbreviation_QString = QString::fromUtf8(abbreviation, abbreviation_Strlen);
	QString comment_QString = QString::fromUtf8(comment, comment_Strlen);
	return new QTimeZone(*zoneId, static_cast<int>(offsetSeconds), name_QString, abbreviation_QString, static_cast<QLocale::Country>(country), comment_QString);
}

void QTimeZone_OperatorAssign(QTimeZone* self, QTimeZone* other) {
	self->operator=(*other);
}

void QTimeZone_Swap(QTimeZone* self, QTimeZone* other) {
	self->swap(*other);
}

bool QTimeZone_OperatorEqual(QTimeZone* self, QTimeZone* other) {
	return const_cast<const QTimeZone*>(self)->operator==(*other);
}

bool QTimeZone_OperatorNotEqual(QTimeZone* self, QTimeZone* other) {
	return const_cast<const QTimeZone*>(self)->operator!=(*other);
}

bool QTimeZone_IsValid(QTimeZone* self) {
	return const_cast<const QTimeZone*>(self)->isValid();
}

QByteArray* QTimeZone_Id(QTimeZone* self) {
	QByteArray ret = const_cast<const QTimeZone*>(self)->id();
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QByteArray*>(new QByteArray(ret));
}

uintptr_t QTimeZone_Country(QTimeZone* self) {
	QLocale::Country ret = const_cast<const QTimeZone*>(self)->country();
	return static_cast<uintptr_t>(ret);
}

void QTimeZone_Comment(QTimeZone* self, char** _out, int* _out_Strlen) {
	QString ret = const_cast<const QTimeZone*>(self)->comment();
	// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
	QByteArray b = ret.toUtf8();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_DisplayName(QTimeZone* self, QDateTime* atDateTime, char** _out, int* _out_Strlen) {
	QString ret = const_cast<const QTimeZone*>(self)->displayName(*atDateTime);
	// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
	QByteArray b = ret.toUtf8();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_DisplayNameWithTimeType(QTimeZone* self, uintptr_t timeType, char** _out, int* _out_Strlen) {
	QString ret = const_cast<const QTimeZone*>(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();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_Abbreviation(QTimeZone* self, QDateTime* atDateTime, char** _out, int* _out_Strlen) {
	QString ret = const_cast<const QTimeZone*>(self)->abbreviation(*atDateTime);
	// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
	QByteArray b = ret.toUtf8();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

int QTimeZone_OffsetFromUtc(QTimeZone* self, QDateTime* atDateTime) {
	return const_cast<const QTimeZone*>(self)->offsetFromUtc(*atDateTime);
}

int QTimeZone_StandardTimeOffset(QTimeZone* self, QDateTime* atDateTime) {
	return const_cast<const QTimeZone*>(self)->standardTimeOffset(*atDateTime);
}

int QTimeZone_DaylightTimeOffset(QTimeZone* self, QDateTime* atDateTime) {
	return const_cast<const QTimeZone*>(self)->daylightTimeOffset(*atDateTime);
}

bool QTimeZone_HasDaylightTime(QTimeZone* self) {
	return const_cast<const QTimeZone*>(self)->hasDaylightTime();
}

bool QTimeZone_IsDaylightTime(QTimeZone* self, QDateTime* atDateTime) {
	return const_cast<const QTimeZone*>(self)->isDaylightTime(*atDateTime);
}

QTimeZone__OffsetData* QTimeZone_OffsetData(QTimeZone* self, QDateTime* forDateTime) {
	QTimeZone::OffsetData ret = const_cast<const QTimeZone*>(self)->offsetData(*forDateTime);
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QTimeZone::OffsetData*>(new QTimeZone::OffsetData(ret));
}

bool QTimeZone_HasTransitions(QTimeZone* self) {
	return const_cast<const QTimeZone*>(self)->hasTransitions();
}

QTimeZone__OffsetData* QTimeZone_NextTransition(QTimeZone* self, QDateTime* afterDateTime) {
	QTimeZone::OffsetData ret = const_cast<const QTimeZone*>(self)->nextTransition(*afterDateTime);
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QTimeZone::OffsetData*>(new QTimeZone::OffsetData(ret));
}

QTimeZone__OffsetData* QTimeZone_PreviousTransition(QTimeZone* self, QDateTime* beforeDateTime) {
	QTimeZone::OffsetData ret = const_cast<const QTimeZone*>(self)->previousTransition(*beforeDateTime);
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QTimeZone::OffsetData*>(new QTimeZone::OffsetData(ret));
}

void QTimeZone_Transitions(QTimeZone* self, QDateTime* fromDateTime, QDateTime* toDateTime, QTimeZone__OffsetData*** _out, size_t* _out_len) {
	QTimeZone::OffsetDataList ret = const_cast<const QTimeZone*>(self)->transitions(*fromDateTime, *toDateTime);
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QTimeZone__OffsetData** __out = static_cast<QTimeZone__OffsetData**>(malloc(sizeof(QTimeZone__OffsetData**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QTimeZone::OffsetData(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

QByteArray* QTimeZone_SystemTimeZoneId() {
	QByteArray ret = QTimeZone::systemTimeZoneId();
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QByteArray*>(new QByteArray(ret));
}

QTimeZone* QTimeZone_SystemTimeZone() {
	QTimeZone ret = QTimeZone::systemTimeZone();
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QTimeZone*>(new QTimeZone(ret));
}

QTimeZone* QTimeZone_Utc() {
	QTimeZone ret = QTimeZone::utc();
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QTimeZone*>(new QTimeZone(ret));
}

bool QTimeZone_IsTimeZoneIdAvailable(QByteArray* ianaId) {
	return QTimeZone::isTimeZoneIdAvailable(*ianaId);
}

void QTimeZone_AvailableTimeZoneIds(QByteArray*** _out, size_t* _out_len) {
	QList<QByteArray> ret = QTimeZone::availableTimeZoneIds();
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QByteArray(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

void QTimeZone_AvailableTimeZoneIdsWithCountry(uintptr_t country, QByteArray*** _out, size_t* _out_len) {
	QList<QByteArray> ret = QTimeZone::availableTimeZoneIds(static_cast<QLocale::Country>(country));
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QByteArray(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

void QTimeZone_AvailableTimeZoneIdsWithOffsetSeconds(int offsetSeconds, QByteArray*** _out, size_t* _out_len) {
	QList<QByteArray> ret = QTimeZone::availableTimeZoneIds(static_cast<int>(offsetSeconds));
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QByteArray(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

QByteArray* QTimeZone_IanaIdToWindowsId(QByteArray* ianaId) {
	QByteArray ret = QTimeZone::ianaIdToWindowsId(*ianaId);
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QByteArray*>(new QByteArray(ret));
}

QByteArray* QTimeZone_WindowsIdToDefaultIanaId(QByteArray* windowsId) {
	QByteArray ret = QTimeZone::windowsIdToDefaultIanaId(*windowsId);
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QByteArray*>(new QByteArray(ret));
}

QByteArray* QTimeZone_WindowsIdToDefaultIanaId2(QByteArray* windowsId, uintptr_t country) {
	QByteArray ret = QTimeZone::windowsIdToDefaultIanaId(*windowsId, static_cast<QLocale::Country>(country));
	// Copy-construct value returned type into heap-allocated copy
	return static_cast<QByteArray*>(new QByteArray(ret));
}

void QTimeZone_WindowsIdToIanaIds(QByteArray* windowsId, QByteArray*** _out, size_t* _out_len) {
	QList<QByteArray> ret = QTimeZone::windowsIdToIanaIds(*windowsId);
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QByteArray(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

void QTimeZone_WindowsIdToIanaIds2(QByteArray* windowsId, uintptr_t country, QByteArray*** _out, size_t* _out_len) {
	QList<QByteArray> ret = QTimeZone::windowsIdToIanaIds(*windowsId, static_cast<QLocale::Country>(country));
	// Convert QList<> from C++ memory to manually-managed C memory of copy-constructed pointers
	QByteArray** __out = static_cast<QByteArray**>(malloc(sizeof(QByteArray**) * ret.length()));
	for (size_t i = 0, e = ret.length(); i < e; ++i) {
		__out[i] = new QByteArray(ret[i]);
	}
	*_out = __out;
	*_out_len = ret.length();
}

void QTimeZone_DisplayName2(QTimeZone* self, QDateTime* atDateTime, uintptr_t nameType, char** _out, int* _out_Strlen) {
	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();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_DisplayName3(QTimeZone* self, QDateTime* atDateTime, uintptr_t nameType, QLocale* locale, char** _out, int* _out_Strlen) {
	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();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_DisplayName22(QTimeZone* self, uintptr_t timeType, uintptr_t nameType, char** _out, int* _out_Strlen) {
	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();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_DisplayName32(QTimeZone* self, uintptr_t timeType, uintptr_t nameType, QLocale* locale, char** _out, int* _out_Strlen) {
	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();
	*_out = static_cast<char*>(malloc(b.length()));
	memcpy(*_out, b.data(), b.length());
	*_out_Strlen = b.length();
}

void QTimeZone_Delete(QTimeZone* self) {
	delete self;
}

QTimeZone__OffsetData* QTimeZone__OffsetData_new(QTimeZone__OffsetData* param1) {
	return new QTimeZone::OffsetData(*param1);
}

void QTimeZone__OffsetData_Delete(QTimeZone__OffsetData* self) {
	delete self;
}