qtrt

package
v0.0.0-...-1f663c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2020 License: LGPL-3.0 Imports: 18 Imported by: 42

Documentation

Index

Constants

View Source
const (
	FFI_TYPE_VOID       = byte(C.FFI_TYPE_VOID)
	FFI_TYPE_INT        = byte(C.FFI_TYPE_INT)
	FFI_TYPE_FLOAT      = byte(C.FFI_TYPE_FLOAT)
	FFI_TYPE_DOUBLE     = byte(C.FFI_TYPE_DOUBLE)
	FFI_TYPE_LONGDOUBLE = byte(C.FFI_TYPE_LONGDOUBLE)
	FFI_TYPE_UINT8      = byte(C.FFI_TYPE_UINT8)
	FFI_TYPE_SINT8      = byte(C.FFI_TYPE_SINT8)
	FFI_TYPE_UINT16     = byte(C.FFI_TYPE_UINT16)
	FFI_TYPE_SINT16     = byte(C.FFI_TYPE_SINT16)
	FFI_TYPE_UINT32     = byte(C.FFI_TYPE_UINT32)
	FFI_TYPE_SINT32     = byte(C.FFI_TYPE_SINT32)
	FFI_TYPE_UINT64     = byte(C.FFI_TYPE_UINT64)
	FFI_TYPE_SINT64     = byte(C.FFI_TYPE_SINT64)
	FFI_TYPE_STRUCT     = byte(C.FFI_TYPE_STRUCT)
	FFI_TYPE_POINTER    = byte(C.FFI_TYPE_POINTER)
)
View Source
const DtorCthisName = "DtorCthis"
View Source
const GetCthisName = "GetCthis"

some fixed internal names

View Source
const NewCthisName = "NewCthis"
View Source
const SetCthisName = "SetCthis"
View Source
const SetInitStObjName = "C_%s_init_staticMetaObject"

Variables

View Source
var Assert = miscutil.Assert
View Source
var DebugFinalize bool = false

/////////

View Source
var ErrPrint = miscutil.ErrPrint
View Source
var FileExist = miscutil.FileExist
View Source
var FinalizeProxyFn = func(f func()) { f() } //
View Source
var Float32Ty = reflect.TypeOf(float32(0))
View Source
var Float64Ty = reflect.TypeOf(float64(0))
View Source
var IfElse = miscutil.IfElse
View Source
var IfElseInt = miscutil.IfElseInt
View Source
var IfElseStr = miscutil.IfElseStr
View Source
var IntTy = reflect.TypeOf(int(0))
View Source
var NilPrint = miscutil.NilPrint
View Source
var Uint64Ty = reflect.TypeOf(uint64(0))
View Source
var Uint8Ty = reflect.TypeOf(uint8(0))
View Source
var UseCppSymbols bool = false

直接使用C++ symbols

View Source
var UseWrapSymbols bool = true // see also qtrt.UseCppSymbols TODO merge

直接使用封装的C++ symbols。好像在这设置没有用啊,符号不同,因为参数表的处理也不同,还是要改生成的调用代码。

Functions

func BoolTy

func BoolTy(pointer bool) reflect.Type

func Byte2Charp

func Byte2Charp(a0 interface{}) *C.uchar

func ByteTy

func ByteTy(pointer bool) reflect.Type

func CBool2Go

func CBool2Go(b int) bool

func CCharPPToStringSlice

func CCharPPToStringSlice(charpp unsafe.Pointer) []string

func CFree

func CFree(p unsafe.Pointer)

func CString

func CString(s string) unsafe.Pointer

func CallbackAllInherits

func CallbackAllInherits(cbobj unsafe.Pointer, name string, args ...interface{}) interface{}

depcreated 在go中的projected继承代理方法调用

func Calloc

func Calloc(n int, sz int) unsafe.Pointer

func Cmemcmp

func Cmemcmp(p1, p2 unsafe.Pointer, sz int) int

func Cmemset

func Cmemset(p unsafe.Pointer, c int, n int)

func Connect

func Connect(cobj CObjectITF, signame string, f interface{})

可以是signal的完整函数原型,也可以是名字

func ConnectDestroyed

func ConnectDestroyed(senderCobj CObjectITF, className string)

func ConnectRaw

func ConnectRaw(sender unsafe.Pointer, signal string, receiver unsafe.Pointer, member string)

func ConnectSignal

func ConnectSignal(sender CObjectITF, signal string, receiver CObjectITF, member string)

or direct use qtcore.QObject_Connect only for support signal to signal

func ConnectSlot

func ConnectSlot(sender CObjectITF, signal string, receiver CObjectITF, member string)

quickly connect an object's signal to another object's slot

func ConnectSwitch

func ConnectSwitch(src unsafe.Pointer, signame string, on bool, cobj CObjectITF)

可以是signal的完整函数原型,也可以是名字

func Cpretval2go

func Cpretval2go(ty string, rv uint64) interface{}

func Cretval2go

func Cretval2go(ty string, rv uint64) interface{}

func DeleteQDynSlotObject

func DeleteQDynSlotObject(o *QDynSlotObject)

func DerefPtr2

func DerefPtr2(ptr2 unsafe.Pointer) unsafe.Pointer

func Disconnect

func Disconnect(cobj CObjectITF, signame string)

TODO

func DisconnectAll

func DisconnectAll(cobj CObjectITF)

the same as QObject.Disconnect_2_()

func Double2Double

func Double2Double(a0 interface{}) **C.double

func DoubleTy

func DoubleTy(pointer bool) reflect.Type

func ErrorResolve

func ErrorResolve(class, method string, args []interface{})

func FillDefaultValues

func FillDefaultValues(args []interface{}, dvals []interface{}) []interface{}

func Float2Float

func Float2Float(a0 interface{}) **C.float

func Float32AsInt

func Float32AsInt(n float32) (rv uint64)

func Float64AsInt

func Float64AsInt(n float64) (rv uint64)

把浮点数存储在uint64中。注意这不是强制类型转换,是原样存储,不丢失精度

func FloatTy

func FloatTy(pointer bool) reflect.Type

func FreeMem

func FreeMem(p unsafe.Pointer)

func FreeMemI

func FreeMemI(p uint64)

func GetClassEnumItemName

func GetClassEnumItemName(this interface{}, val int) string

must call in func (this *XObject) XEnumItemName() 1. QObject subclass 2. non-QObject class

func GetClassStaticMetaObjectByName

func GetClassStaticMetaObjectByName(clsname string) unsafe.Pointer

func GetCthis

func GetCthis(obj interface{}) unsafe.Pointer

func GetCtorAllocStack

func GetCtorAllocStack(clsname string) []uintptr

func GetQtSymAddr

func GetQtSymAddr(symname string) unsafe.Pointer

func GetQtSymAddrRaw

func GetQtSymAddrRaw(symname string) unsafe.Pointer

func GetQtclassName

func GetQtclassName(tystr string) string

func GoBool2C

func GoBool2C(b bool) int

func GoString

func GoString(p unsafe.Pointer) string

func GoStringI

func GoStringI(p uint64) string

func GoStringIN

func GoStringIN(p uint64, n int) string

func GoStringN

func GoStringN(p unsafe.Pointer, n int) string

func HandyConvert2c

func HandyConvert2c(fv interface{}, to reflect.Type) (retv interface{}, free bool)

func HandyConvert2go

func HandyConvert2go(fvi interface{}, to reflect.Type) (reti interface{})

func Int16Ty

func Int16Ty(pointer bool) reflect.Type

func Int32Ty

func Int32Ty(pointer bool) reflect.Type

func Int64Ty

func Int64Ty(pointer bool) reflect.Type

func IntAsFloat32

func IntAsFloat32(v uint64) (n float32)

func IntAsFloat64

func IntAsFloat64(v uint64) (n float64)

func InvokeQtFuncByName

func InvokeQtFuncByName(symname string, args []uint64, types []int) uint64

func IsQtclass

func IsQtclass(tystr string) bool

func KeepMe

func KeepMe()

func Malloc

func Malloc(sz int) unsafe.Pointer

func PrimConv

func PrimConv(fvi interface{}, to reflect.Type) (reti interface{})

for argument of primitive type

func QMETHOD

func QMETHOD(mthName string) string

see qobjectdefs.h:263

func QObjectGetSignatureByName

func QObjectGetSignatureByName(qobj CObjectITF, name string) (string, error)

这个可以简化connect时的书写。仅在只有一个同名的情况下适用。

func QSIGNAL

func QSIGNAL(sigName string) string

func QSLOT

func QSLOT(slotName string) string

func ReleaseOwnerToQt

func ReleaseOwnerToQt(obj interface{})

func Rune2WCharp

func Rune2WCharp(a0 interface{}) *C.wchar_t

func RuneTy

func RuneTy(pointer bool) reflect.Type

func SetAllInheritCallback

func SetAllInheritCallback(cbobj CObjectITF, name string, f interface{})

func SetDebugAllinheritsFilterFunc

func SetDebugAllinheritsFilterFunc(f func(name string) bool)

func SetDebugDynSlot

func SetDebugDynSlot(on bool)

func SetDebugFFICall

func SetDebugFFICall(on bool)

func SetFinalizer

func SetFinalizer(obj interface{}, finalizer interface{})

func SetFinalizerObjectFilter

func SetFinalizerObjectFilter(f func(reflect.Value) bool)

func SetInheritCallback2c

func SetInheritCallback2c(name string, fnptr unsafe.Pointer)

depcreated

func StringSliceToCCharPP

func StringSliceToCCharPP(ss []string) unsafe.Pointer

func StringTy

func StringTy(pointer bool) reflect.Type

func SymbolResolve

func SymbolResolve(args []interface{}, vtys map[uint8]map[uint8]reflect.Type) int32

类似C++的overload name resolve

func UInt16Ty

func UInt16Ty(pointer bool) reflect.Type

func UInt32Ty

func UInt32Ty(pointer bool) reflect.Type

func UInt64Ty

func UInt64Ty(pointer bool) reflect.Type

func UNQMETHOD

func UNQMETHOD(mthName string) string

func UNQSIGNAL

func UNQSIGNAL(sigName string) string

func UNQSLOT

func UNQSLOT(slotName string) string

func UniverseFree

func UniverseFree(this interface{})

/////// runtime.SetFinalizer(x, UniverseFree)

func UnsetAllInheritCallback

func UnsetAllInheritCallback(cbobj CObjectITF, name string)

func UnsetAllInheritCallbackAll

func UnsetAllInheritCallbackAll(cbobj CObjectITF)

func UnsetFinalizer

func UnsetFinalizer(obj interface{})

func VoidpTy

func VoidpTy() reflect.Type

Types

type CObject

type CObject struct {
	Cthis unsafe.Pointer
}

所有的Qt绑定类必须继承自这个

func (*CObject) GetCthis_

func (this *CObject) GetCthis_() unsafe.Pointer

type CObjectITF

type CObjectITF interface {
	GetCthis() unsafe.Pointer
	SetCthis(unsafe.Pointer)
}

type FFILibrary

type FFILibrary struct {
	// contains filtered or unexported fields
}

Library is a dl-opened library holding the corresponding dl.Handle

func NewFFILibrary

func NewFFILibrary(libname string) (lib FFILibrary, err error)

NewFFILibrary takes the library filename and returns a handle towards it.

func (FFILibrary) Close

func (lib FFILibrary) Close() error

func (FFILibrary) Name

func (lib FFILibrary) Name() string

func (FFILibrary) Symbol

func (lib FFILibrary) Symbol(fctname string) (unsafe.Pointer, error)

type GetCthiser

type GetCthiser interface {
	GetCthis() unsafe.Pointer
}

type QDynSlotObject

type QDynSlotObject struct {
	// contains filtered or unexported fields
}

usage: ffiqt.Connect() 也许放在qtrt包中更好,但在测试时放在了ffiqt包中,暂时放在这

func NewQDynSlotObject

func NewQDynSlotObject(signalName string, argc int) *QDynSlotObject

func (*QDynSlotObject) Connect_test

func (this *QDynSlotObject) Connect_test(to *QDynSlotObject)

test

func (*QDynSlotObject) GetCthis

func (this *QDynSlotObject) GetCthis() unsafe.Pointer

func (*QDynSlotObject) Trigger_test

func (this *QDynSlotObject) Trigger_test()

type VRetype

type VRetype = uint64 // interface{}

//////

func ForwardFFIFunc

func ForwardFFIFunc(pxysymname string, symname string, args ...interface{}) (VRetype, error)

TODO resolve ffi parameters and then forward to C scope execute C scope receiver func: void(void*fnptr, uint64_t*retval, void* argtys, void* argvals)

func InvokeQtFunc

func InvokeQtFunc(symname string, retype byte, types []byte, args ...interface{}) (VRetype, error)

func InvokeQtFunc5

func InvokeQtFunc5(symname string, retype byte, argc int, types []byte, args []uint64) (VRetype, error)

func InvokeQtFunc6

func InvokeQtFunc6(symname string, retype byte, args ...interface{}) (VRetype, error)

func InvokeQtFunc6Var

func InvokeQtFunc6Var(symname string, retype byte, fixedargc int, args ...interface{}) (VRetype, error)

for variadic function call

func InvokeQtFunc7

func InvokeQtFunc7(symname string, args ...interface{}) (VRetype, error)

fix return QSize like pure record, RVO

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL