2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qstorageinfo.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
2024-10-16 05:07:56 +00:00
|
|
|
"github.com/mappu/miqt/libmiqt"
|
2024-08-25 04:08:24 +00:00
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type QStorageInfo struct {
|
|
|
|
h *C.QStorageInfo
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) cPointer() *C.QStorageInfo {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func (this *QStorageInfo) UnsafePointer() unsafe.Pointer {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return unsafe.Pointer(this.h)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func newQStorageInfo(h *C.QStorageInfo) *QStorageInfo {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QStorageInfo{h: h}
|
|
|
|
}
|
|
|
|
|
2024-10-16 05:07:56 +00:00
|
|
|
func UnsafeNewQStorageInfo(h unsafe.Pointer) *QStorageInfo {
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQStorageInfo((*C.QStorageInfo)(h))
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStorageInfo constructs a new QStorageInfo object.
|
|
|
|
func NewQStorageInfo() *QStorageInfo {
|
|
|
|
ret := C.QStorageInfo_new()
|
|
|
|
return newQStorageInfo(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStorageInfo2 constructs a new QStorageInfo object.
|
|
|
|
func NewQStorageInfo2(path string) *QStorageInfo {
|
2024-10-16 05:07:56 +00:00
|
|
|
path_ms := libmiqt.Strdupg(path)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(path_ms)
|
|
|
|
ret := C.QStorageInfo_new2((*C.struct_miqt_string)(path_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
return newQStorageInfo(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStorageInfo3 constructs a new QStorageInfo object.
|
|
|
|
func NewQStorageInfo3(dir *QDir) *QStorageInfo {
|
|
|
|
ret := C.QStorageInfo_new3(dir.cPointer())
|
|
|
|
return newQStorageInfo(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQStorageInfo4 constructs a new QStorageInfo object.
|
|
|
|
func NewQStorageInfo4(other *QStorageInfo) *QStorageInfo {
|
|
|
|
ret := C.QStorageInfo_new4(other.cPointer())
|
|
|
|
return newQStorageInfo(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) OperatorAssign(other *QStorageInfo) {
|
|
|
|
C.QStorageInfo_OperatorAssign(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) Swap(other *QStorageInfo) {
|
|
|
|
C.QStorageInfo_Swap(this.h, other.cPointer())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) SetPath(path string) {
|
2024-10-16 05:07:56 +00:00
|
|
|
path_ms := libmiqt.Strdupg(path)
|
2024-09-14 22:29:05 +00:00
|
|
|
defer C.free(path_ms)
|
|
|
|
C.QStorageInfo_SetPath(this.h, (*C.struct_miqt_string)(path_ms))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) RootPath() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStorageInfo_RootPath(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 *QStorageInfo) Device() *QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QStorageInfo_Device(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 *QStorageInfo) Subvolume() *QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QStorageInfo_Subvolume(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 *QStorageInfo) FileSystemType() *QByteArray {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QStorageInfo_FileSystemType(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 *QStorageInfo) Name() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStorageInfo_Name(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 *QStorageInfo) DisplayName() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QStorageInfo_DisplayName(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 *QStorageInfo) BytesTotal() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QStorageInfo_BytesTotal(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) BytesFree() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QStorageInfo_BytesFree(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) BytesAvailable() int64 {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int64)(C.QStorageInfo_BytesAvailable(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) BlockSize() int {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (int)(C.QStorageInfo_BlockSize(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) IsRoot() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStorageInfo_IsRoot(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) IsReadOnly() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStorageInfo_IsReadOnly(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) IsReady() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStorageInfo_IsReady(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) IsValid() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QStorageInfo_IsValid(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QStorageInfo) Refresh() {
|
|
|
|
C.QStorageInfo_Refresh(this.h)
|
|
|
|
}
|
|
|
|
|
|
|
|
func QStorageInfo_MountedVolumes() []QStorageInfo {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ma *C.struct_miqt_array = C.QStorageInfo_MountedVolumes()
|
|
|
|
_ret := make([]QStorageInfo, int(_ma.len))
|
2024-09-17 07:30:27 +00:00
|
|
|
_outCast := (*[0xffff]*C.QStorageInfo)(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 := newQStorageInfo(_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
|
|
|
}
|
|
|
|
|
|
|
|
func QStorageInfo_Root() *QStorageInfo {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QStorageInfo_Root()
|
|
|
|
_goptr := newQStorageInfo(_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
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QStorageInfo) Delete() {
|
|
|
|
C.QStorageInfo_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 *QStorageInfo) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QStorageInfo) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|