// Copyright © 2019 - 2020 Oscar Campos // Copyright © 2017 - William Edwards // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package gdnative // ================================================================== // This file was autogenerated by PimPam GDNative-Go binding tools // Please do not modify this file, any change will be lost // ================================================================== /* #include "gdnative.gen.h" #include // Include all headers for now. TODO: Look up all the required // headers we need to import based on the method arguments and return types. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include */ import "C" import "unsafe" // Error is a Go wrapper for the C.godot_error enum type. type Error int func (e Error) getBase() C.godot_error { return C.godot_error(e) } const ( Ok Error = 0 // (0) Failed Error = 1 // < Generic fail error ErrUnavailable Error = 2 // < What is requested is unsupported/unavailable ErrUnconfigured Error = 3 // < The object being used hasn't been properly set up yet ErrUnauthorized Error = 4 // < Missing credentials for requested resource ErrParameterRangeError Error = 5 // < Parameter given out of range (5) ErrOutOfMemory Error = 6 // < Out of memory ErrFileNotFound Error = 7 ErrFileBadDrive Error = 8 ErrFileBadPath Error = 9 ErrFileNoPermission Error = 10 // (10) ErrFileAlreadyInUse Error = 11 ErrFileCantOpen Error = 12 ErrFileCantWrite Error = 13 ErrFileCantRead Error = 14 ErrFileUnrecognized Error = 15 // (15) ErrFileCorrupt Error = 16 ErrFileMissingDependencies Error = 17 ErrFileEof Error = 18 ErrCantOpen Error = 19 // < Can't open a resource/socket/file ErrCantCreate Error = 20 // (20) ErrQueryFailed Error = 21 ErrAlreadyInUse Error = 22 ErrLocked Error = 23 // < resource is locked ErrTimeout Error = 24 ErrCantConnect Error = 25 // (25) ErrCantResolve Error = 26 ErrConnectionError Error = 27 ErrCantAcquireResource Error = 28 ErrCantFork Error = 29 ErrInvalidData Error = 30 // < Data passed is invalid (30) ErrInvalidParameter Error = 31 // < Parameter passed is invalid ErrAlreadyExists Error = 32 // < When adding, item already exists ErrDoesNotExist Error = 33 // < When retrieving/erasing, it item does not exist ErrDatabaseCantRead Error = 34 // < database is full ErrDatabaseCantWrite Error = 35 // < database is full (35) ErrCompilationFailed Error = 36 ErrMethodNotFound Error = 37 ErrLinkFailed Error = 38 ErrScriptFailed Error = 39 ErrCyclicLink Error = 40 // (40) ErrInvalidDeclaration Error = 41 ErrDuplicateSymbol Error = 42 ErrParseError Error = 43 ErrBusy Error = 44 ErrSkip Error = 45 // (45) ErrHelp Error = 46 // < user requested help!! ErrBug Error = 47 // < a bug in the software certainly happened, due to a double check failing or unexpected behavior. ErrPrinterOnFire Error = 48 // the parallel port printer is engulfed in flames ) // ErrorLookupMap is a string-based lookup table of constants for Error. var ErrorLookupMap = map[string]Error{ "Ok": Ok, "Failed": Failed, "ErrUnavailable": ErrUnavailable, "ErrUnconfigured": ErrUnconfigured, "ErrUnauthorized": ErrUnauthorized, "ErrParameterRangeError": ErrParameterRangeError, "ErrOutOfMemory": ErrOutOfMemory, "ErrFileNotFound": ErrFileNotFound, "ErrFileBadDrive": ErrFileBadDrive, "ErrFileBadPath": ErrFileBadPath, "ErrFileNoPermission": ErrFileNoPermission, "ErrFileAlreadyInUse": ErrFileAlreadyInUse, "ErrFileCantOpen": ErrFileCantOpen, "ErrFileCantWrite": ErrFileCantWrite, "ErrFileCantRead": ErrFileCantRead, "ErrFileUnrecognized": ErrFileUnrecognized, "ErrFileCorrupt": ErrFileCorrupt, "ErrFileMissingDependencies": ErrFileMissingDependencies, "ErrFileEof": ErrFileEof, "ErrCantOpen": ErrCantOpen, "ErrCantCreate": ErrCantCreate, "ErrQueryFailed": ErrQueryFailed, "ErrAlreadyInUse": ErrAlreadyInUse, "ErrLocked": ErrLocked, "ErrTimeout": ErrTimeout, "ErrCantConnect": ErrCantConnect, "ErrCantResolve": ErrCantResolve, "ErrConnectionError": ErrConnectionError, "ErrCantAcquireResource": ErrCantAcquireResource, "ErrCantFork": ErrCantFork, "ErrInvalidData": ErrInvalidData, "ErrInvalidParameter": ErrInvalidParameter, "ErrAlreadyExists": ErrAlreadyExists, "ErrDoesNotExist": ErrDoesNotExist, "ErrDatabaseCantRead": ErrDatabaseCantRead, "ErrDatabaseCantWrite": ErrDatabaseCantWrite, "ErrCompilationFailed": ErrCompilationFailed, "ErrMethodNotFound": ErrMethodNotFound, "ErrLinkFailed": ErrLinkFailed, "ErrScriptFailed": ErrScriptFailed, "ErrCyclicLink": ErrCyclicLink, "ErrInvalidDeclaration": ErrInvalidDeclaration, "ErrDuplicateSymbol": ErrDuplicateSymbol, "ErrParseError": ErrParseError, "ErrBusy": ErrBusy, "ErrSkip": ErrSkip, "ErrHelp": ErrHelp, "ErrBug": ErrBug, "ErrPrinterOnFire": ErrPrinterOnFire, } // NewEmptyBool will return a pointer to an empty // initialized Bool. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyBool() Pointer { var obj C.godot_bool return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromBool will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromBool(obj Bool) Pointer { base := obj.getBase() return Pointer{base: unsafe.Pointer(&base)} } // NewBoolFromPointer will return a Bool from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewBoolFromPointer(ptr Pointer) Bool { base := ptr.getBase() return Bool(*(*C.godot_bool)(base)) } // Bool is a Go wrapper for the base C.godot_bool type type Bool bool func (t Bool) getBase() C.godot_bool { return C.godot_bool(t) } // NewEmptyInt will return a pointer to an empty // initialized Int. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyInt() Pointer { var obj C.godot_int return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromInt will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromInt(obj Int) Pointer { base := obj.getBase() return Pointer{base: unsafe.Pointer(&base)} } // NewIntFromPointer will return a Int from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewIntFromPointer(ptr Pointer) Int { base := ptr.getBase() return Int(*(*C.godot_int)(base)) } // Int is a Go wrapper for the base C.godot_int type type Int int func (t Int) getBase() C.godot_int { return C.godot_int(t) } // NewEmptyReal will return a pointer to an empty // initialized Real. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyReal() Pointer { var obj C.godot_real return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromReal will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromReal(obj Real) Pointer { base := obj.getBase() return Pointer{base: unsafe.Pointer(&base)} } // NewRealFromPointer will return a Real from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewRealFromPointer(ptr Pointer) Real { base := ptr.getBase() return Real(*(*C.godot_real)(base)) } // Real is a Go wrapper for the base C.godot_real type type Real float64 func (t Real) getBase() C.godot_real { return C.godot_real(t) } // NewEmptyObject will return a pointer to an empty // initialized Object. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyObject() Pointer { var obj C.godot_object return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromObject will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromObject(obj Object) Pointer { return Pointer{base: unsafe.Pointer(obj.getBase())} } // NewObjectFromPointer will return a Object from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewObjectFromPointer(ptr Pointer) Object { obj := (**C.godot_object)(ptr.getBase()) return Object{base: *obj} } // Object data structure wrapper type Object struct { base *C.godot_object } // returns the wrapped C base data type for this type func (gdt Object) getBase() *C.godot_object { return gdt.base } // NewEmptyMethodBind will return a pointer to an empty // initialized MethodBind. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyMethodBind() Pointer { var obj C.godot_method_bind return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromMethodBind will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromMethodBind(obj MethodBind) Pointer { return Pointer{base: unsafe.Pointer(obj.getBase())} } // NewMethodBindFromPointer will return a MethodBind from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewMethodBindFromPointer(ptr Pointer) MethodBind { return MethodBind{base: (*C.godot_method_bind)(ptr.getBase())} } // MethodBind data structure wrapper type MethodBind struct { base *C.godot_method_bind } // returns the wrapped C base data type for this type func (gdt MethodBind) getBase() *C.godot_method_bind { return gdt.base } // NewEmptyGdnativeApiVersion will return a pointer to an empty // initialized GdnativeApiVersion. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyGdnativeApiVersion() Pointer { var obj C.godot_gdnative_api_version return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromGdnativeApiVersion will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromGdnativeApiVersion(obj GdnativeApiVersion) Pointer { return Pointer{base: unsafe.Pointer(obj.getBase())} } // NewGdnativeApiVersionFromPointer will return a GdnativeApiVersion from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewGdnativeApiVersionFromPointer(ptr Pointer) GdnativeApiVersion { return GdnativeApiVersion{base: (*C.godot_gdnative_api_version)(ptr.getBase())} } // GdnativeApiVersion data structure wrapper type GdnativeApiVersion struct { base *C.godot_gdnative_api_version Major Uint Minor Uint } // returns the wrapped C base data type for this type func (gdt GdnativeApiVersion) getBase() *C.godot_gdnative_api_version { return gdt.base } // NewEmptyGdnativeTerminateOptions will return a pointer to an empty // initialized GdnativeTerminateOptions. This is primarily used in // conjunction with MethodBindPtrCall. func NewEmptyGdnativeTerminateOptions() Pointer { var obj C.godot_gdnative_terminate_options return Pointer{base: unsafe.Pointer(&obj)} } // NewPointerFromGdnativeTerminateOptions will return an unsafe pointer to the given // object. This is primarily used in conjunction with MethodBindPtrCall. func NewPointerFromGdnativeTerminateOptions(obj GdnativeTerminateOptions) Pointer { return Pointer{base: unsafe.Pointer(obj.getBase())} } // NewGdnativeTerminateOptionsFromPointer will return a GdnativeTerminateOptions from the // given unsafe pointer. This is primarily used in conjunction with MethodBindPtrCall. func NewGdnativeTerminateOptionsFromPointer(ptr Pointer) GdnativeTerminateOptions { return GdnativeTerminateOptions{base: (*C.godot_gdnative_terminate_options)(ptr.getBase())} } // GdnativeTerminateOptions data structure wrapper type GdnativeTerminateOptions struct { base *C.godot_gdnative_terminate_options InEditor Bool } // returns the wrapped C base data type for this type func (gdt GdnativeTerminateOptions) getBase() *C.godot_gdnative_terminate_options { return gdt.base }