Documentation ¶
Overview ¶
Package types is responsible for parsing the Godot headers for type definitions and generating Go wrappers around that structure.
Package types is a package that parses the GDNative headers for type definitions to create wrapper structures for Go.
Index ¶
- func Generate()
- func GoFmt(filePath string)
- func GoImports(filePath string)
- func WriteTemplate(templatePath, outputPath string, view View)
- type Method
- type TypeDef
- type View
- func (v View) Debug(itm string) string
- func (v View) HasPointerReturn(str string) bool
- func (v View) HasReturn(str string) bool
- func (v View) IsBasicType(str string) bool
- func (v View) IsDoublePointer(str string) bool
- func (v View) IsGodotBaseType(typeDef TypeDef) bool
- func (v View) IsValidProperty(prop TypeDef) bool
- func (v View) IsVoidPointerType(str string) bool
- func (v View) IsWcharT(str string) bool
- func (v View) MethodIsConstructor(method Method) bool
- func (v View) MethodsList(typeDef TypeDef) []Method
- func (v View) NotSelfArg(str string) bool
- func (v View) OutputCArg(arg []string) string
- func (v View) StripPointer(str string) string
- func (v View) ToGoArgName(str string) string
- func (v View) ToGoArgType(str string, parseArray bool) string
- func (v View) ToGoBaseType(base string) string
- func (v View) ToGoMethodName(typeDef TypeDef, method Method) string
- func (v View) ToGoName(str string) string
- func (v View) ToGoReturnType(str string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteTemplate ¶
Types ¶
type TypeDef ¶
type TypeDef struct { Base string // Base will let us know if this is a struct, int, etc. Comment string // Contains the comment on the line of the struct GoName string // The Go type name in camelCase HeaderName string // The header file this type shows up in IsPointer bool // Usually for properties; defines if it is a pointer type Name string // The C type name in snake_case Properties []TypeDef // Optional C struct fields SimpleType bool // Whether or not the definition is just one line long (e.g. bool, int, etc.) }
TypeDef is a structure for holding C type definitions. This is used so we can generate a Go wrapper for all Godot base types.
type View ¶
type View struct { Headers []string TypeDefinitions []TypeDef MethodDefinitions []Method IgnoreMethods []string }
View is a structure that holds the api struct, so it can be used inside our temaplte.
func (View) HasPointerReturn ¶
func (View) IsBasicType ¶
func (View) IsDoublePointer ¶
func (View) IsGodotBaseType ¶
IsGodotBaseType will check to see if the given simple type definition is defining a built-in C type or a Godot type.
func (View) IsValidProperty ¶
IsValidProperty will determine if we should be generating the given property in our Go structure.
func (View) IsVoidPointerType ¶
func (View) MethodIsConstructor ¶
func (View) MethodsList ¶
MethodsList returns all of the methods that match this typedef.
func (View) NotSelfArg ¶
func (View) OutputCArg ¶
OutputCArg will determine if we need to reference, dereference, etc. an argument before passing it to a C function.
func (View) StripPointer ¶
func (View) ToGoArgName ¶
func (View) ToGoBaseType ¶
ToGoBaseType will convert a base type name to the correct Go base type.