2024-08-25 04:08:24 +00:00
|
|
|
package qt
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
#include "gen_qdiriterator.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
|
|
|
import (
|
|
|
|
"runtime"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
2024-09-04 06:54:22 +00:00
|
|
|
type QDirIterator__IteratorFlag int
|
|
|
|
|
|
|
|
const (
|
2024-09-20 07:13:26 +00:00
|
|
|
QDirIterator__NoIteratorFlags QDirIterator__IteratorFlag = 0
|
|
|
|
QDirIterator__FollowSymlinks QDirIterator__IteratorFlag = 1
|
|
|
|
QDirIterator__Subdirectories QDirIterator__IteratorFlag = 2
|
2024-09-04 06:54:22 +00:00
|
|
|
)
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
type QDirIterator struct {
|
|
|
|
h *C.QDirIterator
|
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDirIterator) cPointer() *C.QDirIterator {
|
|
|
|
if this == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
return this.h
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDirIterator(h *C.QDirIterator) *QDirIterator {
|
2024-09-01 02:23:55 +00:00
|
|
|
if h == nil {
|
|
|
|
return nil
|
|
|
|
}
|
2024-08-25 04:08:24 +00:00
|
|
|
return &QDirIterator{h: h}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newQDirIterator_U(h unsafe.Pointer) *QDirIterator {
|
|
|
|
return newQDirIterator((*C.QDirIterator)(h))
|
|
|
|
}
|
|
|
|
|
2024-08-29 07:01:51 +00:00
|
|
|
// NewQDirIterator constructs a new QDirIterator object.
|
|
|
|
func NewQDirIterator(dir *QDir) *QDirIterator {
|
|
|
|
ret := C.QDirIterator_new(dir.cPointer())
|
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator2 constructs a new QDirIterator object.
|
|
|
|
func NewQDirIterator2(path string) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
|
|
|
ret := C.QDirIterator_new2((*C.struct_miqt_string)(path_ms))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator3 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator3(path string, filter QDir__Filter) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new3((*C.struct_miqt_string)(path_ms), (C.int)(filter))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator4 constructs a new QDirIterator object.
|
|
|
|
func NewQDirIterator4(path string, nameFilters []string) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(nameFilters))))
|
2024-08-29 07:01:51 +00:00
|
|
|
defer C.free(unsafe.Pointer(nameFilters_CArray))
|
|
|
|
for i := range nameFilters {
|
2024-09-17 07:30:27 +00:00
|
|
|
nameFilters_i_ms := miqt_strdupg(nameFilters[i])
|
|
|
|
defer C.free(nameFilters_i_ms)
|
|
|
|
nameFilters_CArray[i] = (*C.struct_miqt_string)(nameFilters_i_ms)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_ma := &C.struct_miqt_array{len: C.size_t(len(nameFilters)), data: unsafe.Pointer(nameFilters_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(nameFilters_ma))
|
|
|
|
ret := C.QDirIterator_new4((*C.struct_miqt_string)(path_ms), nameFilters_ma)
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator5 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator5(dir *QDir, flags QDirIterator__IteratorFlag) *QDirIterator {
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new5(dir.cPointer(), (C.int)(flags))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator6 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator6(path string, flags QDirIterator__IteratorFlag) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new6((*C.struct_miqt_string)(path_ms), (C.int)(flags))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator7 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator7(path string, filter QDir__Filter, flags QDirIterator__IteratorFlag) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new7((*C.struct_miqt_string)(path_ms), (C.int)(filter), (C.int)(flags))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator8 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator8(path string, nameFilters []string, filters QDir__Filter) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(nameFilters))))
|
2024-08-29 07:01:51 +00:00
|
|
|
defer C.free(unsafe.Pointer(nameFilters_CArray))
|
|
|
|
for i := range nameFilters {
|
2024-09-17 07:30:27 +00:00
|
|
|
nameFilters_i_ms := miqt_strdupg(nameFilters[i])
|
|
|
|
defer C.free(nameFilters_i_ms)
|
|
|
|
nameFilters_CArray[i] = (*C.struct_miqt_string)(nameFilters_i_ms)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_ma := &C.struct_miqt_array{len: C.size_t(len(nameFilters)), data: unsafe.Pointer(nameFilters_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(nameFilters_ma))
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new8((*C.struct_miqt_string)(path_ms), nameFilters_ma, (C.int)(filters))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewQDirIterator9 constructs a new QDirIterator object.
|
2024-09-20 06:40:03 +00:00
|
|
|
func NewQDirIterator9(path string, nameFilters []string, filters QDir__Filter, flags QDirIterator__IteratorFlag) *QDirIterator {
|
2024-09-14 22:29:05 +00:00
|
|
|
path_ms := miqt_strdupg(path)
|
|
|
|
defer C.free(path_ms)
|
2024-09-17 07:30:27 +00:00
|
|
|
// For the C ABI, malloc a C array of raw pointers
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_CArray := (*[0xffff]*C.struct_miqt_string)(C.malloc(C.size_t(8 * len(nameFilters))))
|
2024-08-29 07:01:51 +00:00
|
|
|
defer C.free(unsafe.Pointer(nameFilters_CArray))
|
|
|
|
for i := range nameFilters {
|
2024-09-17 07:30:27 +00:00
|
|
|
nameFilters_i_ms := miqt_strdupg(nameFilters[i])
|
|
|
|
defer C.free(nameFilters_i_ms)
|
|
|
|
nameFilters_CArray[i] = (*C.struct_miqt_string)(nameFilters_i_ms)
|
2024-08-29 07:01:51 +00:00
|
|
|
}
|
2024-09-14 22:29:05 +00:00
|
|
|
nameFilters_ma := &C.struct_miqt_array{len: C.size_t(len(nameFilters)), data: unsafe.Pointer(nameFilters_CArray)}
|
|
|
|
defer runtime.KeepAlive(unsafe.Pointer(nameFilters_ma))
|
2024-09-18 01:33:50 +00:00
|
|
|
ret := C.QDirIterator_new9((*C.struct_miqt_string)(path_ms), nameFilters_ma, (C.int)(filters), (C.int)(flags))
|
2024-08-29 07:01:51 +00:00
|
|
|
return newQDirIterator(ret)
|
|
|
|
}
|
|
|
|
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QDirIterator) Next() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDirIterator_Next(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 *QDirIterator) HasNext() bool {
|
2024-09-17 07:30:27 +00:00
|
|
|
return (bool)(C.QDirIterator_HasNext(this.h))
|
2024-08-25 04:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (this *QDirIterator) FileName() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDirIterator_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 *QDirIterator) FilePath() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDirIterator_FilePath(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 *QDirIterator) FileInfo() *QFileInfo {
|
2024-09-14 22:29:05 +00:00
|
|
|
_ret := C.QDirIterator_FileInfo(this.h)
|
|
|
|
_goptr := newQFileInfo(_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 *QDirIterator) Path() string {
|
2024-09-14 22:29:05 +00:00
|
|
|
var _ms *C.struct_miqt_string = C.QDirIterator_Path(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
|
|
|
}
|
|
|
|
|
2024-09-14 22:29:05 +00:00
|
|
|
// Delete this object from C++ memory.
|
2024-08-25 04:08:24 +00:00
|
|
|
func (this *QDirIterator) Delete() {
|
|
|
|
C.QDirIterator_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 *QDirIterator) GoGC() {
|
|
|
|
runtime.SetFinalizer(this, func(this *QDirIterator) {
|
|
|
|
this.Delete()
|
|
|
|
runtime.KeepAlive(this.h)
|
|
|
|
})
|
|
|
|
}
|