classes

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CoreApiType = iota
	ToolsApiType
)

Variables

View Source
var CToGoValueTypeMap = map[string]string{
	"bool":               "bool",
	"uint8_t":            "uint8",
	"uint32_t":           "uint32",
	"uint64_t":           "uint64",
	"int64_t":            "int64",
	"double":             "float64",
	"wchar_t":            "int32",
	"char":               "C.char",
	"int":                "int32",
	"size_t":             "int64",
	"void":               "void",
	"string":             "string",
	"float":              "float32",
	"godot_real":         "float32",
	"godot_bool":         "bool",
	"godot_int":          "int32",
	"godot_object":       "GodotObject",
	"godot_vector3_axis": "Vector3Axis",
	"godot_variant_type": "VariantType",
	"godot_error":        "Error",
	"godot_string":       "String",
}

CToGoValueTypeMap proves a translation between C to Go

Functions

func AssertIsDirectory

func AssertIsDirectory(dirPath string) error

func Generate

func Generate(packagePath string)

Generate reads in Godot's api.json and generates codegen of all the classes

func GoType

func GoType(value string) string

GoType converts types in the api.json into generated Go types.

func GoTypeUsage

func GoTypeUsage(value string) string

GoTypeUsage converts types in the api.json into generated Go types.

func WriteTemplate

func WriteTemplate(outfile *os.File, tmpl *template.Template, view interface{})

WriteTemplate writes the output of the specified template to outfile.

Types

type ApiType

type ApiType int8

func ParseApiType

func ParseApiType(value string) ApiType

type ApiTypeBaseClassIndex

type ApiTypeBaseClassIndex map[string]map[string][]GDAPI

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 ByName

type ByName []GDAPI

ByName is used for sorting GDAPI objects by name

func (ByName) Len

func (c ByName) Len() int

func (ByName) Less

func (c ByName) Less(i, j int) bool

func (ByName) Swap

func (c ByName) 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 Constants

type Constants map[string]int64

type GDAPI

type GDAPI struct {
	APIType       string       `json:"api_type"`
	BaseClass     string       `json:"base_class"`
	Constants     Constants    `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"`
	SingletonName string       `json:"singleton_name"`
	Instanciable  bool         `json:"Instanciable"`
	IsReference   bool         `json:"is_reference"`
}

GDAPI is a structure for parsed JSON from godot_api.json.

func (GDAPI) ApiType

func (a GDAPI) ApiType() ApiType

func (GDAPI) ConstantPrefixName

func (a GDAPI) ConstantPrefixName() string

func (GDAPI) GoMethods

func (a GDAPI) GoMethods() []GDMethod

func (GDAPI) HasEnumValue

func (a GDAPI) HasEnumValue(value string) bool

func (GDAPI) ParentInterface

func (a GDAPI) ParentInterface() string

func (GDAPI) PrefixName

func (a GDAPI) PrefixName() string

func (GDAPI) PrivatePrefixName

func (a GDAPI) PrivatePrefixName() string

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 GDAPIs

type GDAPIs []GDAPI

func (GDAPIs) FilterForObject

func (a GDAPIs) FilterForObject(index gdapiPathIndex) GDAPIs

func (GDAPIs) PartitionByBaseApiTypeAndClass

func (a GDAPIs) PartitionByBaseApiTypeAndClass() ApiTypeBaseClassIndex

type GDArgument

type GDArgument struct {
	DefaultValue    string `json:"default_value"`
	HasDefaultValue bool   `json:"has_default_value"`
	Name            string `json:"name"`
	Type            string `json:"type"`
}

func (GDArgument) GoName

func (m GDArgument) GoName() string

type GDEnums

type GDEnums struct {
	Name   string           `json:"name"`
	Values map[string]int64 `json:"values"`
}

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"`
}

func (GDMethod) CReturnType

func (m GDMethod) CReturnType() string

func (GDMethod) GoName

func (m GDMethod) GoName() string

func (GDMethod) IsBuiltinReturnType

func (m GDMethod) IsBuiltinReturnType() bool

func (GDMethod) MethodBindName

func (m GDMethod) MethodBindName() string

type GDMethodDoc

type GDMethodDoc struct {
	Name        string `xml:"name,attr"`
	Description string `xml:"description"`
}

type GDProperty

type GDProperty struct {
	Getter string `json:"getter"`
	Name   string `json:"name"`
	Setter string `json:"setter"`
	Type   string `json:"type"`
}

type GDSignal

type GDSignal struct {
	Arguments []GDArgument `json:"arguments"`
	Name      string       `json:"name"`
}

type Usage

type Usage int8

Usage is an enum type categorizing data types for parsing and generating NativeScript classes.

const (
	USAGE_VOID Usage = iota
	USAGE_GO_PRIMATIVE
	USAGE_GDNATIVE_CONST_OR_ENUM
	USAGE_GODOT_STRING
	USAGE_GODOT_STRING_NAME
	USAGE_GDNATIVE_REF
	USAGE_GODOT_CONST_OR_ENUM
	USAGE_GODOT_CLASS
)

func GoTypeAndUsage

func GoTypeAndUsage(value string) (string, Usage)

func (Usage) String

func (u Usage) String() string

Jump to

Keyboard shortcuts

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