miqt/qt/network/gen_qsslpresharedkeyauthenticator.go
2024-11-06 18:39:26 +13:00

121 lines
4.0 KiB
Go

package network
/*
#include "gen_qsslpresharedkeyauthenticator.h"
#include <stdlib.h>
*/
import "C"
import (
"runtime"
"unsafe"
)
type QSslPreSharedKeyAuthenticator struct {
h *C.QSslPreSharedKeyAuthenticator
}
func (this *QSslPreSharedKeyAuthenticator) cPointer() *C.QSslPreSharedKeyAuthenticator {
if this == nil {
return nil
}
return this.h
}
func (this *QSslPreSharedKeyAuthenticator) UnsafePointer() unsafe.Pointer {
if this == nil {
return nil
}
return unsafe.Pointer(this.h)
}
func newQSslPreSharedKeyAuthenticator(h *C.QSslPreSharedKeyAuthenticator) *QSslPreSharedKeyAuthenticator {
if h == nil {
return nil
}
return &QSslPreSharedKeyAuthenticator{h: h}
}
func UnsafeNewQSslPreSharedKeyAuthenticator(h unsafe.Pointer) *QSslPreSharedKeyAuthenticator {
return newQSslPreSharedKeyAuthenticator((*C.QSslPreSharedKeyAuthenticator)(h))
}
// NewQSslPreSharedKeyAuthenticator constructs a new QSslPreSharedKeyAuthenticator object.
func NewQSslPreSharedKeyAuthenticator() *QSslPreSharedKeyAuthenticator {
ret := C.QSslPreSharedKeyAuthenticator_new()
return newQSslPreSharedKeyAuthenticator(ret)
}
// NewQSslPreSharedKeyAuthenticator2 constructs a new QSslPreSharedKeyAuthenticator object.
func NewQSslPreSharedKeyAuthenticator2(authenticator *QSslPreSharedKeyAuthenticator) *QSslPreSharedKeyAuthenticator {
ret := C.QSslPreSharedKeyAuthenticator_new2(authenticator.cPointer())
return newQSslPreSharedKeyAuthenticator(ret)
}
func (this *QSslPreSharedKeyAuthenticator) OperatorAssign(authenticator *QSslPreSharedKeyAuthenticator) {
C.QSslPreSharedKeyAuthenticator_OperatorAssign(this.h, authenticator.cPointer())
}
func (this *QSslPreSharedKeyAuthenticator) Swap(other *QSslPreSharedKeyAuthenticator) {
C.QSslPreSharedKeyAuthenticator_Swap(this.h, other.cPointer())
}
func (this *QSslPreSharedKeyAuthenticator) IdentityHint() []byte {
var _bytearray C.struct_miqt_string = C.QSslPreSharedKeyAuthenticator_IdentityHint(this.h)
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
}
func (this *QSslPreSharedKeyAuthenticator) SetIdentity(identity []byte) {
identity_alias := C.struct_miqt_string{}
identity_alias.data = (*C.char)(unsafe.Pointer(&identity[0]))
identity_alias.len = C.size_t(len(identity))
C.QSslPreSharedKeyAuthenticator_SetIdentity(this.h, identity_alias)
}
func (this *QSslPreSharedKeyAuthenticator) Identity() []byte {
var _bytearray C.struct_miqt_string = C.QSslPreSharedKeyAuthenticator_Identity(this.h)
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
}
func (this *QSslPreSharedKeyAuthenticator) MaximumIdentityLength() int {
return (int)(C.QSslPreSharedKeyAuthenticator_MaximumIdentityLength(this.h))
}
func (this *QSslPreSharedKeyAuthenticator) SetPreSharedKey(preSharedKey []byte) {
preSharedKey_alias := C.struct_miqt_string{}
preSharedKey_alias.data = (*C.char)(unsafe.Pointer(&preSharedKey[0]))
preSharedKey_alias.len = C.size_t(len(preSharedKey))
C.QSslPreSharedKeyAuthenticator_SetPreSharedKey(this.h, preSharedKey_alias)
}
func (this *QSslPreSharedKeyAuthenticator) PreSharedKey() []byte {
var _bytearray C.struct_miqt_string = C.QSslPreSharedKeyAuthenticator_PreSharedKey(this.h)
_ret := C.GoBytes(unsafe.Pointer(_bytearray.data), C.int(int64(_bytearray.len)))
C.free(unsafe.Pointer(_bytearray.data))
return _ret
}
func (this *QSslPreSharedKeyAuthenticator) MaximumPreSharedKeyLength() int {
return (int)(C.QSslPreSharedKeyAuthenticator_MaximumPreSharedKeyLength(this.h))
}
// Delete this object from C++ memory.
func (this *QSslPreSharedKeyAuthenticator) Delete() {
C.QSslPreSharedKeyAuthenticator_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 *QSslPreSharedKeyAuthenticator) GoGC() {
runtime.SetFinalizer(this, func(this *QSslPreSharedKeyAuthenticator) {
this.Delete()
runtime.KeepAlive(this.h)
})
}