gi

package
v0.0.0-...-f2fd085 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: GPL-3.0 Imports: 7 Imported by: 27

Documentation

Overview

本文件是用 gen_array_code 工具自动生成的

Index

Constants

View Source
const NilStr = "\x00\x00\x00\x00"

Variables

View Source
var TypeInt = reflect.TypeOf(0)
View Source
var TypeUint = reflect.TypeOf(uint(0))

Functions

func Bool2Int

func Bool2Int(v bool) int

func CString

func CString(str string) unsafe.Pointer

注意需要 free 这个字符串

func CallMyDestroyFn

func CallMyDestroyFn(ptr unsafe.Pointer)

func Free

func Free(p unsafe.Pointer)

func GetClosureDestroyNotifyPtr

func GetClosureDestroyNotifyPtr() unsafe.Pointer

func GoString

func GoString(p unsafe.Pointer) string

func Int2Bool

func Int2Bool(v int) bool

func Malloc

func Malloc(nBytes int) unsafe.Pointer

func Malloc0

func Malloc0(nBytes int) unsafe.Pointer

func RegisterFClosure

func RegisterFClosure(fn FClosureFunc, scope Scope, callableInfo CallableInfo) (uint, unsafe.Pointer)

func RegisterFunc

func RegisterFunc(fn interface{}, scope Scope) uint

func SliceAlloc

func SliceAlloc(blockSize int) unsafe.Pointer

func SliceAlloc0

func SliceAlloc0(blockSize int) unsafe.Pointer

func SliceFree

func SliceFree(blockSize int, memBlock unsafe.Pointer)

func Store

func Store(src []interface{}, dest ...interface{}) error

func StoreInterfaces

func StoreInterfaces(src, dest interface{}) error

func StoreStruct

func StoreStruct(src []interface{}, dest interface{}) error

func ToError

func ToError(ptr unsafe.Pointer) (err error)

func Uint2Ptr

func Uint2Ptr(n uint) unsafe.Pointer

func UnregisterFClosure

func UnregisterFClosure(id uint)

func UnregisterFunc

func UnregisterFunc(id uint)

Types

type Argument

type Argument [8]byte

C.GIArgument is [8]byte

func NewBoolArgument

func NewBoolArgument(v bool) (arg Argument)

func NewDoubleArgument

func NewDoubleArgument(v float64) (arg Argument)

func NewFloatArgument

func NewFloatArgument(v float32) (arg Argument)

func NewInt16Argument

func NewInt16Argument(v int16) (arg Argument)

func NewInt32Argument

func NewInt32Argument(v int32) (arg Argument)

func NewInt64Argument

func NewInt64Argument(v int64) (arg Argument)

func NewInt8Argument

func NewInt8Argument(v int8) (arg Argument)

func NewIntArgument

func NewIntArgument(v int) (arg Argument)

func NewLongArgument

func NewLongArgument(v int64) (arg Argument)

func NewPointerArgument

func NewPointerArgument(v unsafe.Pointer) (arg Argument)

func NewPointerArgumentU

func NewPointerArgumentU(v uint) (arg Argument)

func NewSSizeArgument

func NewSSizeArgument(v int64) (arg Argument)

func NewShortArgument

func NewShortArgument(v int16) (arg Argument)

func NewSizeArgument

func NewSizeArgument(v uint64) (arg Argument)

func NewStringArgument

func NewStringArgument(v unsafe.Pointer) (arg Argument)

func NewULongArgument

func NewULongArgument(v uint64) (arg Argument)

func NewUShortArgument

func NewUShortArgument(v int16) (arg Argument)

func NewUint16Argument

func NewUint16Argument(v uint16) (arg Argument)

func NewUint32Argument

func NewUint32Argument(v uint32) (arg Argument)

func NewUint64Argument

func NewUint64Argument(v uint64) (arg Argument)

func NewUint8Argument

func NewUint8Argument(v uint8) (arg Argument)

func NewUintArgument

func NewUintArgument(v uint) (arg Argument)

func (Argument) Bool

func (arg Argument) Bool() bool

func (Argument) Double

func (arg Argument) Double() float64

func (Argument) Float

func (arg Argument) Float() float32

func (Argument) Int

func (arg Argument) Int() int

func (Argument) Int16

func (arg Argument) Int16() int16

func (Argument) Int32

func (arg Argument) Int32() int32

func (Argument) Int64

func (arg Argument) Int64() int64

func (Argument) Int8

func (arg Argument) Int8() int8

func (Argument) Long

func (arg Argument) Long() int64

func (Argument) Pointer

func (arg Argument) Pointer() unsafe.Pointer

func (Argument) SSize

func (arg Argument) SSize() int64

func (Argument) Short

func (arg Argument) Short() int16

func (Argument) Size

func (arg Argument) Size() uint64

func (Argument) String

func (arg Argument) String() StrPtr

func (Argument) ULong

func (arg Argument) ULong() uint64

func (Argument) UShort

func (arg Argument) UShort() uint16

func (Argument) Uint

func (arg Argument) Uint() uint

func (Argument) Uint16

func (arg Argument) Uint16() uint16

func (Argument) Uint32

func (arg Argument) Uint32() uint32

func (Argument) Uint64

func (arg Argument) Uint64() uint64

func (Argument) Uint8

func (arg Argument) Uint8() uint8

type BaseInfo

type BaseInfo struct {
	P unsafe.Pointer
}

func (BaseInfo) Name

func (bi BaseInfo) Name() string

g_base_info_get_name

func (BaseInfo) Ref

func (bi BaseInfo) Ref()

func (BaseInfo) Type

func (bi BaseInfo) Type() InfoType

g_base_info_get_type

func (BaseInfo) Unref

func (bi BaseInfo) Unref()

type BoolArray

type BoolArray struct {
	P   unsafe.Pointer
	Len int
}

func NewBoolArray

func NewBoolArray(values ...bool) BoolArray

func (BoolArray) AsSlice

func (arr BoolArray) AsSlice() []int32

func (BoolArray) Copy

func (arr BoolArray) Copy() []bool

func (*BoolArray) Free

func (arr *BoolArray) Free()

type CStrArray

type CStrArray struct {
	P   unsafe.Pointer
	Len int
}

func NewCStrArrayWithStrings

func NewCStrArrayWithStrings(values ...string) CStrArray

func NewCStrArrayZTWithStrings

func NewCStrArrayZTWithStrings(values ...string) CStrArray

func (CStrArray) AsSlice

func (arr CStrArray) AsSlice() []unsafe.Pointer

func (CStrArray) Copy

func (arr CStrArray) Copy() []string

func (*CStrArray) Free

func (arr *CStrArray) Free()

free container

func (*CStrArray) FreeAll

func (arr *CStrArray) FreeAll()

func (*CStrArray) SetLenZT

func (arr *CStrArray) SetLenZT()

type CStrvArray

type CStrvArray struct {
	P   unsafe.Pointer
	Len int
}

strArr 的 array

func (CStrvArray) Copy

func (arr CStrvArray) Copy() (result [][]string)

func (*CStrvArray) Free

func (arr *CStrvArray) Free()

func (*CStrvArray) FreeAll

func (arr *CStrvArray) FreeAll()

func (*CStrvArray) SetLenZT

func (arr *CStrvArray) SetLenZT()

type CallableInfo

type CallableInfo struct {
	BaseInfo
}

func GetCallableInfo

func GetCallableInfo(namespace, name string) CallableInfo

func WrapCallableInfo

func WrapCallableInfo(p unsafe.Pointer) (ret CallableInfo)

func (CallableInfo) FreeClosure

func (v CallableInfo) FreeClosure(c FFIClosure)

g_callable_info_free_closure

func (CallableInfo) PrepareClosure

func (v CallableInfo) PrepareClosure(userData unsafe.Pointer) FFIClosure

g_callable_info_prepare_closure

type Closure

type Closure struct {
	Fn    interface{}
	Scope Scope
}

func GetFunc

func GetFunc(id uint) Closure

type DoubleArray

type DoubleArray struct {
	P   unsafe.Pointer
	Len int
}

func MakeDoubleArray

func MakeDoubleArray(length int) DoubleArray

func NewDoubleArray

func NewDoubleArray(values []float64) DoubleArray

func (DoubleArray) AsSlice

func (arr DoubleArray) AsSlice() []float64

func (DoubleArray) Copy

func (arr DoubleArray) Copy() []float64

func (*DoubleArray) Free

func (arr *DoubleArray) Free()

func (*DoubleArray) SetLenZT

func (arr *DoubleArray) SetLenZT()

type Enum

type Enum int

type FClosure

type FClosure struct {
	Fn           FClosureFunc
	Scope        Scope
	FFIClosure   FFIClosure
	CallableInfo CallableInfo
}

新的 ffi 实现的 closure

func GetFClosure

func GetFClosure(id uint) FClosure

type FClosureFunc

type FClosureFunc func(result unsafe.Pointer, args []unsafe.Pointer)

type FFIClosure

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

func (FFIClosure) ExecPtr

func (v FFIClosure) ExecPtr() unsafe.Pointer

type FieldInfo

type FieldInfo struct {
	BaseInfo
}

func WrapFieldInfo

func WrapFieldInfo(p unsafe.Pointer) (ret FieldInfo)

func (FieldInfo) GetField

func (fi FieldInfo) GetField(mem unsafe.Pointer) (Argument, bool)

type FindMethodFlags

type FindMethodFlags uint
const (
	FindMethodNoCallFind FindMethodFlags = 1 << iota // 不要调用 FindMethod 方法
)

type Flags

type Flags uint

type FloatArray

type FloatArray struct {
	P   unsafe.Pointer
	Len int
}

func MakeFloatArray

func MakeFloatArray(length int) FloatArray

func NewFloatArray

func NewFloatArray(values []float32) FloatArray

func (FloatArray) AsSlice

func (arr FloatArray) AsSlice() []float32

func (FloatArray) Copy

func (arr FloatArray) Copy() []float32

func (*FloatArray) Free

func (arr *FloatArray) Free()

func (*FloatArray) SetLenZT

func (arr *FloatArray) SetLenZT()

type FunctionInfo

type FunctionInfo struct {
	CallableInfo
}

func WrapFunctionInfo

func WrapFunctionInfo(p unsafe.Pointer) (ret FunctionInfo)

func (FunctionInfo) PrepInvoker

func (fi FunctionInfo) PrepInvoker() (Invoker, error)

type GType

type GType uint

type GTypeArray

type GTypeArray struct {
	P   unsafe.Pointer
	Len int
}

func MakeGTypeArray

func MakeGTypeArray(length int) GTypeArray

func NewGTypeArray

func NewGTypeArray(values []GType) GTypeArray

func (GTypeArray) AsSlice

func (arr GTypeArray) AsSlice() []GType

func (GTypeArray) Copy

func (arr GTypeArray) Copy() []GType

func (*GTypeArray) Free

func (arr *GTypeArray) Free()

func (*GTypeArray) SetLenZT

func (arr *GTypeArray) SetLenZT()

type InfoType

type InfoType int
const (
	INFO_TYPE_INVALID    InfoType = C.GI_INFO_TYPE_INVALID
	INFO_TYPE_FUNCTION   InfoType = C.GI_INFO_TYPE_FUNCTION
	INFO_TYPE_CALLBACK   InfoType = C.GI_INFO_TYPE_CALLBACK
	INFO_TYPE_STRUCT     InfoType = C.GI_INFO_TYPE_STRUCT
	INFO_TYPE_BOXED      InfoType = C.GI_INFO_TYPE_BOXED
	INFO_TYPE_ENUM       InfoType = C.GI_INFO_TYPE_ENUM
	INFO_TYPE_FLAGS      InfoType = C.GI_INFO_TYPE_FLAGS
	INFO_TYPE_OBJECT     InfoType = C.GI_INFO_TYPE_OBJECT
	INFO_TYPE_INTERFACE  InfoType = C.GI_INFO_TYPE_INTERFACE
	INFO_TYPE_CONSTANT   InfoType = C.GI_INFO_TYPE_CONSTANT
	INFO_TYPE_INVALID_0  InfoType = C.GI_INFO_TYPE_INVALID_0
	INFO_TYPE_UNION      InfoType = C.GI_INFO_TYPE_UNION
	INFO_TYPE_VALUE      InfoType = C.GI_INFO_TYPE_VALUE
	INFO_TYPE_SIGNAL     InfoType = C.GI_INFO_TYPE_SIGNAL
	INFO_TYPE_VFUNC      InfoType = C.GI_INFO_TYPE_VFUNC
	INFO_TYPE_PROPERTY   InfoType = C.GI_INFO_TYPE_PROPERTY
	INFO_TYPE_FIELD      InfoType = C.GI_INFO_TYPE_FIELD
	INFO_TYPE_ARG        InfoType = C.GI_INFO_TYPE_ARG
	INFO_TYPE_TYPE       InfoType = C.GI_INFO_TYPE_TYPE
	INFO_TYPE_UNRESOLVED InfoType = C.GI_INFO_TYPE_UNRESOLVED
)

func (InfoType) String

func (it InfoType) String() string

g_info_type_to_string

type Int16Array

type Int16Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeInt16Array

func MakeInt16Array(length int) Int16Array

func NewInt16Array

func NewInt16Array(values []int16) Int16Array

func (Int16Array) AsSlice

func (arr Int16Array) AsSlice() []int16

func (Int16Array) Copy

func (arr Int16Array) Copy() []int16

func (*Int16Array) Free

func (arr *Int16Array) Free()

func (*Int16Array) SetLenZT

func (arr *Int16Array) SetLenZT()

type Int32Array

type Int32Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeInt32Array

func MakeInt32Array(length int) Int32Array

func NewInt32Array

func NewInt32Array(values []int32) Int32Array

func (Int32Array) AsSlice

func (arr Int32Array) AsSlice() []int32

func (Int32Array) Copy

func (arr Int32Array) Copy() []int32

func (*Int32Array) Free

func (arr *Int32Array) Free()

func (*Int32Array) SetLenZT

func (arr *Int32Array) SetLenZT()

type Int64Array

type Int64Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeInt64Array

func MakeInt64Array(length int) Int64Array

func NewInt64Array

func NewInt64Array(values []int64) Int64Array

func (Int64Array) AsSlice

func (arr Int64Array) AsSlice() []int64

func (Int64Array) Copy

func (arr Int64Array) Copy() []int64

func (*Int64Array) Free

func (arr *Int64Array) Free()

func (*Int64Array) SetLenZT

func (arr *Int64Array) SetLenZT()

type Int8Array

type Int8Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeInt8Array

func MakeInt8Array(length int) Int8Array

func NewInt8Array

func NewInt8Array(values []int8) Int8Array

func (Int8Array) AsSlice

func (arr Int8Array) AsSlice() []int8

func (Int8Array) Copy

func (arr Int8Array) Copy() []int8

func (*Int8Array) Free

func (arr *Int8Array) Free()

func (*Int8Array) SetLenZT

func (arr *Int8Array) SetLenZT()

type InterfaceInfo

type InterfaceInfo struct {
	RegisteredTypeInfo
}

func WrapInterfaceInfo

func WrapInterfaceInfo(p unsafe.Pointer) (ret InterfaceInfo)

func (InterfaceInfo) FindMethod

func (ii InterfaceInfo) FindMethod(name string) FunctionInfo

g_interface_info_find_method

func (InterfaceInfo) Method

func (ii InterfaceInfo) Method(index int) FunctionInfo

g_interface_info_get_method

func (InterfaceInfo) NumMethods

func (ii InterfaceInfo) NumMethods() int

g_interface_info_get_n_methods

type Invoker

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

func (Invoker) Call

func (invoker Invoker) Call(args []Argument, retVal *Argument, pOutArgs *Argument)

type InvokerCache

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

func NewInvokerCache

func NewInvokerCache(ns string) *InvokerCache

func (*InvokerCache) Get

func (ic *InvokerCache) Get(id uint, nameLv1, nameLv2 string, idxLv1, idxLv2 int, infoType InfoType, flags FindMethodFlags) (Invoker, error)

func (*InvokerCache) Get1

func (ic *InvokerCache) Get1(id uint, ns, nameLv1, nameLv2 string, idxLv1, idxLv2 int, infoType InfoType, flags FindMethodFlags) (Invoker, error)

func (*InvokerCache) GetGType

func (ic *InvokerCache) GetGType(id uint, typeName string) GType

func (*InvokerCache) GetGType1

func (ic *InvokerCache) GetGType1(id uint, ns, typeName string) GType

type Long

type Long int64

type ObjectInfo

type ObjectInfo struct {
	RegisteredTypeInfo
}

func WrapObjectInfo

func WrapObjectInfo(p unsafe.Pointer) (ret ObjectInfo)

func (ObjectInfo) FindMethod

func (oi ObjectInfo) FindMethod(name string) FunctionInfo

g_object_info_find_method

func (ObjectInfo) Method

func (oi ObjectInfo) Method(index int) FunctionInfo

g_object_info_get_method

func (ObjectInfo) NumMethods

func (oi ObjectInfo) NumMethods() int

g_object_info_get_n_methods

type ParamBox

type ParamBox struct {
	Params   []interface{}
	UserData interface{}
}

func (ParamBox) Store

func (p ParamBox) Store(dest ...interface{}) error

func (ParamBox) StoreStruct

func (p ParamBox) StoreStruct(dest interface{}) error

type PointerArray

type PointerArray struct {
	P   unsafe.Pointer
	Len int
}

func NewPointerArray

func NewPointerArray(values ...unsafe.Pointer) PointerArray

func (PointerArray) AsSlice

func (arr PointerArray) AsSlice() []unsafe.Pointer

func (PointerArray) Copy

func (arr PointerArray) Copy() []unsafe.Pointer

func (*PointerArray) Free

func (arr *PointerArray) Free()

func (*PointerArray) SetLenZT

func (arr *PointerArray) SetLenZT()

type RegisteredTypeInfo

type RegisteredTypeInfo struct {
	BaseInfo
}

func WrapRegisteredTypeInfo

func WrapRegisteredTypeInfo(p unsafe.Pointer) (ret RegisteredTypeInfo)

func (RegisteredTypeInfo) GetGType

func (rti RegisteredTypeInfo) GetGType() GType

type Repository

type Repository struct {
	P unsafe.Pointer
}

func DefaultRepository

func DefaultRepository() Repository

func (Repository) FindByName

func (r Repository) FindByName(namespace, name string) BaseInfo

g_irepository_find_by_name

func (Repository) Info

func (r Repository) Info(namespace string, index int) BaseInfo

g_irepository_get_info

func (*Repository) Require

func (r *Repository) Require(namespace, version string, flags RepositoryLoadFlags) (Typelib, error)

g_irepository_require

type RepositoryLoadFlags

type RepositoryLoadFlags int
const (
	REPOSITORY_LOAD_FLAG_LAZY RepositoryLoadFlags = C.G_IREPOSITORY_LOAD_FLAG_LAZY
)

type Scope

type Scope uint
const (
	ScopeInvalid Scope = iota
	ScopeCall
	ScopeAsync
	ScopeNotified
)

func (Scope) String

func (s Scope) String() (str string)

type StrPtr

type StrPtr struct {
	P unsafe.Pointer
}

func (StrPtr) Copy

func (v StrPtr) Copy() string

func (StrPtr) Take

func (v StrPtr) Take() string

type StructInfo

type StructInfo struct {
	RegisteredTypeInfo
}

func WrapStructInfo

func WrapStructInfo(p unsafe.Pointer) (ret StructInfo)

func (StructInfo) Field

func (si StructInfo) Field(n int) FieldInfo

g_struct_info_get_field

func (StructInfo) FindField

func (si StructInfo) FindField(name string) FieldInfo

func (StructInfo) FindMethod

func (si StructInfo) FindMethod(name string) FunctionInfo

g_struct_info_find_method

func (StructInfo) Method

func (si StructInfo) Method(index int) FunctionInfo

g_struct_info_get_method

func (StructInfo) NumFields

func (si StructInfo) NumFields() int

g_struct_info_get_n_fields

func (StructInfo) NumMethods

func (si StructInfo) NumMethods() int

g_struct_info_get_n_methods

type Typelib

type Typelib struct {
	//c *C.GITypelib
	P unsafe.Pointer
}

type Uint16Array

type Uint16Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeUint16Array

func MakeUint16Array(length int) Uint16Array

func NewUint16Array

func NewUint16Array(values []uint16) Uint16Array

func (Uint16Array) AsSlice

func (arr Uint16Array) AsSlice() []uint16

func (Uint16Array) Copy

func (arr Uint16Array) Copy() []uint16

func (*Uint16Array) Free

func (arr *Uint16Array) Free()

func (*Uint16Array) SetLenZT

func (arr *Uint16Array) SetLenZT()

type Uint32Array

type Uint32Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeUint32Array

func MakeUint32Array(length int) Uint32Array

func NewUint32Array

func NewUint32Array(values []uint32) Uint32Array

func (Uint32Array) AsSlice

func (arr Uint32Array) AsSlice() []uint32

func (Uint32Array) Copy

func (arr Uint32Array) Copy() []uint32

func (*Uint32Array) Free

func (arr *Uint32Array) Free()

func (*Uint32Array) SetLenZT

func (arr *Uint32Array) SetLenZT()

type Uint64Array

type Uint64Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeUint64Array

func MakeUint64Array(length int) Uint64Array

func NewUint64Array

func NewUint64Array(values []uint64) Uint64Array

func (Uint64Array) AsSlice

func (arr Uint64Array) AsSlice() []uint64

func (Uint64Array) Copy

func (arr Uint64Array) Copy() []uint64

func (*Uint64Array) Free

func (arr *Uint64Array) Free()

func (*Uint64Array) SetLenZT

func (arr *Uint64Array) SetLenZT()

type Uint8Array

type Uint8Array struct {
	P   unsafe.Pointer
	Len int
}

func MakeUint8Array

func MakeUint8Array(length int) Uint8Array

func NewUint8Array

func NewUint8Array(values []uint8) Uint8Array

func (Uint8Array) AsSlice

func (arr Uint8Array) AsSlice() []uint8

func (Uint8Array) Copy

func (arr Uint8Array) Copy() []uint8

func (*Uint8Array) Free

func (arr *Uint8Array) Free()

func (*Uint8Array) SetLenZT

func (arr *Uint8Array) SetLenZT()

type Ulong

type Ulong uint64

type UniCharArray

type UniCharArray struct {
	P   unsafe.Pointer
	Len int
}

func MakeUniCharArray

func MakeUniCharArray(length int) UniCharArray

func NewUniCharArray

func NewUniCharArray(values []rune) UniCharArray

func (UniCharArray) AsSlice

func (arr UniCharArray) AsSlice() []rune

func (UniCharArray) Copy

func (arr UniCharArray) Copy() []rune

func (*UniCharArray) Free

func (arr *UniCharArray) Free()

func (*UniCharArray) SetLenZT

func (arr *UniCharArray) SetLenZT()

type UnionInfo

type UnionInfo struct {
	RegisteredTypeInfo
}

func WrapUnionInfo

func WrapUnionInfo(p unsafe.Pointer) (ret UnionInfo)

func (UnionInfo) Field

func (ui UnionInfo) Field(n int) FieldInfo

g_union_info_get_field

func (UnionInfo) FindField

func (ui UnionInfo) FindField(name string) FieldInfo

func (UnionInfo) FindMethod

func (ui UnionInfo) FindMethod(name string) FunctionInfo

g_union_info_find_method

func (UnionInfo) Method

func (ui UnionInfo) Method(index int) FunctionInfo

g_union_info_get_method

func (UnionInfo) NumFields

func (ui UnionInfo) NumFields() int

g_union_info_get_n_fields

func (UnionInfo) NumMethods

func (ui UnionInfo) NumMethods() int

g_union_info_get_n_methods

Jump to

Keyboard shortcuts

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