gdnativeapijson

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApiNameMap = map[string]ApiMetadata{
	"CORE:1.0":         {"CoreApi", "godot_gdnative_core_api_struct"},
	"CORE:1.1":         {"Core11Api", "godot_gdnative_core_1_1_api_struct"},
	"CORE:1.2":         {"Core12Api", "godot_gdnative_core_1_2_api_struct"},
	"NATIVESCRIPT:1.0": {"NativescriptApi", "godot_gdnative_ext_nativescript_api_struct"},
	"NATIVESCRIPT:1.1": {"Nativescript11Api", "godot_gdnative_ext_nativescript_1_1_api_struct"},
}

Functions

func ToGoTypeName

func ToGoTypeName(value string) (string, classes.Usage)

ToGoTypeName convert the C type into the expected Go type

func ToPascalCase

func ToPascalCase(value string) string

Types

type APIJson

type APIJson struct {
	Core       APIVersion   `json:"core"`
	Extensions []APIVersion `json:"extensions"`
}

ApiVersions is a structure based on `gdnative_api.json` in `godot_headers`.

func ParseGdnativeApiJson

func ParseGdnativeApiJson(packagePath string) APIJson

ParseGdnativeApiJson parses gdnative_api.json into a APIJson struct.

type APIVersion

type APIVersion struct {
	Name    *string `json:"name"`
	Type    string  `json:"type"`
	Version struct {
		Major int `json:"major"`
		Minor int `json:"minor"`
	} `json:"version"`
	Next *APIVersion  `json:"next"`
	API  ApiFunctions `json:"api"`
	// contains filtered or unexported fields
}

APIVersion is a single APIVersion definition in `gdnative_api.json`

func (*APIVersion) AllVersions

func (a *APIVersion) AllVersions() []APIVersion

func (*APIVersion) StructTypeAndVersion

func (a *APIVersion) StructTypeAndVersion(structType string) string

type ApiFunction

type ApiFunction struct {
	Name       ApiFunctionName `json:"name"`
	ReturnType string          `json:"return_type"`
	Arguments  Arguments       `json:"arguments"`
}

func (ApiFunction) IsConstructor

func (f ApiFunction) IsConstructor() bool

func (ApiFunction) ToGoMethod

func (f ApiFunction) ToGoMethod(apiMetadata ApiMetadata) GoMethod

type ApiFunctionName

type ApiFunctionName string

type ApiFunctions

type ApiFunctions []ApiFunction

type ApiMetadata

type ApiMetadata struct {
	Name  string
	CType string
}

ApiMetadata represents the Go GDNative API struct

type Argument

type Argument []string

func (*Argument) FunctionArgument

func (a *Argument) FunctionArgument() string

type Arguments

type Arguments []Argument

func (*Arguments) DataTypeRegexMatch

func (as *Arguments) DataTypeRegexMatch(r *regexp.Regexp) bool

func (Arguments) ToDestAndArguments

func (as Arguments) ToDestAndArguments() (*GoArgument, []GoArgument)

type GoArgument

type GoArgument struct {
	Type GoType
	Name string
}

type GoMethod

type GoMethod struct {
	Name         string
	GoMethodType GoMethodType
	ReturnType   GoType
	Receiver     *GoArgument
	Arguments    []GoArgument
	CName        string
	ApiMetadata  ApiMetadata
}

func (*GoMethod) IsSetter

func (t *GoMethod) IsSetter() bool

func (*GoMethod) IsStringNameReceiver

func (t *GoMethod) IsStringNameReceiver() bool

func (*GoMethod) IsStringNameReturnType

func (t *GoMethod) IsStringNameReturnType() bool

func (*GoMethod) IsStringReceiver

func (t *GoMethod) IsStringReceiver() bool

func (*GoMethod) IsStringReturnType

func (t *GoMethod) IsStringReturnType() bool

type GoMethodType

type GoMethodType int8

GoMethodType represents categories for each gdnative function exposed.

const (
	// UnknownGoMethodType represents an unexpected parsing error.
	UnknownGoMethodType GoMethodType = iota

	// ConstructorGoMethodType is the constructor type.
	ConstructorGoMethodType

	// GlobalGoMethodType is a global function type.
	GlobalGoMethodType

	// ReceiverGoMethodType is a receiver method type.
	ReceiverGoMethodType
)

type GoProperty

type GoProperty struct {
	Base      string // Base will let us know if this is a struct, int, etc.
	Name      string // The Go type name in camelCase
	CName     string // The C type name in snake_case
	Comment   string // Contains the comment on the line of the struct
	IsPointer bool   // Usually for properties; defines if it is a pointer type
}

type GoType

type GoType struct {
	HasConst      bool
	ReferenceType ReferenceType
	CName         string
	GoName        string
}

func NewGoType

func NewGoType(hasConst bool, referenceType ReferenceType, cName string) GoType

func (GoType) IsCharPointer

func (t GoType) IsCharPointer() bool

func (GoType) IsGoPrimative

func (t GoType) IsGoPrimative() bool

func (GoType) IsGodotObjectPointer

func (t GoType) IsGodotObjectPointer() bool

func (GoType) IsGodotVariantPointerArray

func (t GoType) IsGodotVariantPointerArray() bool

func (GoType) IsMethodBindPointer

func (t GoType) IsMethodBindPointer() bool

func (GoType) IsPointer

func (t GoType) IsPointer() bool

func (GoType) IsPointerArray

func (t GoType) IsPointerArray() bool

func (GoType) IsString

func (t GoType) IsString() bool

func (GoType) IsStringName

func (t GoType) IsStringName() bool

func (GoType) IsVoidPointer

func (t GoType) IsVoidPointer() bool

func (GoType) IsVoidPointerArray

func (t GoType) IsVoidPointerArray() bool

func (GoType) NoReturnValue

func (t GoType) NoReturnValue() bool

type GoTypeDef

type GoTypeDef struct {
	Base            string        // C Typedef tag
	Comment         string        // Contains the comment on the line of the struct
	Name            string        // The Go type name in camelCase
	CHeaderFilename string        // The header filename this type shows up in
	IsPointer       bool          // Usually for properties; defines if it is a pointer type
	CName           string        // The C type name in snake_case
	Properties      []GoProperty  // Optional C struct fields
	Usage           classes.Usage // Usage of the type
	Constructors    []GoMethod
	Methods         []GoMethod
}

GoTypeDef represents the C Typedef in the godot_headers

func (GoTypeDef) HasDestroyMethod

func (o GoTypeDef) HasDestroyMethod() bool

type ReferenceType

type ReferenceType int8
const (
	NoneReferenceType ReferenceType = iota
	PointerReferenceType
	PointerArrayReferenceType
)

Jump to

Keyboard shortcuts

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