mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
357 lines
9.8 KiB
Go
357 lines
9.8 KiB
Go
package qt
|
|
|
|
/*
|
|
|
|
#include "gen_qfile.h"
|
|
#include <stdlib.h>
|
|
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"runtime"
|
|
"unsafe"
|
|
)
|
|
|
|
type QFile struct {
|
|
h *C.QFile
|
|
*QFileDevice
|
|
}
|
|
|
|
func (this *QFile) cPointer() *C.QFile {
|
|
if this == nil {
|
|
return nil
|
|
}
|
|
return this.h
|
|
}
|
|
|
|
func newQFile(h *C.QFile) *QFile {
|
|
if h == nil {
|
|
return nil
|
|
}
|
|
return &QFile{h: h, QFileDevice: newQFileDevice_U(unsafe.Pointer(h))}
|
|
}
|
|
|
|
func newQFile_U(h unsafe.Pointer) *QFile {
|
|
return newQFile((*C.QFile)(h))
|
|
}
|
|
|
|
// NewQFile constructs a new QFile object.
|
|
func NewQFile() *QFile {
|
|
ret := C.QFile_new()
|
|
return newQFile(ret)
|
|
}
|
|
|
|
// NewQFile2 constructs a new QFile object.
|
|
func NewQFile2(name string) *QFile {
|
|
name_ms := miqt_strdupg(name)
|
|
defer C.free(name_ms)
|
|
ret := C.QFile_new2((*C.struct_miqt_string)(name_ms))
|
|
return newQFile(ret)
|
|
}
|
|
|
|
// NewQFile3 constructs a new QFile object.
|
|
func NewQFile3(parent *QObject) *QFile {
|
|
ret := C.QFile_new3(parent.cPointer())
|
|
return newQFile(ret)
|
|
}
|
|
|
|
// NewQFile4 constructs a new QFile object.
|
|
func NewQFile4(name string, parent *QObject) *QFile {
|
|
name_ms := miqt_strdupg(name)
|
|
defer C.free(name_ms)
|
|
ret := C.QFile_new4((*C.struct_miqt_string)(name_ms), parent.cPointer())
|
|
return newQFile(ret)
|
|
}
|
|
|
|
func (this *QFile) MetaObject() *QMetaObject {
|
|
_ret := C.QFile_MetaObject(this.h)
|
|
return newQMetaObject_U(unsafe.Pointer(_ret))
|
|
}
|
|
|
|
func QFile_Tr(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QFile_Tr(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_TrUtf8(s string) string {
|
|
s_Cstring := C.CString(s)
|
|
defer C.free(unsafe.Pointer(s_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QFile_TrUtf8(s_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QFile) FileName() string {
|
|
var _ms *C.struct_miqt_string = C.QFile_FileName(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QFile) SetFileName(name string) {
|
|
name_ms := miqt_strdupg(name)
|
|
defer C.free(name_ms)
|
|
C.QFile_SetFileName(this.h, (*C.struct_miqt_string)(name_ms))
|
|
}
|
|
|
|
func QFile_EncodeName(fileName string) *QByteArray {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
_ret := C.QFile_EncodeName((*C.struct_miqt_string)(fileName_ms))
|
|
_goptr := newQByteArray(_ret)
|
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
|
return _goptr
|
|
}
|
|
|
|
func QFile_DecodeName(localFileName *QByteArray) string {
|
|
var _ms *C.struct_miqt_string = C.QFile_DecodeName(localFileName.cPointer())
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_DecodeNameWithLocalFileName(localFileName string) string {
|
|
localFileName_Cstring := C.CString(localFileName)
|
|
defer C.free(unsafe.Pointer(localFileName_Cstring))
|
|
var _ms *C.struct_miqt_string = C.QFile_DecodeNameWithLocalFileName(localFileName_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QFile) Exists() bool {
|
|
_ret := C.QFile_Exists(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_ExistsWithFileName(fileName string) bool {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
_ret := C.QFile_ExistsWithFileName((*C.struct_miqt_string)(fileName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) ReadLink() string {
|
|
var _ms *C.struct_miqt_string = C.QFile_ReadLink(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_ReadLinkWithFileName(fileName string) string {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
var _ms *C.struct_miqt_string = C.QFile_ReadLinkWithFileName((*C.struct_miqt_string)(fileName_ms))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QFile) SymLinkTarget() string {
|
|
var _ms *C.struct_miqt_string = C.QFile_SymLinkTarget(this.h)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_SymLinkTargetWithFileName(fileName string) string {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
var _ms *C.struct_miqt_string = C.QFile_SymLinkTargetWithFileName((*C.struct_miqt_string)(fileName_ms))
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func (this *QFile) Remove() bool {
|
|
_ret := C.QFile_Remove(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_RemoveWithFileName(fileName string) bool {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
_ret := C.QFile_RemoveWithFileName((*C.struct_miqt_string)(fileName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) MoveToTrash() bool {
|
|
_ret := C.QFile_MoveToTrash(this.h)
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_MoveToTrashWithFileName(fileName string) bool {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
_ret := C.QFile_MoveToTrashWithFileName((*C.struct_miqt_string)(fileName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Rename(newName string) bool {
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Rename(this.h, (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_Rename2(oldName string, newName string) bool {
|
|
oldName_ms := miqt_strdupg(oldName)
|
|
defer C.free(oldName_ms)
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Rename2((*C.struct_miqt_string)(oldName_ms), (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Link(newName string) bool {
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Link(this.h, (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_Link2(oldname string, newName string) bool {
|
|
oldname_ms := miqt_strdupg(oldname)
|
|
defer C.free(oldname_ms)
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Link2((*C.struct_miqt_string)(oldname_ms), (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Copy(newName string) bool {
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Copy(this.h, (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_Copy2(fileName string, newName string) bool {
|
|
fileName_ms := miqt_strdupg(fileName)
|
|
defer C.free(fileName_ms)
|
|
newName_ms := miqt_strdupg(newName)
|
|
defer C.free(newName_ms)
|
|
_ret := C.QFile_Copy2((*C.struct_miqt_string)(fileName_ms), (*C.struct_miqt_string)(newName_ms))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Open(flags int) bool {
|
|
_ret := C.QFile_Open(this.h, (C.int)(flags))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Open3(fd int, ioFlags int) bool {
|
|
_ret := C.QFile_Open3(this.h, (C.int)(fd), (C.int)(ioFlags))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Size() int64 {
|
|
_ret := C.QFile_Size(this.h)
|
|
return (int64)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Resize(sz int64) bool {
|
|
_ret := C.QFile_Resize(this.h, (C.longlong)(sz))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_Resize2(filename string, sz int64) bool {
|
|
filename_ms := miqt_strdupg(filename)
|
|
defer C.free(filename_ms)
|
|
_ret := C.QFile_Resize2((*C.struct_miqt_string)(filename_ms), (C.longlong)(sz))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func (this *QFile) Permissions() int {
|
|
_ret := C.QFile_Permissions(this.h)
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func QFile_PermissionsWithFilename(filename string) int {
|
|
filename_ms := miqt_strdupg(filename)
|
|
defer C.free(filename_ms)
|
|
_ret := C.QFile_PermissionsWithFilename((*C.struct_miqt_string)(filename_ms))
|
|
return (int)(_ret)
|
|
}
|
|
|
|
func (this *QFile) SetPermissions(permissionSpec int) bool {
|
|
_ret := C.QFile_SetPermissions(this.h, (C.int)(permissionSpec))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_SetPermissions2(filename string, permissionSpec int) bool {
|
|
filename_ms := miqt_strdupg(filename)
|
|
defer C.free(filename_ms)
|
|
_ret := C.QFile_SetPermissions2((*C.struct_miqt_string)(filename_ms), (C.int)(permissionSpec))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
func QFile_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))
|
|
var _ms *C.struct_miqt_string = C.QFile_Tr2(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_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))
|
|
var _ms *C.struct_miqt_string = C.QFile_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
|
|
}
|
|
|
|
func QFile_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))
|
|
var _ms *C.struct_miqt_string = C.QFile_TrUtf82(s_Cstring, c_Cstring)
|
|
_ret := C.GoStringN(&_ms.data, C.int(int64(_ms.len)))
|
|
C.free(unsafe.Pointer(_ms))
|
|
return _ret
|
|
}
|
|
|
|
func QFile_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))
|
|
var _ms *C.struct_miqt_string = C.QFile_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
|
|
}
|
|
|
|
func (this *QFile) Open33(fd int, ioFlags int, handleFlags int) bool {
|
|
_ret := C.QFile_Open33(this.h, (C.int)(fd), (C.int)(ioFlags), (C.int)(handleFlags))
|
|
return (bool)(_ret)
|
|
}
|
|
|
|
// Delete this object from C++ memory.
|
|
func (this *QFile) Delete() {
|
|
C.QFile_Delete(this.h)
|
|
}
|
|
|
|
// 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 *QFile) GoGC() {
|
|
runtime.SetFinalizer(this, func(this *QFile) {
|
|
this.Delete()
|
|
runtime.KeepAlive(this.h)
|
|
})
|
|
}
|