2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qtextdocumentwriter.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QTextDocumentWriter struct {
|
|
|
|
h *C.QTextDocumentWriter
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) cPointer() *C.QTextDocumentWriter {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQTextDocumentWriter(h *C.QTextDocumentWriter) *QTextDocumentWriter {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QTextDocumentWriter{h: h}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQTextDocumentWriter_U(h unsafe.Pointer) *QTextDocumentWriter {
|
|
|
|
return newQTextDocumentWriter((*C.QTextDocumentWriter)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTextDocumentWriter constructs a new QTextDocumentWriter object.
|
|
|
|
func NewQTextDocumentWriter() *QTextDocumentWriter {
|
|
|
|
ret := C.QTextDocumentWriter_new()
|
|
|
|
return newQTextDocumentWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTextDocumentWriter2 constructs a new QTextDocumentWriter object.
|
|
|
|
func NewQTextDocumentWriter2(device *QIODevice, format *QByteArray) *QTextDocumentWriter {
|
|
|
|
ret := C.QTextDocumentWriter_new2(device.cPointer(), format.cPointer())
|
|
|
|
return newQTextDocumentWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTextDocumentWriter3 constructs a new QTextDocumentWriter object.
|
|
|
|
func NewQTextDocumentWriter3(fileName string) *QTextDocumentWriter {
|
2024-09-14 22:29:05 +00:00
|
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
|
|
defer C.free(fileName_ms)
|
|
|
|
ret := C.QTextDocumentWriter_new3((*C.struct_miqt_string)(fileName_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQTextDocumentWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTextDocumentWriter4 constructs a new QTextDocumentWriter object.
|
|
|
|
func NewQTextDocumentWriter4(fileName string, format *QByteArray) *QTextDocumentWriter {
|
2024-09-14 22:29:05 +00:00
|
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
|
|
defer C.free(fileName_ms)
|
|
|
|
ret := C.QTextDocumentWriter_new4((*C.struct_miqt_string)(fileName_ms), format.cPointer())
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQTextDocumentWriter(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) SetFormat(format *QByteArray) {
|
|
|
|
C.QTextDocumentWriter_SetFormat(this.h, format.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) Format() *QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QTextDocumentWriter_Format(this.h)
|
|
|
|
_goptr := newQByteArray(_ret)
|
|
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
return _goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) SetDevice(device *QIODevice) {
|
|
|
|
C.QTextDocumentWriter_SetDevice(this.h, device.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) Device() *QIODevice {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQIODevice_U(unsafe.Pointer(C.QTextDocumentWriter_Device(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) SetFileName(fileName string) {
|
2024-09-14 22:29:05 +00:00
|
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
|
|
defer C.free(fileName_ms)
|
|
|
|
C.QTextDocumentWriter_SetFileName(this.h, (*C.struct_miqt_string)(fileName_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) FileName() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTextDocumentWriter_FileName(this.h)
|
|
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
|
|
C.free(unsafe.Pointer(_ms))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) Write(document *QTextDocument) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QTextDocumentWriter_Write(this.h, document.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) WriteWithFragment(fragment *QTextDocumentFragment) bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QTextDocumentWriter_WriteWithFragment(this.h, fragment.cPointer()))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) SetCodec(codec *QTextCodec) {
|
|
|
|
C.QTextDocumentWriter_SetCodec(this.h, codec.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTextDocumentWriter) Codec() *QTextCodec {
|
2024-09-17 07:30:27 +00:00
|
|
|
return newQTextCodec_U(unsafe.Pointer(C.QTextDocumentWriter_Codec(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTextDocumentWriter_SupportedDocumentFormats() []QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ma *C.struct_miqt_array = C.QTextDocumentWriter_SupportedDocumentFormats()
|
|
|
|
_ret := make([]QByteArray, int(_ma.len))
|
2024-09-17 07:30:27 +00:00
|
|
|
_outCast := (*[0xffff]*C.QByteArray)(unsafe.Pointer(_ma.data)) // hey ya
|
2024-09-14 22:29:05 +00:00
|
|
|
for i := 0; i < int(_ma.len); i++ {
|
2024-09-17 07:30:27 +00:00
|
|
|
_lv_ret := _outCast[i]
|
|
|
|
_lv_goptr := newQByteArray(_lv_ret)
|
|
|
|
_lv_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
|
|
_ret[i] = *_lv_goptr
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
C.free(unsafe.Pointer(_ma))
|
|
|
|
return _ret
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QTextDocumentWriter) Delete() {
|
|
|
|
C.QTextDocumentWriter_Delete(this.h)
|
|
|
|
}
|
2024-09-14 22:29:05 +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 *QTextDocumentWriter) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QTextDocumentWriter) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|