mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
82 lines
3.1 KiB
C++
82 lines
3.1 KiB
C++
#include <QByteArray>
|
|
#include <QString>
|
|
#include <QByteArray>
|
|
#include <cstring>
|
|
#include <QTextCursor>
|
|
#include <QTextDocument>
|
|
#include <QTextDocumentFragment>
|
|
#include "qtextdocumentfragment.h"
|
|
#include "gen_qtextdocumentfragment.h"
|
|
#include "_cgo_export.h"
|
|
|
|
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(const QTextDocumentFragment* self) {
|
|
return self->isEmpty();
|
|
}
|
|
|
|
struct miqt_string* QTextDocumentFragment_ToPlainText(const QTextDocumentFragment* self) {
|
|
QString _ret = self->toPlainText();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
struct miqt_string* QTextDocumentFragment_ToHtml(const QTextDocumentFragment* self) {
|
|
QString _ret = self->toHtml();
|
|
// Convert QString from UTF-16 in C++ RAII memory to UTF-8 in manually-managed C memory
|
|
QByteArray _b = _ret.toUtf8();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
QTextDocumentFragment* QTextDocumentFragment_FromPlainText(struct miqt_string* plainText) {
|
|
QString plainText_QString = QString::fromUtf8(&plainText->data, plainText->len);
|
|
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(struct miqt_string* html) {
|
|
QString html_QString = QString::fromUtf8(&html->data, html->len);
|
|
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(struct miqt_string* html, QTextDocument* resourceProvider) {
|
|
QString html_QString = QString::fromUtf8(&html->data, html->len);
|
|
QTextDocumentFragment _ret = QTextDocumentFragment::fromHtml(html_QString, resourceProvider);
|
|
// Copy-construct value returned type into heap-allocated copy
|
|
return static_cast<QTextDocumentFragment*>(new QTextDocumentFragment(_ret));
|
|
}
|
|
|
|
struct miqt_string* QTextDocumentFragment_ToHtml1(const QTextDocumentFragment* self, QByteArray* encoding) {
|
|
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();
|
|
return miqt_strdup(_b.data(), _b.length());
|
|
}
|
|
|
|
void QTextDocumentFragment_Delete(QTextDocumentFragment* self) {
|
|
delete self;
|
|
}
|
|
|