Documentation ¶
Index ¶
- Variables
- func FullGoName(module Module, name string, currentModule Module) string
- func PrependPackage(module Module, s string, currentModule Module) string
- type AliasType
- type ArrayType
- type BlockParam
- type BlockType
- type ClassType
- type DataType
- type DictType
- type IDType
- type InstanceType
- type Module
- type PointerRefType
- type PointerType
- type PrimitiveType
- type ProtocolType
- type SelectorType
- type StringType
- type StructType
- type Type
- type VoidPointerType
- type VoidType
Constants ¶
This section is empty.
Variables ¶
var AppKit = &Module{"AppKit", "AppKit", "appkit", "Appkit/Appkit.h"}
var Bool = &PrimitiveType{GoName_: "bool", ObjcName_: "BOOL"}
var Byte = &PrimitiveType{GoName_: "byte", ObjcName_: "char"}
var Class = &ClassType{ Name: "Class", GName: "Class", Module: ObjCRuntime, }
var CoreFoundation = &Module{"CoreFoundation", "Core Foundation", "corefoundation", "CoreFoundation/CoreFoundation.h"}
var CoreGraphics = &Module{"CoreGraphics", "Core Graphics", "coregraphics", "CoreGraphics/CoreGraphics.h"}
var Double = &PrimitiveType{GoName_: "float64", ObjcName_: "double"}
var FileProvider = &Module{"FileProvider", "File Provider", "fileprovider", "FileProvider/FileProvider.h"}
var Float = &PrimitiveType{GoName_: "float32", ObjcName_: "float"}
var Foundation = &Module{"Foundation", "Foundation", "foundation", "Foundation/Foundation.h"}
var IOBluetooth = &Module{"IOBluetooth", "IOBluetooth", "iobluetooth", "IOBluetooth/IOBluetooth.h"}
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 ObjCRuntime = &Module{"objectivec", "Objective-C Runtime", "objc", "objc/runtime.h"}
var Object = &ClassType{ Name: "NSObject", GName: "Object", Module: ObjCRuntime, }
Object is the objc object root class type
var Quartz = &Module{"Quartz", "Quartz", "quartz", "Quartz/Quartz.h"}
var QuartzCore = &Module{"QuartzCore", "QuartzCore", "quartzcore", "QuartzCore/QuartzCore.h"}
var SecurityInterface = &Module{"SecurityInterface", "Security Interface", "securityinterface", "SecurityInterface/SecurityInterface.h"}
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"}
var UniformTypeIdentifiers = &Module{"UniformTypeIdentifiers", "Uniform Type Identifiers", "uniformtypeidentifiers", "UniformTypeIdentifiers/UniformTypeIdentifiers.h"}
var WebKit = &Module{"WebKit", "WebKit", "webkit", "WebKit/WebKit.h"}
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 *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 *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 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() *Module
func (*InstanceType) GoName ¶
func (i *InstanceType) GoName(currentModule *Module, receiveFromObjc bool) string
func (*InstanceType) ObjcName ¶
func (i *InstanceType) ObjcName() string
type Module ¶
type Module struct { Name string // module name DesName string // readable name Package string // go package for this module Header string // objc header file }
Module Objective-c module
func FindModule ¶
type PointerRefType ¶
type PointerRefType struct { Name string // objc type name GName string // Go name, usually is objc type name without prefix 'NS' Module *Module // object-c module }
PointerRefType c pointer type def
func (*PointerRefType) DeclareModule ¶
func (c *PointerRefType) DeclareModule() *Module
func (*PointerRefType) GoName ¶
func (c *PointerRefType) GoName(currentModule *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() *Module
func (*PointerType) GoName ¶
func (c *PointerType) GoName(currentModule *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() *Module
func (*PrimitiveType) GoName ¶
func (p *PrimitiveType) GoName(currentModule *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' OnlyUse bool // if this protocol is just for use, no need to implement it Module *Module // object-c module name }
ProtocolType objective-c protocol type
func (*ProtocolType) DeclareModule ¶
func (p *ProtocolType) DeclareModule() *Module
func (*ProtocolType) GoName ¶
func (p *ProtocolType) GoName(currentModule *Module, receiveFromObjc bool) string
func (*ProtocolType) ObjcName ¶
func (p *ProtocolType) ObjcName() string
type SelectorType ¶
type SelectorType struct { }
SelectorType objc selector type
func (*SelectorType) DeclareModule ¶
func (s *SelectorType) DeclareModule() *Module
func (*SelectorType) GoName ¶
func (s *SelectorType) GoName(currentModule *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() *Module
func (*StringType) GoName ¶
func (s *StringType) GoName(currentModule *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 *Module // the module }
StructType struct type
func (*StructType) DeclareModule ¶
func (s *StructType) DeclareModule() *Module
func (*StructType) GoName ¶
func (s *StructType) GoName(currentModule *Module, receiveFromObjc bool) string
func (*StructType) ObjcName ¶
func (s *StructType) ObjcName() string
type Type ¶
type Type interface { // GoName Go type name GoName(currentModule *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() *Module }
Type interface for all type
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() *Module
func (*VoidPointerType) GoName ¶
func (c *VoidPointerType) GoName(currentModule *Module, receiveFromObjc bool) string
func (*VoidPointerType) ObjcName ¶
func (c *VoidPointerType) ObjcName() string