mirror of
https://github.com/mappu/miqt.git
synced 2024-12-22 17:08:38 +00:00
289 lines
9.3 KiB
Go
289 lines
9.3 KiB
Go
|
package network
|
||
|
|
||
|
/*
|
||
|
|
||
|
#include "gen_qabstractnetworkcache.h"
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
*/
|
||
|
import "C"
|
||
|
|
||
|
import (
|
||
|
"github.com/mappu/miqt/qt6"
|
||
|
"runtime"
|
||
|
"unsafe"
|
||
|
)
|
||
|
|
||
|
type QNetworkCacheMetaData struct {
|
||
|
h *C.QNetworkCacheMetaData
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) cPointer() *C.QNetworkCacheMetaData {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) UnsafePointer() unsafe.Pointer {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return unsafe.Pointer(this.h)
|
||
|
}
|
||
|
|
||
|
func newQNetworkCacheMetaData(h *C.QNetworkCacheMetaData) *QNetworkCacheMetaData {
|
||
|
if h == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return &QNetworkCacheMetaData{h: h}
|
||
|
}
|
||
|
|
||
|
func UnsafeNewQNetworkCacheMetaData(h unsafe.Pointer) *QNetworkCacheMetaData {
|
||
|
return newQNetworkCacheMetaData((*C.QNetworkCacheMetaData)(h))
|
||
|
}
|
||
|
|
||
|
// NewQNetworkCacheMetaData constructs a new QNetworkCacheMetaData object.
|
||
|
func NewQNetworkCacheMetaData() *QNetworkCacheMetaData {
|
||
|
ret := C.QNetworkCacheMetaData_new()
|
||
|
return newQNetworkCacheMetaData(ret)
|
||
|
}
|
||
|
|
||
|
// NewQNetworkCacheMetaData2 constructs a new QNetworkCacheMetaData object.
|
||
|
func NewQNetworkCacheMetaData2(other *QNetworkCacheMetaData) *QNetworkCacheMetaData {
|
||
|
ret := C.QNetworkCacheMetaData_new2(other.cPointer())
|
||
|
return newQNetworkCacheMetaData(ret)
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) OperatorAssign(other *QNetworkCacheMetaData) {
|
||
|
C.QNetworkCacheMetaData_OperatorAssign(this.h, other.cPointer())
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) Swap(other *QNetworkCacheMetaData) {
|
||
|
C.QNetworkCacheMetaData_Swap(this.h, other.cPointer())
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) OperatorEqual(other *QNetworkCacheMetaData) bool {
|
||
|
return (bool)(C.QNetworkCacheMetaData_OperatorEqual(this.h, other.cPointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) OperatorNotEqual(other *QNetworkCacheMetaData) bool {
|
||
|
return (bool)(C.QNetworkCacheMetaData_OperatorNotEqual(this.h, other.cPointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) IsValid() bool {
|
||
|
return (bool)(C.QNetworkCacheMetaData_IsValid(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) Url() *qt6.QUrl {
|
||
|
_ret := C.QNetworkCacheMetaData_Url(this.h)
|
||
|
_goptr := qt6.UnsafeNewQUrl(unsafe.Pointer(_ret))
|
||
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||
|
return _goptr
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SetUrl(url *qt6.QUrl) {
|
||
|
C.QNetworkCacheMetaData_SetUrl(this.h, (*C.QUrl)(url.UnsafePointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) LastModified() *qt6.QDateTime {
|
||
|
_ret := C.QNetworkCacheMetaData_LastModified(this.h)
|
||
|
_goptr := qt6.UnsafeNewQDateTime(unsafe.Pointer(_ret))
|
||
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||
|
return _goptr
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SetLastModified(dateTime *qt6.QDateTime) {
|
||
|
C.QNetworkCacheMetaData_SetLastModified(this.h, (*C.QDateTime)(dateTime.UnsafePointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) ExpirationDate() *qt6.QDateTime {
|
||
|
_ret := C.QNetworkCacheMetaData_ExpirationDate(this.h)
|
||
|
_goptr := qt6.UnsafeNewQDateTime(unsafe.Pointer(_ret))
|
||
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||
|
return _goptr
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SetExpirationDate(dateTime *qt6.QDateTime) {
|
||
|
C.QNetworkCacheMetaData_SetExpirationDate(this.h, (*C.QDateTime)(dateTime.UnsafePointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SaveToDisk() bool {
|
||
|
return (bool)(C.QNetworkCacheMetaData_SaveToDisk(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SetSaveToDisk(allow bool) {
|
||
|
C.QNetworkCacheMetaData_SetSaveToDisk(this.h, (C.bool)(allow))
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) Attributes() map[QNetworkRequest__Attribute]qt6.QVariant {
|
||
|
var _mm C.struct_miqt_map = C.QNetworkCacheMetaData_Attributes(this.h)
|
||
|
_ret := make(map[QNetworkRequest__Attribute]qt6.QVariant, int(_mm.len))
|
||
|
_Keys := (*[0xffff]C.int)(unsafe.Pointer(_mm.keys))
|
||
|
_Values := (*[0xffff]*C.QVariant)(unsafe.Pointer(_mm.values))
|
||
|
for i := 0; i < int(_mm.len); i++ {
|
||
|
_entry_Key := (QNetworkRequest__Attribute)(_Keys[i])
|
||
|
|
||
|
_hashval_ret := _Values[i]
|
||
|
_hashval_goptr := qt6.UnsafeNewQVariant(unsafe.Pointer(_hashval_ret))
|
||
|
_hashval_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||
|
_entry_Value := *_hashval_goptr
|
||
|
|
||
|
_ret[_entry_Key] = _entry_Value
|
||
|
}
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func (this *QNetworkCacheMetaData) SetAttributes(attributes map[QNetworkRequest__Attribute]qt6.QVariant) {
|
||
|
attributes_Keys_CArray := (*[0xffff]C.int)(C.malloc(C.size_t(8 * len(attributes))))
|
||
|
defer C.free(unsafe.Pointer(attributes_Keys_CArray))
|
||
|
attributes_Values_CArray := (*[0xffff]*C.QVariant)(C.malloc(C.size_t(8 * len(attributes))))
|
||
|
defer C.free(unsafe.Pointer(attributes_Values_CArray))
|
||
|
attributes_ctr := 0
|
||
|
for attributes_k, attributes_v := range attributes {
|
||
|
attributes_Keys_CArray[attributes_ctr] = (C.int)(attributes_k)
|
||
|
attributes_Values_CArray[attributes_ctr] = (*C.QVariant)(attributes_v.UnsafePointer())
|
||
|
attributes_ctr++
|
||
|
}
|
||
|
attributes_mm := C.struct_miqt_map{
|
||
|
len: C.size_t(len(attributes)),
|
||
|
keys: unsafe.Pointer(attributes_Keys_CArray),
|
||
|
values: unsafe.Pointer(attributes_Values_CArray),
|
||
|
}
|
||
|
C.QNetworkCacheMetaData_SetAttributes(this.h, attributes_mm)
|
||
|
}
|
||
|
|
||
|
// Delete this object from C++ memory.
|
||
|
func (this *QNetworkCacheMetaData) Delete() {
|
||
|
C.QNetworkCacheMetaData_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 *QNetworkCacheMetaData) GoGC() {
|
||
|
runtime.SetFinalizer(this, func(this *QNetworkCacheMetaData) {
|
||
|
this.Delete()
|
||
|
runtime.KeepAlive(this.h)
|
||
|
})
|
||
|
}
|
||
|
|
||
|
type QAbstractNetworkCache struct {
|
||
|
h *C.QAbstractNetworkCache
|
||
|
*qt6.QObject
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) cPointer() *C.QAbstractNetworkCache {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return this.h
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) UnsafePointer() unsafe.Pointer {
|
||
|
if this == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return unsafe.Pointer(this.h)
|
||
|
}
|
||
|
|
||
|
func newQAbstractNetworkCache(h *C.QAbstractNetworkCache) *QAbstractNetworkCache {
|
||
|
if h == nil {
|
||
|
return nil
|
||
|
}
|
||
|
return &QAbstractNetworkCache{h: h, QObject: qt6.UnsafeNewQObject(unsafe.Pointer(h))}
|
||
|
}
|
||
|
|
||
|
func UnsafeNewQAbstractNetworkCache(h unsafe.Pointer) *QAbstractNetworkCache {
|
||
|
return newQAbstractNetworkCache((*C.QAbstractNetworkCache)(h))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) MetaObject() *qt6.QMetaObject {
|
||
|
return qt6.UnsafeNewQMetaObject(unsafe.Pointer(C.QAbstractNetworkCache_MetaObject(this.h)))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Metacast(param1 string) unsafe.Pointer {
|
||
|
param1_Cstring := C.CString(param1)
|
||
|
defer C.free(unsafe.Pointer(param1_Cstring))
|
||
|
return (unsafe.Pointer)(C.QAbstractNetworkCache_Metacast(this.h, param1_Cstring))
|
||
|
}
|
||
|
|
||
|
func QAbstractNetworkCache_Tr(s string) string {
|
||
|
s_Cstring := C.CString(s)
|
||
|
defer C.free(unsafe.Pointer(s_Cstring))
|
||
|
var _ms C.struct_miqt_string = C.QAbstractNetworkCache_Tr(s_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) MetaData(url *qt6.QUrl) *QNetworkCacheMetaData {
|
||
|
_ret := C.QAbstractNetworkCache_MetaData(this.h, (*C.QUrl)(url.UnsafePointer()))
|
||
|
_goptr := newQNetworkCacheMetaData(_ret)
|
||
|
_goptr.GoGC() // Qt uses pass-by-value semantics for this type. Mimic with finalizer
|
||
|
return _goptr
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) UpdateMetaData(metaData *QNetworkCacheMetaData) {
|
||
|
C.QAbstractNetworkCache_UpdateMetaData(this.h, metaData.cPointer())
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Data(url *qt6.QUrl) *qt6.QIODevice {
|
||
|
return qt6.UnsafeNewQIODevice(unsafe.Pointer(C.QAbstractNetworkCache_Data(this.h, (*C.QUrl)(url.UnsafePointer()))))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Remove(url *qt6.QUrl) bool {
|
||
|
return (bool)(C.QAbstractNetworkCache_Remove(this.h, (*C.QUrl)(url.UnsafePointer())))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) CacheSize() int64 {
|
||
|
return (int64)(C.QAbstractNetworkCache_CacheSize(this.h))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Prepare(metaData *QNetworkCacheMetaData) *qt6.QIODevice {
|
||
|
return qt6.UnsafeNewQIODevice(unsafe.Pointer(C.QAbstractNetworkCache_Prepare(this.h, metaData.cPointer())))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Insert(device *qt6.QIODevice) {
|
||
|
C.QAbstractNetworkCache_Insert(this.h, (*C.QIODevice)(device.UnsafePointer()))
|
||
|
}
|
||
|
|
||
|
func (this *QAbstractNetworkCache) Clear() {
|
||
|
C.QAbstractNetworkCache_Clear(this.h)
|
||
|
}
|
||
|
|
||
|
func QAbstractNetworkCache_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.QAbstractNetworkCache_Tr2(s_Cstring, c_Cstring)
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
func QAbstractNetworkCache_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.QAbstractNetworkCache_Tr3(s_Cstring, c_Cstring, (C.int)(n))
|
||
|
_ret := C.GoStringN(_ms.data, C.int(int64(_ms.len)))
|
||
|
C.free(unsafe.Pointer(_ms.data))
|
||
|
return _ret
|
||
|
}
|
||
|
|
||
|
// Delete this object from C++ memory.
|
||
|
func (this *QAbstractNetworkCache) Delete() {
|
||
|
C.QAbstractNetworkCache_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 *QAbstractNetworkCache) GoGC() {
|
||
|
runtime.SetFinalizer(this, func(this *QAbstractNetworkCache) {
|
||
|
this.Delete()
|
||
|
runtime.KeepAlive(this.h)
|
||
|
})
|
||
|
}
|