2024-08-25 04:08:24 +00:00
|
|
|
#include <QChar>
|
|
|
|
#include <QCollator>
|
|
|
|
#include <QCollatorSortKey>
|
|
|
|
#include <QLocale>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
|
|
|
#include "qcollator.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qcollator.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCollatorSortKey* QCollatorSortKey_new(QCollatorSortKey* other) {
|
|
|
|
return new QCollatorSortKey(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollatorSortKey_OperatorAssign(QCollatorSortKey* self, QCollatorSortKey* other) {
|
|
|
|
self->operator=(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollatorSortKey_Swap(QCollatorSortKey* self, QCollatorSortKey* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCollatorSortKey_Compare(const QCollatorSortKey* self, QCollatorSortKey* key) {
|
|
|
|
return self->compare(*key);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCollatorSortKey_Delete(QCollatorSortKey* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|
|
|
|
QCollator* QCollator_new() {
|
|
|
|
return new QCollator();
|
|
|
|
}
|
|
|
|
|
|
|
|
QCollator* QCollator_new2(QLocale* locale) {
|
|
|
|
return new QCollator(*locale);
|
|
|
|
}
|
|
|
|
|
|
|
|
QCollator* QCollator_new3(QCollator* param1) {
|
|
|
|
return new QCollator(*param1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_OperatorAssign(QCollator* self, QCollator* param1) {
|
|
|
|
self->operator=(*param1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_Swap(QCollator* self, QCollator* other) {
|
|
|
|
self->swap(*other);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_SetLocale(QCollator* self, QLocale* locale) {
|
|
|
|
self->setLocale(*locale);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QLocale* QCollator_Locale(const QCollator* self) {
|
|
|
|
QLocale ret = self->locale();
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QLocale*>(new QLocale(ret));
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
uintptr_t QCollator_CaseSensitivity(const QCollator* self) {
|
|
|
|
Qt::CaseSensitivity ret = self->caseSensitivity();
|
2024-08-29 07:01:51 +00:00
|
|
|
return static_cast<uintptr_t>(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_SetCaseSensitivity(QCollator* self, uintptr_t cs) {
|
|
|
|
self->setCaseSensitivity(static_cast<Qt::CaseSensitivity>(cs));
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
void QCollator_SetNumericMode(QCollator* self, bool on) {
|
|
|
|
self->setNumericMode(on);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QCollator_NumericMode(const QCollator* self) {
|
|
|
|
return self->numericMode();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_SetIgnorePunctuation(QCollator* self, bool on) {
|
|
|
|
self->setIgnorePunctuation(on);
|
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QCollator_IgnorePunctuation(const QCollator* self) {
|
|
|
|
return self->ignorePunctuation();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCollator_Compare(const QCollator* self, const char* s1, size_t s1_Strlen, const char* s2, size_t s2_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString s1_QString = QString::fromUtf8(s1, s1_Strlen);
|
|
|
|
QString s2_QString = QString::fromUtf8(s2, s2_Strlen);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->compare(s1_QString, s2_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
int QCollator_Compare3(const QCollator* self, QChar* s1, int len1, QChar* s2, int len2) {
|
|
|
|
return self->compare(s1, static_cast<int>(len1), s2, static_cast<int>(len2));
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
bool QCollator_OperatorCall(const QCollator* self, const char* s1, size_t s1_Strlen, const char* s2, size_t s2_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString s1_QString = QString::fromUtf8(s1, s1_Strlen);
|
|
|
|
QString s2_QString = QString::fromUtf8(s2, s2_Strlen);
|
2024-09-11 05:41:09 +00:00
|
|
|
return self->operator()(s1_QString, s2_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-11 05:41:09 +00:00
|
|
|
QCollatorSortKey* QCollator_SortKey(const QCollator* self, const char* stringVal, size_t stringVal_Strlen) {
|
2024-08-25 04:08:24 +00:00
|
|
|
QString stringVal_QString = QString::fromUtf8(stringVal, stringVal_Strlen);
|
2024-09-11 05:41:09 +00:00
|
|
|
QCollatorSortKey ret = self->sortKey(stringVal_QString);
|
2024-08-25 04:08:24 +00:00
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QCollatorSortKey*>(new QCollatorSortKey(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QCollator_Delete(QCollator* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|