Documentation
¶
Index ¶
- Variables
- func FullGoName(module modules.Module, name string, currentModule modules.Module) string
- type AliasType
- type ArrayType
- type BlockParam
- type BlockType
- type ClassType
- func (c *ClassType) DeclareModule() *modules.Module
- func (c *ClassType) GoImports() set.Set[string]
- func (c *ClassType) GoInterfaceName() string
- func (c *ClassType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
- func (c *ClassType) GoStructName() string
- func (c *ClassType) ObjcName() string
- type DataType
- type DictType
- type DispatchType
- type IDType
- type InstanceType
- type KernelType
- type PointerRefType
- type PointerType
- type PrimitiveType
- type ProtocolType
- func (p *ProtocolType) DeclareModule() *modules.Module
- func (p *ProtocolType) GoImports() set.Set[string]
- func (p *ProtocolType) GoInterfaceName() string
- func (p *ProtocolType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
- func (p *ProtocolType) GoStructName() string
- func (p *ProtocolType) GoWrapperName() string
- func (p *ProtocolType) ObjcName() string
- type RefType
- type SelectorType
- type StringType
- type StructType
- type Type
- type VoidPointerType
- type VoidType
Constants ¶
This section is empty.
Variables ¶
var Bool = &PrimitiveType{GoName_: "bool", ObjcName_: "BOOL"}
var Byte = &PrimitiveType{GoName_: "byte", ObjcName_: "char"}
var Class = &ClassType{ Name: "Class", GName: "Class", Module: modules.Get("objc"), }
var Double = &PrimitiveType{GoName_: "float64", ObjcName_: "double"}
var Float = &PrimitiveType{GoName_: "float32", ObjcName_: "float"}
var Int = &PrimitiveType{GoName_: "int", ObjcName_: "NSInteger"}
var Int16 = &PrimitiveType{GoName_: "int16", ObjcName_: "int16_t"}
var Int32 = &PrimitiveType{GoName_: "int32", ObjcName_: "int32_t"}
var Int64 = &PrimitiveType{GoName_: "int64", ObjcName_: "int64_t"}
var Int8 = &PrimitiveType{GoName_: "int8", ObjcName_: "int8_t"}
var Object = &ClassType{ Name: "NSObject", GName: "Object", Module: modules.Get("objc"), }
Object is the objc object root class type
var UInt = &PrimitiveType{GoName_: "uint", ObjcName_: "NSUInteger"}
var UInt16 = &PrimitiveType{GoName_: "uint16", ObjcName_: "uint16_t"}
var UInt32 = &PrimitiveType{GoName_: "uint32", ObjcName_: "uint32_t"}
var UInt64 = &PrimitiveType{GoName_: "uint64", ObjcName_: "uint64_t"}
var UInt8 = &PrimitiveType{GoName_: "uint8", ObjcName_: "uint8_t"}
Functions ¶
Types ¶
type AliasType ¶
type AliasType struct { Type Type // the real type GName string // alias name for new go type Name string // the objc name Module *modules.Module // used when Alias is not empty }
AliasType type def types
func (*AliasType) DeclareModule ¶
type ArrayType ¶
type ArrayType struct {
Type Type
}
ArrayType the element should be StringType or ClassType
func (*ArrayType) DeclareModule ¶
type BlockParam ¶
type BlockType ¶
type BlockType struct { ReturnType Type Params []BlockParam }
BlockType
func (*BlockType) DeclareModule ¶
type ClassType ¶
type ClassType struct { Name string // objc type name GName string // Go name, usually is objc type name without prefix 'NS' Module *modules.Module // object-c module }
ClassType Objective-c interface type
func (*ClassType) DeclareModule ¶
func (*ClassType) GoInterfaceName ¶
GoInterfaceName return the go wrapper interface name
func (*ClassType) GoStructName ¶
GoStructName return the go wrapper struct name
type DataType ¶
type DataType struct { }
DataType objc binary data type
func (*DataType) DeclareModule ¶
type DictType ¶
DictType for objc Dictionary types, the element should be StringType or ClassType
func (*DictType) DeclareModule ¶
type DispatchType ¶
type DispatchType struct {
ObjcName_ string // objc type name
}
func (*DispatchType) DeclareModule ¶
func (d *DispatchType) DeclareModule() *modules.Module
func (*DispatchType) GoName ¶
func (d *DispatchType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*DispatchType) ObjcName ¶
func (d *DispatchType) ObjcName() string
type IDType ¶
type IDType struct { }
InstanceType the objc instancetype. class method start with alloc or new, instance method start with autorelease,init,retain or self, return instancetype.
func (*IDType) DeclareModule ¶
type InstanceType ¶
type InstanceType struct { }
InstanceType the objc instancetype. class method start with alloc or new, instance method start with autorelease,init,retain or self, return instancetype.
func (*InstanceType) DeclareModule ¶
func (i *InstanceType) DeclareModule() *modules.Module
func (*InstanceType) GoName ¶
func (i *InstanceType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*InstanceType) ObjcName ¶
func (i *InstanceType) ObjcName() string
type KernelType ¶
type KernelType struct {
ObjcName_ string // objc type name
}
func (*KernelType) DeclareModule ¶
func (k *KernelType) DeclareModule() *modules.Module
func (*KernelType) GoName ¶
func (k *KernelType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*KernelType) ObjcName ¶
func (k *KernelType) ObjcName() string
type PointerRefType ¶
type PointerRefType struct { Name string // objc type name GName string // Go name, usually is objc type name without prefix 'NS' Module *modules.Module // object-c module }
PointerRefType c pointer type def
func (*PointerRefType) DeclareModule ¶
func (c *PointerRefType) DeclareModule() *modules.Module
func (*PointerRefType) GoName ¶
func (c *PointerRefType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*PointerRefType) ObjcName ¶
func (c *PointerRefType) ObjcName() string
type PointerType ¶
type PointerType struct {
Type Type
}
PointerType is c pointer type
func (*PointerType) DeclareModule ¶
func (c *PointerType) DeclareModule() *modules.Module
func (*PointerType) GoName ¶
func (c *PointerType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*PointerType) ObjcName ¶
func (c *PointerType) ObjcName() string
type PrimitiveType ¶
PrimitiveType primitive types
func GetPrimitiveType ¶
func GetPrimitiveType(typeName string) (*PrimitiveType, bool)
func (*PrimitiveType) DeclareModule ¶
func (p *PrimitiveType) DeclareModule() *modules.Module
func (*PrimitiveType) GoName ¶
func (p *PrimitiveType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*PrimitiveType) ObjcName ¶
func (p *PrimitiveType) ObjcName() string
func (*PrimitiveType) ToUnsigned ¶
func (p *PrimitiveType) ToUnsigned() *PrimitiveType
type ProtocolType ¶
type ProtocolType struct { Name string // the objc type name GName string // Go name, usually is objc type name without prefix 'NS' Module *modules.Module // object-c module name }
ProtocolType objective-c protocol type
func (*ProtocolType) DeclareModule ¶
func (p *ProtocolType) DeclareModule() *modules.Module
func (*ProtocolType) GoInterfaceName ¶
func (p *ProtocolType) GoInterfaceName() string
func (*ProtocolType) GoName ¶
func (p *ProtocolType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*ProtocolType) GoStructName ¶
func (p *ProtocolType) GoStructName() string
func (*ProtocolType) GoWrapperName ¶
func (p *ProtocolType) GoWrapperName() string
func (*ProtocolType) ObjcName ¶
func (p *ProtocolType) ObjcName() string
type RefType ¶
type RefType struct {
Name string // c and objc type name
}
for weird struct refs like those ending in "Ref"
func (*RefType) DeclareModule ¶
type SelectorType ¶
type SelectorType struct { }
SelectorType objc selector type
func (*SelectorType) DeclareModule ¶
func (s *SelectorType) DeclareModule() *modules.Module
func (*SelectorType) GoName ¶
func (s *SelectorType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*SelectorType) ObjcName ¶
func (s *SelectorType) ObjcName() string
type StringType ¶
type StringType struct {
NeedNil bool // string type need nil value.If set to true, will use foundation.String instread string for generated go code.
}
StringType string
func (*StringType) DeclareModule ¶
func (s *StringType) DeclareModule() *modules.Module
func (*StringType) GoName ¶
func (s *StringType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*StringType) ObjcName ¶
func (s *StringType) ObjcName() string
type StructType ¶
type StructType struct { Name string // c and objc type name GName string // the go struct name Module *modules.Module // the module }
StructType struct type
func (*StructType) DeclareModule ¶
func (s *StructType) DeclareModule() *modules.Module
func (*StructType) GoName ¶
func (s *StructType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*StructType) ObjcName ¶
func (s *StructType) ObjcName() string
type Type ¶
type Type interface { // GoName Go type name GoName(currentModule *modules.Module, receiveFromObjc bool) string // ObjcName Objective-c type name ObjcName() string // GoImports go imports for this type GoImports() set.Set[string] // DeclareModule the module of this type. return nil if is a built in type DeclareModule() *modules.Module }
Type interface for all type
func GetDispatchType ¶
func GetKernelType ¶
func UnwrapAlias ¶
UnwrapAlias unwrap alias type to it's real underlying type
type VoidPointerType ¶
type VoidPointerType struct { Name string // objc type name GName string // Go name, usually is objc type name without prefix 'NS' }
VoidPointerType void*/unsafe.Pointer
func (*VoidPointerType) DeclareModule ¶
func (c *VoidPointerType) DeclareModule() *modules.Module
func (*VoidPointerType) GoName ¶
func (c *VoidPointerType) GoName(currentModule *modules.Module, receiveFromObjc bool) string
func (*VoidPointerType) ObjcName ¶
func (c *VoidPointerType) ObjcName() string
Source Files
¶
- alias_type.go
- array_type.go
- block_type.go
- class_type.go
- data_type.go
- dict_type.go
- dispatch_type.go
- id_type.go
- instance_type.go
- kernel_type.go
- pointer_ref_type.go
- pointer_type.go
- primitive_type.go
- protocol_type.go
- ref_type.go
- selector_type.go
- string_type.go
- struct_type.go
- type.go
- void_pointer_type.go
- void_type.go