2024-08-25 04:08:24 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <QString>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include <QByteArray>
|
|
|
|
#include <cstring>
|
2024-08-25 04:08:24 +00:00
|
|
|
#include <QTextCursor>
|
|
|
|
#include <QTextDocument>
|
|
|
|
#include <QTextDocumentFragment>
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "qtextdocumentfragment.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
#include "gen_qtextdocumentfragment.h"
|
2024-08-25 04:08:24 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
extern void miqt_exec_callback(void* cb, int argc, void* argv);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_new() {
|
|
|
|
return new QTextDocumentFragment();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_new2(QTextDocument* document) {
|
|
|
|
return new QTextDocumentFragment(document);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_new3(QTextCursor* rangeVal) {
|
|
|
|
return new QTextDocumentFragment(*rangeVal);
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_new4(QTextDocumentFragment* rhs) {
|
|
|
|
return new QTextDocumentFragment(*rhs);
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextDocumentFragment_OperatorAssign(QTextDocumentFragment* self, QTextDocumentFragment* rhs) {
|
|
|
|
self->operator=(*rhs);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool QTextDocumentFragment_IsEmpty(QTextDocumentFragment* self) {
|
2024-08-29 07:01:51 +00:00
|
|
|
return const_cast<const QTextDocumentFragment*>(self)->isEmpty();
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QTextDocumentFragment_ToPlainText(QTextDocumentFragment* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QTextDocumentFragment*>(self)->toPlainText();
|
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
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextDocumentFragment_ToHtml(QTextDocumentFragment* self, char** _out, int* _out_Strlen) {
|
2024-08-29 07:01:51 +00:00
|
|
|
QString ret = const_cast<const QTextDocumentFragment*>(self)->toHtml();
|
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
|
|
|
|
QByteArray b = ret.toUtf8();
|
|
|
|
*_out = static_cast<char*>(malloc(b.length()));
|
|
|
|
memcpy(*_out, b.data(), b.length());
|
|
|
|
*_out_Strlen = b.length();
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_FromPlainText(const char* plainText, size_t plainText_Strlen) {
|
|
|
|
QString plainText_QString = QString::fromUtf8(plainText, plainText_Strlen);
|
|
|
|
QTextDocumentFragment ret = QTextDocumentFragment::fromPlainText(plainText_QString);
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextDocumentFragment*>(new QTextDocumentFragment(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_FromHtml(const char* html, size_t html_Strlen) {
|
|
|
|
QString html_QString = QString::fromUtf8(html, html_Strlen);
|
|
|
|
QTextDocumentFragment ret = QTextDocumentFragment::fromHtml(html_QString);
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextDocumentFragment*>(new QTextDocumentFragment(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_FromHtml2(const char* html, size_t html_Strlen, QTextDocument* resourceProvider) {
|
|
|
|
QString html_QString = QString::fromUtf8(html, html_Strlen);
|
|
|
|
QTextDocumentFragment ret = QTextDocumentFragment::fromHtml(html_QString, resourceProvider);
|
|
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
|
|
return static_cast<QTextDocumentFragment*>(new QTextDocumentFragment(ret));
|
|
|
|
}
|
|
|
|
|
|
|
|
void QTextDocumentFragment_ToHtml1(QTextDocumentFragment* self, QByteArray* encoding, char** _out, int* _out_Strlen) {
|
|
|
|
QString ret = self->toHtml(*encoding);
|
|
|
|
// 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 QTextDocumentFragment_Delete(QTextDocumentFragment* self) {
|
|
|
|
delete self;
|
|
|
|
}
|
|
|
|
|