2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qtemporaryfile.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-10-16 05:07:56 +00:00
|
|
|
"github.com/mappu/miqt/libmiqt"
|
2024-09-14 22:29:05 +00:00
|
|
|
"runtime"
|
2024-08-25 04:08:24 +00:00
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QTemporaryFile struct {
|
|
|
|
h *C.QTemporaryFile
|
|
|
|
*QFile
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) cPointer() *C.QTemporaryFile {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QTemporaryFile) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQTemporaryFile(h *C.QTemporaryFile) *QTemporaryFile {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-10-16 05:07:56 +00:00
|
|
|
return &QTemporaryFile{h: h, QFile: UnsafeNewQFile(unsafe.Pointer(h))}
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQTemporaryFile(h unsafe.Pointer) *QTemporaryFile {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQTemporaryFile((*C.QTemporaryFile)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTemporaryFile constructs a new QTemporaryFile object.
|
|
|
|
func NewQTemporaryFile() *QTemporaryFile {
|
|
|
|
ret := C.QTemporaryFile_new()
|
|
|
|
return newQTemporaryFile(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTemporaryFile2 constructs a new QTemporaryFile object.
|
|
|
|
func NewQTemporaryFile2(templateName string) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
templateName_ms := libmiqt.Strdupg(templateName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(templateName_ms)
|
|
|
|
ret := C.QTemporaryFile_new2((*C.struct_miqt_string)(templateName_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQTemporaryFile(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTemporaryFile3 constructs a new QTemporaryFile object.
|
|
|
|
func NewQTemporaryFile3(parent *QObject) *QTemporaryFile {
|
|
|
|
ret := C.QTemporaryFile_new3(parent.cPointer())
|
|
|
|
return newQTemporaryFile(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQTemporaryFile4 constructs a new QTemporaryFile object.
|
|
|
|
func NewQTemporaryFile4(templateName string, parent *QObject) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
templateName_ms := libmiqt.Strdupg(templateName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(templateName_ms)
|
|
|
|
ret := C.QTemporaryFile_new4((*C.struct_miqt_string)(templateName_ms), parent.cPointer())
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQTemporaryFile(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) MetaObject() *QMetaObject {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQMetaObject(unsafe.Pointer(C.QTemporaryFile_MetaObject(this.h)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
2024-09-20 22:32:57 +00:00
|
|
|
func (this *QTemporaryFile) Metacast(param1 string) unsafe.Pointer {
|
|
|
|
param1_Cstring := C.CString(param1)
|
|
|
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
|
|
|
return C.QTemporaryFile_Metacast(this.h, param1_Cstring)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func QTemporaryFile_Tr(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_Tr(s_Cstring)
|
|
|
|
_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 QTemporaryFile_TrUtf8(s string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_TrUtf8(s_Cstring)
|
|
|
|
_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 *QTemporaryFile) AutoRemove() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QTemporaryFile_AutoRemove(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) SetAutoRemove(b bool) {
|
|
|
|
C.QTemporaryFile_SetAutoRemove(this.h, (C.bool)(b))
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) Open() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QTemporaryFile_Open(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) FileName() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_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 *QTemporaryFile) FileTemplate() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_FileTemplate(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 *QTemporaryFile) SetFileTemplate(name string) {
|
2024-10-16 05:07:56 +00:00
|
|
|
name_ms := libmiqt.Strdupg(name)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(name_ms)
|
|
|
|
C.QTemporaryFile_SetFileTemplate(this.h, (*C.struct_miqt_string)(name_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QTemporaryFile) Rename(newName string) bool {
|
2024-10-16 05:07:56 +00:00
|
|
|
newName_ms := libmiqt.Strdupg(newName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(newName_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QTemporaryFile_Rename(this.h, (*C.struct_miqt_string)(newName_ms)))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTemporaryFile_CreateLocalFile(fileName string) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
fileName_ms := libmiqt.Strdupg(fileName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(fileName_ms)
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQTemporaryFile(unsafe.Pointer(C.QTemporaryFile_CreateLocalFile((*C.struct_miqt_string)(fileName_ms))))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTemporaryFile_CreateLocalFileWithFile(file *QFile) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQTemporaryFile(unsafe.Pointer(C.QTemporaryFile_CreateLocalFileWithFile(file.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTemporaryFile_CreateNativeFile(fileName string) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
fileName_ms := libmiqt.Strdupg(fileName)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(fileName_ms)
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQTemporaryFile(unsafe.Pointer(C.QTemporaryFile_CreateNativeFile((*C.struct_miqt_string)(fileName_ms))))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTemporaryFile_CreateNativeFileWithFile(file *QFile) *QTemporaryFile {
|
2024-10-16 05:07:56 +00:00
|
|
|
return UnsafeNewQTemporaryFile(unsafe.Pointer(C.QTemporaryFile_CreateNativeFileWithFile(file.cPointer())))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func QTemporaryFile_Tr2(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_Tr2(s_Cstring, c_Cstring)
|
|
|
|
_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 QTemporaryFile_Tr3(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_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 QTemporaryFile_TrUtf82(s string, c string) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_TrUtf82(s_Cstring, c_Cstring)
|
|
|
|
_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 QTemporaryFile_TrUtf83(s string, c string, n int) string {
|
|
|
|
s_Cstring := C.CString(s)
|
|
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
|
|
c_Cstring := C.CString(c)
|
|
|
|
defer C.free(unsafe.Pointer(c_Cstring))
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QTemporaryFile_TrUtf83(s_Cstring, c_Cstring, (C.int)(n))
|
|
|
|
_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
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QTemporaryFile) Delete() {
|
|
|
|
C.QTemporaryFile_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 *QTemporaryFile) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QTemporaryFile) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|