Documentation ¶
Index ¶
- func Generate()
- func GoFmt(filePath string)
- func GoImports(filePath string)
- func WriteTemplate(templatePath, outputPath string, view View)
- type ByEnumName
- type ByMethodName
- type ByName
- type ByPropertyName
- type BySignalName
- type GDAPI
- type GDAPIDoc
- type GDArgument
- type GDEnums
- type GDMethod
- type GDMethodDoc
- type GDProperty
- type GDSignal
- type View
- func (v View) ClassDoc(class string) string
- func (v View) GetImports() []string
- func (v View) GoArgName(argString string) string
- func (v View) GoClassName(classString string) string
- func (v View) GoEmptyReturnType(str string) string
- func (v View) GoMethodName(methodString string) string
- func (v View) GoName(str string) string
- func (v View) GoNewFromPointerType(str string) string
- func (v View) GoValue(returnString string) string
- func (v View) HasParentMethod(base, method string) bool
- func (v View) IsEnum(str string) bool
- func (v View) IsGodotClass(str string) bool
- func (v View) IsValidClass(classString, inheritsString string) bool
- func (v View) MethodDoc(class, method string) string
- func (v View) PackageName(classString string) string
- func (v View) ResolvePackage(curPkg, api string) string
- func (v View) SetBaseClassName(baseClass string) string
- func (v View) SetClassName(classString string, singleton bool) string
- func (v View) Trim(str string) string
- func (v View) UltraTrim(input string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteTemplate ¶
Types ¶
type ByEnumName ¶
type ByEnumName []GDEnums
ByEnumName is used for sorting GDAPI objects by name
func (ByEnumName) Len ¶
func (c ByEnumName) Len() int
func (ByEnumName) Less ¶
func (c ByEnumName) Less(i, j int) bool
func (ByEnumName) Swap ¶
func (c ByEnumName) Swap(i, j int)
type ByMethodName ¶
type ByMethodName []GDMethod
ByMethodName is used for sorting GDAPI objects by name
func (ByMethodName) Len ¶
func (c ByMethodName) Len() int
func (ByMethodName) Less ¶
func (c ByMethodName) Less(i, j int) bool
func (ByMethodName) Swap ¶
func (c ByMethodName) Swap(i, j int)
type ByPropertyName ¶
type ByPropertyName []GDProperty
ByPropertyName is used for sorting GDAPI objects by name
func (ByPropertyName) Len ¶
func (c ByPropertyName) Len() int
func (ByPropertyName) Less ¶
func (c ByPropertyName) Less(i, j int) bool
func (ByPropertyName) Swap ¶
func (c ByPropertyName) Swap(i, j int)
type BySignalName ¶
type BySignalName []GDSignal
BySignalName is used for sorting GDAPI objects by name
func (BySignalName) Len ¶
func (c BySignalName) Len() int
func (BySignalName) Less ¶
func (c BySignalName) Less(i, j int) bool
func (BySignalName) Swap ¶
func (c BySignalName) Swap(i, j int)
type GDAPI ¶
type GDAPI struct { APIType string `json:"api_type"` BaseClass string `json:"base_class"` Constants map[string]int64 `json:"constants"` Enums []GDEnums `json:"enums"` Methods []GDMethod `json:"methods"` Name string `json:"name"` Properties []GDProperty `json:"properties"` Signals []GDSignal `json:"signals"` Singleton bool `json:"singleton"` Instanciable bool `json:"instanciable"` IsReference bool `json:"is_reference"` }
GDAPI is a structure for parsed JSON from godot_api.json.
type GDAPIDoc ¶
type GDAPIDoc struct { Name string `xml:"name,attr"` Description string `xml:"description"` Methods []GDMethodDoc `xml:"methods>method"` }
GDAPIDoc is a structure for parsed documentation.
type GDArgument ¶
type GDMethod ¶
type GDMethod struct { Arguments []GDArgument `json:"arguments"` HasVarargs bool `json:"has_varargs"` IsConst bool `json:"is_const"` IsEditor bool `json:"is_editor"` IsFromScript bool `json:"is_from_script"` IsNoscript bool `json:"is_noscript"` IsReverse bool `json:"is_reverse"` IsVirtual bool `json:"is_virtual"` Name string `json:"name"` ReturnType string `json:"return_type"` }
type GDMethodDoc ¶
type GDProperty ¶
type GDSignal ¶
type GDSignal struct { Arguments []GDArgument `json:"arguments"` Name string `json:"name"` }
type View ¶
type View struct { API GDAPI APIs []GDAPI Package string PackageMap map[string]string Imports map[string]map[string]bool ClassDocs map[string]string MethodDocs map[string]map[string]string SingletonMap map[string]bool }
View is a structure that holds the api classes struct, but has additional methods attached to it that we can call inside our template.
func (View) GetImports ¶
func (View) GoArgName ¶
GoArgName will check for Go reserved keywords like "type" when used as argument names and convert them, so we don't get compile errors.
func (View) GoClassName ¶
GoClassName will convert any _<Name> classes into normal CamelCase names.
func (View) GoEmptyReturnType ¶
func (View) GoMethodName ¶
GoMethodName will convert the snake_case'd version of the Godot method name into a CamelCase version that is the Go convention.
func (View) GoNewFromPointerType ¶
func (View) HasParentMethod ¶
HasParentMethod checks to see if the given method exists in any of its parents. It will recursively search for any parent with the given method name. This is used to generate interfaces for every Godot class type.
func (View) IsGodotClass ¶
IsGodotClass will determine if the given string is the name of a Godot class API. This is used to check if a type is another class or a gdnative base type.
func (View) IsValidClass ¶
IsValidClass will check the class to see if we should generate Go bindings for it.
func (View) PackageName ¶
func (View) ResolvePackage ¶
ResolvePackage will look up the api in the package map for the Go package name that we should use.