miqt/qt6/gen_qtextdocumentfragment.go

187 lines
6.1 KiB
Go
Raw Normal View History

2024-10-20 05:21:03 +00:00
package qt6
/*
#include "gen_qtextdocumentfragment.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QTextDocumentFragment struct {
2024-11-19 06:29:06 +00:00
h *C.QTextDocumentFragment
isSubclass bool
2024-10-20 05:21:03 +00:00
}
func (this *QTextDocumentFragment) cPointer() *C.QTextDocumentFragment {
if this == nil {
return nil
}
return this.h
}
func (this *QTextDocumentFragment) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
2024-11-19 06:29:06 +00:00
// newQTextDocumentFragment constructs the type using only CGO pointers.
2024-10-20 05:21:03 +00:00
func newQTextDocumentFragment(h *C.QTextDocumentFragment) *QTextDocumentFragment {
if h == nil {
return nil
}
2024-12-07 04:15:57 +00:00
2024-10-20 05:21:03 +00:00
return &QTextDocumentFragment{h: h}
}
2024-11-19 06:29:06 +00:00
// UnsafeNewQTextDocumentFragment constructs the type using only unsafe pointers.
2024-10-20 05:21:03 +00:00
func UnsafeNewQTextDocumentFragment(h unsafe.Pointer) *QTextDocumentFragment {
2024-12-07 04:15:57 +00:00
return newQTextDocumentFragment((*C.QTextDocumentFragment)(h))
2024-10-20 05:21:03 +00:00
}
// NewQTextDocumentFragment constructs a new QTextDocumentFragment object.
func NewQTextDocumentFragment() *QTextDocumentFragment {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQTextDocumentFragment(C.QTextDocumentFragment_new())
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQTextDocumentFragment2 constructs a new QTextDocumentFragment object.
func NewQTextDocumentFragment2(document *QTextDocument) *QTextDocumentFragment {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQTextDocumentFragment(C.QTextDocumentFragment_new2(document.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQTextDocumentFragment3 constructs a new QTextDocumentFragment object.
func NewQTextDocumentFragment3(rangeVal *QTextCursor) *QTextDocumentFragment {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQTextDocumentFragment(C.QTextDocumentFragment_new3(rangeVal.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
// NewQTextDocumentFragment4 constructs a new QTextDocumentFragment object.
func NewQTextDocumentFragment4(rhs *QTextDocumentFragment) *QTextDocumentFragment {
2024-11-19 06:29:06 +00:00
2024-12-07 04:15:57 +00:00
ret := newQTextDocumentFragment(C.QTextDocumentFragment_new4(rhs.cPointer()))
2024-11-19 06:29:06 +00:00
ret.isSubclass = true
return ret
2024-10-20 05:21:03 +00:00
}
func (this *QTextDocumentFragment) OperatorAssign(rhs *QTextDocumentFragment) {
C.QTextDocumentFragment_OperatorAssign(this.h, rhs.cPointer())
}
func (this *QTextDocumentFragment) IsEmpty() bool {
return (bool)(C.QTextDocumentFragment_IsEmpty(this.h))
}
func (this *QTextDocumentFragment) ToPlainText() string {
var _ms C.struct_miqt_string = C.QTextDocumentFragment_ToPlainText(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QTextDocumentFragment) ToRawText() string {
var _ms C.struct_miqt_string = C.QTextDocumentFragment_ToRawText(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QTextDocumentFragment) ToHtml() string {
var _ms C.struct_miqt_string = C.QTextDocumentFragment_ToHtml(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func (this *QTextDocumentFragment) ToMarkdown() string {
var _ms C.struct_miqt_string = C.QTextDocumentFragment_ToMarkdown(this.h)
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QTextDocumentFragment_FromPlainText(plainText string) *QTextDocumentFragment {
plainText_ms := C.struct_miqt_string{}
plainText_ms.data = C.CString(plainText)
plainText_ms.len = C.size_t(len(plainText))
defer C.free(unsafe.Pointer(plainText_ms.data))
_goptr := newQTextDocumentFragment(C.QTextDocumentFragment_FromPlainText(plainText_ms))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QTextDocumentFragment_FromHtml(html string) *QTextDocumentFragment {
html_ms := C.struct_miqt_string{}
html_ms.data = C.CString(html)
html_ms.len = C.size_t(len(html))
defer C.free(unsafe.Pointer(html_ms.data))
_goptr := newQTextDocumentFragment(C.QTextDocumentFragment_FromHtml(html_ms))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QTextDocumentFragment_FromMarkdown(markdown string) *QTextDocumentFragment {
markdown_ms := C.struct_miqt_string{}
markdown_ms.data = C.CString(markdown)
markdown_ms.len = C.size_t(len(markdown))
defer C.free(unsafe.Pointer(markdown_ms.data))
_goptr := newQTextDocumentFragment(C.QTextDocumentFragment_FromMarkdown(markdown_ms))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func (this *QTextDocumentFragment) ToMarkdown1(features QTextDocument__MarkdownFeature) string {
var _ms C.struct_miqt_string = C.QTextDocumentFragment_ToMarkdown1(this.h, (C.int)(features))
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
C.free(unsafe.Pointer(_ms.data))
return _ret
}
func QTextDocumentFragment_FromHtml2(html string, resourceProvider *QTextDocument) *QTextDocumentFragment {
html_ms := C.struct_miqt_string{}
html_ms.data = C.CString(html)
html_ms.len = C.size_t(len(html))
defer C.free(unsafe.Pointer(html_ms.data))
_goptr := newQTextDocumentFragment(C.QTextDocumentFragment_FromHtml2(html_ms, resourceProvider.cPointer()))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
func QTextDocumentFragment_FromMarkdown2(markdown string, features QTextDocument__MarkdownFeature) *QTextDocumentFragment {
markdown_ms := C.struct_miqt_string{}
markdown_ms.data = C.CString(markdown)
markdown_ms.len = C.size_t(len(markdown))
defer C.free(unsafe.Pointer(markdown_ms.data))
_goptr := newQTextDocumentFragment(C.QTextDocumentFragment_FromMarkdown2(markdown_ms, (C.int)(features)))
2024-10-20 05:21:03 +00:00
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
return _goptr
}
// Delete this object from C++ memory.
func (this *QTextDocumentFragment) Delete() {
2024-11-19 06:29:06 +00:00
C.QTextDocumentFragment_Delete(this.h, C.bool(this.isSubclass))
2024-10-20 05:21:03 +00:00
}
// GoGC adds a Go Finalizer to this pointer, so that it will be deleted
// from C++ memory once it is unreachable from Go memory.
func (this *QTextDocumentFragment) GoGC() {
runtime.SetFinalizer(this, func(this *QTextDocumentFragment) {
this.Delete()
runtime.KeepAlive(this.h)
})
}