| 1 | /**************************************************************************/ |
| 2 | /* gdextension_interface.h */ |
| 3 | /**************************************************************************/ |
| 4 | /* This file is part of: */ |
| 5 | /* GODOT ENGINE */ |
| 6 | /* https://godotengine.org */ |
| 7 | /**************************************************************************/ |
| 8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
| 9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
| 10 | /* */ |
| 11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
| 12 | /* a copy of this software and associated documentation files (the */ |
| 13 | /* "Software"), to deal in the Software without restriction, including */ |
| 14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
| 15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
| 16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
| 17 | /* the following conditions: */ |
| 18 | /* */ |
| 19 | /* The above copyright notice and this permission notice shall be */ |
| 20 | /* included in all copies or substantial portions of the Software. */ |
| 21 | /* */ |
| 22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
| 23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
| 24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
| 25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
| 26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
| 27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
| 28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 29 | /**************************************************************************/ |
| 30 | |
| 31 | #ifndef GDEXTENSION_INTERFACE_H |
| 32 | #define GDEXTENSION_INTERFACE_H |
| 33 | |
| 34 | /* This is a C class header, you can copy it and use it directly in your own binders. |
| 35 | * Together with the JSON file, you should be able to generate any binder. |
| 36 | */ |
| 37 | |
| 38 | #include <stddef.h> |
| 39 | #include <stdint.h> |
| 40 | |
| 41 | #ifndef __cplusplus |
| 42 | typedef uint32_t char32_t; |
| 43 | typedef uint16_t char16_t; |
| 44 | #endif |
| 45 | |
| 46 | #ifdef __cplusplus |
| 47 | extern "C" { |
| 48 | #endif |
| 49 | |
| 50 | /* VARIANT TYPES */ |
| 51 | |
| 52 | typedef enum { |
| 53 | GDEXTENSION_VARIANT_TYPE_NIL, |
| 54 | |
| 55 | /* atomic types */ |
| 56 | GDEXTENSION_VARIANT_TYPE_BOOL, |
| 57 | GDEXTENSION_VARIANT_TYPE_INT, |
| 58 | GDEXTENSION_VARIANT_TYPE_FLOAT, |
| 59 | GDEXTENSION_VARIANT_TYPE_STRING, |
| 60 | |
| 61 | /* math types */ |
| 62 | GDEXTENSION_VARIANT_TYPE_VECTOR2, |
| 63 | GDEXTENSION_VARIANT_TYPE_VECTOR2I, |
| 64 | GDEXTENSION_VARIANT_TYPE_RECT2, |
| 65 | GDEXTENSION_VARIANT_TYPE_RECT2I, |
| 66 | GDEXTENSION_VARIANT_TYPE_VECTOR3, |
| 67 | GDEXTENSION_VARIANT_TYPE_VECTOR3I, |
| 68 | GDEXTENSION_VARIANT_TYPE_TRANSFORM2D, |
| 69 | GDEXTENSION_VARIANT_TYPE_VECTOR4, |
| 70 | GDEXTENSION_VARIANT_TYPE_VECTOR4I, |
| 71 | GDEXTENSION_VARIANT_TYPE_PLANE, |
| 72 | GDEXTENSION_VARIANT_TYPE_QUATERNION, |
| 73 | GDEXTENSION_VARIANT_TYPE_AABB, |
| 74 | GDEXTENSION_VARIANT_TYPE_BASIS, |
| 75 | GDEXTENSION_VARIANT_TYPE_TRANSFORM3D, |
| 76 | GDEXTENSION_VARIANT_TYPE_PROJECTION, |
| 77 | |
| 78 | /* misc types */ |
| 79 | GDEXTENSION_VARIANT_TYPE_COLOR, |
| 80 | GDEXTENSION_VARIANT_TYPE_STRING_NAME, |
| 81 | GDEXTENSION_VARIANT_TYPE_NODE_PATH, |
| 82 | GDEXTENSION_VARIANT_TYPE_RID, |
| 83 | GDEXTENSION_VARIANT_TYPE_OBJECT, |
| 84 | GDEXTENSION_VARIANT_TYPE_CALLABLE, |
| 85 | GDEXTENSION_VARIANT_TYPE_SIGNAL, |
| 86 | GDEXTENSION_VARIANT_TYPE_DICTIONARY, |
| 87 | GDEXTENSION_VARIANT_TYPE_ARRAY, |
| 88 | |
| 89 | /* typed arrays */ |
| 90 | GDEXTENSION_VARIANT_TYPE_PACKED_BYTE_ARRAY, |
| 91 | GDEXTENSION_VARIANT_TYPE_PACKED_INT32_ARRAY, |
| 92 | GDEXTENSION_VARIANT_TYPE_PACKED_INT64_ARRAY, |
| 93 | GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT32_ARRAY, |
| 94 | GDEXTENSION_VARIANT_TYPE_PACKED_FLOAT64_ARRAY, |
| 95 | GDEXTENSION_VARIANT_TYPE_PACKED_STRING_ARRAY, |
| 96 | GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, |
| 97 | GDEXTENSION_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, |
| 98 | GDEXTENSION_VARIANT_TYPE_PACKED_COLOR_ARRAY, |
| 99 | |
| 100 | GDEXTENSION_VARIANT_TYPE_VARIANT_MAX |
| 101 | } GDExtensionVariantType; |
| 102 | |
| 103 | typedef enum { |
| 104 | /* comparison */ |
| 105 | GDEXTENSION_VARIANT_OP_EQUAL, |
| 106 | GDEXTENSION_VARIANT_OP_NOT_EQUAL, |
| 107 | GDEXTENSION_VARIANT_OP_LESS, |
| 108 | GDEXTENSION_VARIANT_OP_LESS_EQUAL, |
| 109 | GDEXTENSION_VARIANT_OP_GREATER, |
| 110 | GDEXTENSION_VARIANT_OP_GREATER_EQUAL, |
| 111 | |
| 112 | /* mathematic */ |
| 113 | GDEXTENSION_VARIANT_OP_ADD, |
| 114 | GDEXTENSION_VARIANT_OP_SUBTRACT, |
| 115 | GDEXTENSION_VARIANT_OP_MULTIPLY, |
| 116 | GDEXTENSION_VARIANT_OP_DIVIDE, |
| 117 | GDEXTENSION_VARIANT_OP_NEGATE, |
| 118 | GDEXTENSION_VARIANT_OP_POSITIVE, |
| 119 | GDEXTENSION_VARIANT_OP_MODULE, |
| 120 | GDEXTENSION_VARIANT_OP_POWER, |
| 121 | |
| 122 | /* bitwise */ |
| 123 | GDEXTENSION_VARIANT_OP_SHIFT_LEFT, |
| 124 | GDEXTENSION_VARIANT_OP_SHIFT_RIGHT, |
| 125 | GDEXTENSION_VARIANT_OP_BIT_AND, |
| 126 | GDEXTENSION_VARIANT_OP_BIT_OR, |
| 127 | GDEXTENSION_VARIANT_OP_BIT_XOR, |
| 128 | GDEXTENSION_VARIANT_OP_BIT_NEGATE, |
| 129 | |
| 130 | /* logic */ |
| 131 | GDEXTENSION_VARIANT_OP_AND, |
| 132 | GDEXTENSION_VARIANT_OP_OR, |
| 133 | GDEXTENSION_VARIANT_OP_XOR, |
| 134 | GDEXTENSION_VARIANT_OP_NOT, |
| 135 | |
| 136 | /* containment */ |
| 137 | GDEXTENSION_VARIANT_OP_IN, |
| 138 | GDEXTENSION_VARIANT_OP_MAX |
| 139 | |
| 140 | } GDExtensionVariantOperator; |
| 141 | |
| 142 | // In this API there are multiple functions which expect the caller to pass a pointer |
| 143 | // on return value as parameter. |
| 144 | // In order to make it clear if the caller should initialize the return value or not |
| 145 | // we have two flavor of types: |
| 146 | // - `GDExtensionXXXPtr` for pointer on an initialized value |
| 147 | // - `GDExtensionUninitializedXXXPtr` for pointer on uninitialized value |
| 148 | // |
| 149 | // Notes: |
| 150 | // - Not respecting those requirements can seems harmless, but will lead to unexpected |
| 151 | // segfault or memory leak (for instance with a specific compiler/OS, or when two |
| 152 | // native extensions start doing ptrcall on each other). |
| 153 | // - Initialization must be done with the function pointer returned by `variant_get_ptr_constructor`, |
| 154 | // zero-initializing the variable should not be considered a valid initialization method here ! |
| 155 | // - Some types have no destructor (see `extension_api.json`'s `has_destructor` field), for |
| 156 | // them it is always safe to skip the constructor for the return value if you are in a hurry ;-) |
| 157 | |
| 158 | typedef void *GDExtensionVariantPtr; |
| 159 | typedef const void *GDExtensionConstVariantPtr; |
| 160 | typedef void *GDExtensionUninitializedVariantPtr; |
| 161 | typedef void *GDExtensionStringNamePtr; |
| 162 | typedef const void *GDExtensionConstStringNamePtr; |
| 163 | typedef void *GDExtensionUninitializedStringNamePtr; |
| 164 | typedef void *GDExtensionStringPtr; |
| 165 | typedef const void *GDExtensionConstStringPtr; |
| 166 | typedef void *GDExtensionUninitializedStringPtr; |
| 167 | typedef void *GDExtensionObjectPtr; |
| 168 | typedef const void *GDExtensionConstObjectPtr; |
| 169 | typedef void *GDExtensionUninitializedObjectPtr; |
| 170 | typedef void *GDExtensionTypePtr; |
| 171 | typedef const void *GDExtensionConstTypePtr; |
| 172 | typedef void *GDExtensionUninitializedTypePtr; |
| 173 | typedef const void *GDExtensionMethodBindPtr; |
| 174 | typedef int64_t GDExtensionInt; |
| 175 | typedef uint8_t GDExtensionBool; |
| 176 | typedef uint64_t GDObjectInstanceID; |
| 177 | typedef void *GDExtensionRefPtr; |
| 178 | typedef const void *GDExtensionConstRefPtr; |
| 179 | |
| 180 | /* VARIANT DATA I/O */ |
| 181 | |
| 182 | typedef enum { |
| 183 | GDEXTENSION_CALL_OK, |
| 184 | GDEXTENSION_CALL_ERROR_INVALID_METHOD, |
| 185 | GDEXTENSION_CALL_ERROR_INVALID_ARGUMENT, // Expected a different variant type. |
| 186 | GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS, // Expected lower number of arguments. |
| 187 | GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS, // Expected higher number of arguments. |
| 188 | GDEXTENSION_CALL_ERROR_INSTANCE_IS_NULL, |
| 189 | GDEXTENSION_CALL_ERROR_METHOD_NOT_CONST, // Used for const call. |
| 190 | } GDExtensionCallErrorType; |
| 191 | |
| 192 | typedef struct { |
| 193 | GDExtensionCallErrorType error; |
| 194 | int32_t argument; |
| 195 | int32_t expected; |
| 196 | } GDExtensionCallError; |
| 197 | |
| 198 | typedef void (*GDExtensionVariantFromTypeConstructorFunc)(GDExtensionUninitializedVariantPtr, GDExtensionTypePtr); |
| 199 | typedef void (*GDExtensionTypeFromVariantConstructorFunc)(GDExtensionUninitializedTypePtr, GDExtensionVariantPtr); |
| 200 | typedef void (*GDExtensionPtrOperatorEvaluator)(GDExtensionConstTypePtr p_left, GDExtensionConstTypePtr p_right, GDExtensionTypePtr r_result); |
| 201 | typedef void (*GDExtensionPtrBuiltInMethod)(GDExtensionTypePtr p_base, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_return, int p_argument_count); |
| 202 | typedef void (*GDExtensionPtrConstructor)(GDExtensionUninitializedTypePtr p_base, const GDExtensionConstTypePtr *p_args); |
| 203 | typedef void (*GDExtensionPtrDestructor)(GDExtensionTypePtr p_base); |
| 204 | typedef void (*GDExtensionPtrSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_value); |
| 205 | typedef void (*GDExtensionPtrGetter)(GDExtensionConstTypePtr p_base, GDExtensionTypePtr r_value); |
| 206 | typedef void (*GDExtensionPtrIndexedSetter)(GDExtensionTypePtr p_base, GDExtensionInt p_index, GDExtensionConstTypePtr p_value); |
| 207 | typedef void (*GDExtensionPtrIndexedGetter)(GDExtensionConstTypePtr p_base, GDExtensionInt p_index, GDExtensionTypePtr r_value); |
| 208 | typedef void (*GDExtensionPtrKeyedSetter)(GDExtensionTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionConstTypePtr p_value); |
| 209 | typedef void (*GDExtensionPtrKeyedGetter)(GDExtensionConstTypePtr p_base, GDExtensionConstTypePtr p_key, GDExtensionTypePtr r_value); |
| 210 | typedef uint32_t (*GDExtensionPtrKeyedChecker)(GDExtensionConstVariantPtr p_base, GDExtensionConstVariantPtr p_key); |
| 211 | typedef void (*GDExtensionPtrUtilityFunction)(GDExtensionTypePtr r_return, const GDExtensionConstTypePtr *p_args, int p_argument_count); |
| 212 | |
| 213 | typedef GDExtensionObjectPtr (*GDExtensionClassConstructor)(); |
| 214 | |
| 215 | typedef void *(*GDExtensionInstanceBindingCreateCallback)(void *p_token, void *p_instance); |
| 216 | typedef void (*GDExtensionInstanceBindingFreeCallback)(void *p_token, void *p_instance, void *p_binding); |
| 217 | typedef GDExtensionBool (*GDExtensionInstanceBindingReferenceCallback)(void *p_token, void *p_binding, GDExtensionBool p_reference); |
| 218 | |
| 219 | typedef struct { |
| 220 | GDExtensionInstanceBindingCreateCallback create_callback; |
| 221 | GDExtensionInstanceBindingFreeCallback free_callback; |
| 222 | GDExtensionInstanceBindingReferenceCallback reference_callback; |
| 223 | } GDExtensionInstanceBindingCallbacks; |
| 224 | |
| 225 | /* EXTENSION CLASSES */ |
| 226 | |
| 227 | typedef void *GDExtensionClassInstancePtr; |
| 228 | |
| 229 | typedef GDExtensionBool (*GDExtensionClassSet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value); |
| 230 | typedef GDExtensionBool (*GDExtensionClassGet)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); |
| 231 | typedef uint64_t (*GDExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance); |
| 232 | |
| 233 | typedef struct { |
| 234 | GDExtensionVariantType type; |
| 235 | GDExtensionStringNamePtr name; |
| 236 | GDExtensionStringNamePtr class_name; |
| 237 | uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`). |
| 238 | GDExtensionStringPtr hint_string; |
| 239 | uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`). |
| 240 | } GDExtensionPropertyInfo; |
| 241 | |
| 242 | typedef struct { |
| 243 | GDExtensionStringNamePtr name; |
| 244 | GDExtensionPropertyInfo return_value; |
| 245 | uint32_t flags; // Bitfield of `GDExtensionClassMethodFlags`. |
| 246 | int32_t id; |
| 247 | |
| 248 | /* Arguments: `default_arguments` is an array of size `argument_count`. */ |
| 249 | uint32_t argument_count; |
| 250 | GDExtensionPropertyInfo *arguments; |
| 251 | |
| 252 | /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ |
| 253 | uint32_t default_argument_count; |
| 254 | GDExtensionVariantPtr *default_arguments; |
| 255 | } GDExtensionMethodInfo; |
| 256 | |
| 257 | typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count); |
| 258 | typedef void (*GDExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list); |
| 259 | typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name); |
| 260 | typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); |
| 261 | typedef GDExtensionBool (*GDExtensionClassValidateProperty)(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property); |
| 262 | typedef void (*GDExtensionClassNotification)(GDExtensionClassInstancePtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionClassNotification2 instead. |
| 263 | typedef void (*GDExtensionClassNotification2)(GDExtensionClassInstancePtr p_instance, int32_t p_what, GDExtensionBool p_reversed); |
| 264 | typedef void (*GDExtensionClassToString)(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out); |
| 265 | typedef void (*GDExtensionClassReference)(GDExtensionClassInstancePtr p_instance); |
| 266 | typedef void (*GDExtensionClassUnreference)(GDExtensionClassInstancePtr p_instance); |
| 267 | typedef void (*GDExtensionClassCallVirtual)(GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); |
| 268 | typedef GDExtensionObjectPtr (*GDExtensionClassCreateInstance)(void *p_userdata); |
| 269 | typedef void (*GDExtensionClassFreeInstance)(void *p_userdata, GDExtensionClassInstancePtr p_instance); |
| 270 | typedef GDExtensionClassCallVirtual (*GDExtensionClassGetVirtual)(void *p_userdata, GDExtensionConstStringNamePtr p_name); |
| 271 | |
| 272 | typedef struct { |
| 273 | GDExtensionBool is_virtual; |
| 274 | GDExtensionBool is_abstract; |
| 275 | GDExtensionClassSet set_func; |
| 276 | GDExtensionClassGet get_func; |
| 277 | GDExtensionClassGetPropertyList get_property_list_func; |
| 278 | GDExtensionClassFreePropertyList free_property_list_func; |
| 279 | GDExtensionClassPropertyCanRevert property_can_revert_func; |
| 280 | GDExtensionClassPropertyGetRevert property_get_revert_func; |
| 281 | GDExtensionClassNotification notification_func; |
| 282 | GDExtensionClassToString to_string_func; |
| 283 | GDExtensionClassReference reference_func; |
| 284 | GDExtensionClassUnreference unreference_func; |
| 285 | GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. |
| 286 | GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. |
| 287 | GDExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function. |
| 288 | GDExtensionClassGetRID get_rid_func; |
| 289 | void *class_userdata; // Per-class user data, later accessible in instance bindings. |
| 290 | } GDExtensionClassCreationInfo; // Deprecated. Use GDExtensionClassCreationInfo2 instead. |
| 291 | |
| 292 | typedef struct { |
| 293 | GDExtensionBool is_virtual; |
| 294 | GDExtensionBool is_abstract; |
| 295 | GDExtensionBool is_exposed; |
| 296 | GDExtensionClassSet set_func; |
| 297 | GDExtensionClassGet get_func; |
| 298 | GDExtensionClassGetPropertyList get_property_list_func; |
| 299 | GDExtensionClassFreePropertyList free_property_list_func; |
| 300 | GDExtensionClassPropertyCanRevert property_can_revert_func; |
| 301 | GDExtensionClassPropertyGetRevert property_get_revert_func; |
| 302 | GDExtensionClassValidateProperty validate_property_func; |
| 303 | GDExtensionClassNotification2 notification_func; |
| 304 | GDExtensionClassToString to_string_func; |
| 305 | GDExtensionClassReference reference_func; |
| 306 | GDExtensionClassUnreference unreference_func; |
| 307 | GDExtensionClassCreateInstance create_instance_func; // (Default) constructor; mandatory. If the class is not instantiable, consider making it virtual or abstract. |
| 308 | GDExtensionClassFreeInstance free_instance_func; // Destructor; mandatory. |
| 309 | GDExtensionClassGetVirtual get_virtual_func; // Queries a virtual function by name and returns a callback to invoke the requested virtual function. |
| 310 | GDExtensionClassGetRID get_rid_func; |
| 311 | void *class_userdata; // Per-class user data, later accessible in instance bindings. |
| 312 | } GDExtensionClassCreationInfo2; |
| 313 | |
| 314 | typedef void *GDExtensionClassLibraryPtr; |
| 315 | |
| 316 | /* Method */ |
| 317 | |
| 318 | typedef enum { |
| 319 | GDEXTENSION_METHOD_FLAG_NORMAL = 1, |
| 320 | GDEXTENSION_METHOD_FLAG_EDITOR = 2, |
| 321 | GDEXTENSION_METHOD_FLAG_CONST = 4, |
| 322 | GDEXTENSION_METHOD_FLAG_VIRTUAL = 8, |
| 323 | GDEXTENSION_METHOD_FLAG_VARARG = 16, |
| 324 | GDEXTENSION_METHOD_FLAG_STATIC = 32, |
| 325 | GDEXTENSION_METHOD_FLAGS_DEFAULT = GDEXTENSION_METHOD_FLAG_NORMAL, |
| 326 | } GDExtensionClassMethodFlags; |
| 327 | |
| 328 | typedef enum { |
| 329 | GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE, |
| 330 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT8, |
| 331 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT16, |
| 332 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT32, |
| 333 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_INT64, |
| 334 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT8, |
| 335 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT16, |
| 336 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT32, |
| 337 | GDEXTENSION_METHOD_ARGUMENT_METADATA_INT_IS_UINT64, |
| 338 | GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_FLOAT, |
| 339 | GDEXTENSION_METHOD_ARGUMENT_METADATA_REAL_IS_DOUBLE |
| 340 | } GDExtensionClassMethodArgumentMetadata; |
| 341 | |
| 342 | typedef void (*GDExtensionClassMethodCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error); |
| 343 | typedef void (*GDExtensionClassMethodValidatedCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionVariantPtr r_return); |
| 344 | typedef void (*GDExtensionClassMethodPtrCall)(void *method_userdata, GDExtensionClassInstancePtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); |
| 345 | |
| 346 | typedef struct { |
| 347 | GDExtensionStringNamePtr name; |
| 348 | void *method_userdata; |
| 349 | GDExtensionClassMethodCall call_func; |
| 350 | GDExtensionClassMethodPtrCall ptrcall_func; |
| 351 | uint32_t method_flags; // Bitfield of `GDExtensionClassMethodFlags`. |
| 352 | |
| 353 | /* If `has_return_value` is false, `return_value_info` and `return_value_metadata` are ignored. */ |
| 354 | GDExtensionBool has_return_value; |
| 355 | GDExtensionPropertyInfo *return_value_info; |
| 356 | GDExtensionClassMethodArgumentMetadata return_value_metadata; |
| 357 | |
| 358 | /* Arguments: `arguments_info` and `arguments_metadata` are array of size `argument_count`. |
| 359 | * Name and hint information for the argument can be omitted in release builds. Class name should always be present if it applies. |
| 360 | */ |
| 361 | uint32_t argument_count; |
| 362 | GDExtensionPropertyInfo *arguments_info; |
| 363 | GDExtensionClassMethodArgumentMetadata *arguments_metadata; |
| 364 | |
| 365 | /* Default arguments: `default_arguments` is an array of size `default_argument_count`. */ |
| 366 | uint32_t default_argument_count; |
| 367 | GDExtensionVariantPtr *default_arguments; |
| 368 | } GDExtensionClassMethodInfo; |
| 369 | |
| 370 | /* SCRIPT INSTANCE EXTENSION */ |
| 371 | |
| 372 | typedef void *GDExtensionScriptInstanceDataPtr; // Pointer to custom ScriptInstance native implementation. |
| 373 | |
| 374 | typedef GDExtensionBool (*GDExtensionScriptInstanceSet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value); |
| 375 | typedef GDExtensionBool (*GDExtensionScriptInstanceGet)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); |
| 376 | typedef const GDExtensionPropertyInfo *(*GDExtensionScriptInstanceGetPropertyList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); |
| 377 | typedef void (*GDExtensionScriptInstanceFreePropertyList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionPropertyInfo *p_list); |
| 378 | typedef GDExtensionVariantType (*GDExtensionScriptInstanceGetPropertyType)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionBool *r_is_valid); |
| 379 | typedef GDExtensionBool (*GDExtensionScriptInstanceValidateProperty)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionPropertyInfo *p_property); |
| 380 | |
| 381 | typedef GDExtensionBool (*GDExtensionScriptInstancePropertyCanRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name); |
| 382 | typedef GDExtensionBool (*GDExtensionScriptInstancePropertyGetRevert)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret); |
| 383 | |
| 384 | typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetOwner)(GDExtensionScriptInstanceDataPtr p_instance); |
| 385 | typedef void (*GDExtensionScriptInstancePropertyStateAdd)(GDExtensionConstStringNamePtr p_name, GDExtensionConstVariantPtr p_value, void *p_userdata); |
| 386 | typedef void (*GDExtensionScriptInstanceGetPropertyState)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionScriptInstancePropertyStateAdd p_add_func, void *p_userdata); |
| 387 | |
| 388 | typedef const GDExtensionMethodInfo *(*GDExtensionScriptInstanceGetMethodList)(GDExtensionScriptInstanceDataPtr p_instance, uint32_t *r_count); |
| 389 | typedef void (*GDExtensionScriptInstanceFreeMethodList)(GDExtensionScriptInstanceDataPtr p_instance, const GDExtensionMethodInfo *p_list); |
| 390 | |
| 391 | typedef GDExtensionBool (*GDExtensionScriptInstanceHasMethod)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionConstStringNamePtr p_name); |
| 392 | |
| 393 | typedef void (*GDExtensionScriptInstanceCall)(GDExtensionScriptInstanceDataPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError *r_error); |
| 394 | typedef void (*GDExtensionScriptInstanceNotification)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what); // Deprecated. Use GDExtensionScriptInstanceNotification2 instead. |
| 395 | typedef void (*GDExtensionScriptInstanceNotification2)(GDExtensionScriptInstanceDataPtr p_instance, int32_t p_what, GDExtensionBool p_reversed); |
| 396 | typedef void (*GDExtensionScriptInstanceToString)(GDExtensionScriptInstanceDataPtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr r_out); |
| 397 | |
| 398 | typedef void (*GDExtensionScriptInstanceRefCountIncremented)(GDExtensionScriptInstanceDataPtr p_instance); |
| 399 | typedef GDExtensionBool (*GDExtensionScriptInstanceRefCountDecremented)(GDExtensionScriptInstanceDataPtr p_instance); |
| 400 | |
| 401 | typedef GDExtensionObjectPtr (*GDExtensionScriptInstanceGetScript)(GDExtensionScriptInstanceDataPtr p_instance); |
| 402 | typedef GDExtensionBool (*GDExtensionScriptInstanceIsPlaceholder)(GDExtensionScriptInstanceDataPtr p_instance); |
| 403 | |
| 404 | typedef void *GDExtensionScriptLanguagePtr; |
| 405 | |
| 406 | typedef GDExtensionScriptLanguagePtr (*GDExtensionScriptInstanceGetLanguage)(GDExtensionScriptInstanceDataPtr p_instance); |
| 407 | |
| 408 | typedef void (*GDExtensionScriptInstanceFree)(GDExtensionScriptInstanceDataPtr p_instance); |
| 409 | |
| 410 | typedef void *GDExtensionScriptInstancePtr; // Pointer to ScriptInstance. |
| 411 | |
| 412 | typedef struct { |
| 413 | GDExtensionScriptInstanceSet set_func; |
| 414 | GDExtensionScriptInstanceGet get_func; |
| 415 | GDExtensionScriptInstanceGetPropertyList get_property_list_func; |
| 416 | GDExtensionScriptInstanceFreePropertyList free_property_list_func; |
| 417 | |
| 418 | GDExtensionScriptInstancePropertyCanRevert property_can_revert_func; |
| 419 | GDExtensionScriptInstancePropertyGetRevert property_get_revert_func; |
| 420 | |
| 421 | GDExtensionScriptInstanceGetOwner get_owner_func; |
| 422 | GDExtensionScriptInstanceGetPropertyState get_property_state_func; |
| 423 | |
| 424 | GDExtensionScriptInstanceGetMethodList get_method_list_func; |
| 425 | GDExtensionScriptInstanceFreeMethodList free_method_list_func; |
| 426 | GDExtensionScriptInstanceGetPropertyType get_property_type_func; |
| 427 | |
| 428 | GDExtensionScriptInstanceHasMethod has_method_func; |
| 429 | |
| 430 | GDExtensionScriptInstanceCall call_func; |
| 431 | GDExtensionScriptInstanceNotification notification_func; |
| 432 | |
| 433 | GDExtensionScriptInstanceToString to_string_func; |
| 434 | |
| 435 | GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func; |
| 436 | GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func; |
| 437 | |
| 438 | GDExtensionScriptInstanceGetScript get_script_func; |
| 439 | |
| 440 | GDExtensionScriptInstanceIsPlaceholder is_placeholder_func; |
| 441 | |
| 442 | GDExtensionScriptInstanceSet set_fallback_func; |
| 443 | GDExtensionScriptInstanceGet get_fallback_func; |
| 444 | |
| 445 | GDExtensionScriptInstanceGetLanguage get_language_func; |
| 446 | |
| 447 | GDExtensionScriptInstanceFree free_func; |
| 448 | |
| 449 | } GDExtensionScriptInstanceInfo; // Deprecated. Use GDExtensionScriptInstanceInfo2 instead. |
| 450 | |
| 451 | typedef struct { |
| 452 | GDExtensionScriptInstanceSet set_func; |
| 453 | GDExtensionScriptInstanceGet get_func; |
| 454 | GDExtensionScriptInstanceGetPropertyList get_property_list_func; |
| 455 | GDExtensionScriptInstanceFreePropertyList free_property_list_func; |
| 456 | |
| 457 | GDExtensionScriptInstancePropertyCanRevert property_can_revert_func; |
| 458 | GDExtensionScriptInstancePropertyGetRevert property_get_revert_func; |
| 459 | |
| 460 | GDExtensionScriptInstanceGetOwner get_owner_func; |
| 461 | GDExtensionScriptInstanceGetPropertyState get_property_state_func; |
| 462 | |
| 463 | GDExtensionScriptInstanceGetMethodList get_method_list_func; |
| 464 | GDExtensionScriptInstanceFreeMethodList free_method_list_func; |
| 465 | GDExtensionScriptInstanceGetPropertyType get_property_type_func; |
| 466 | GDExtensionScriptInstanceValidateProperty validate_property_func; |
| 467 | |
| 468 | GDExtensionScriptInstanceHasMethod has_method_func; |
| 469 | |
| 470 | GDExtensionScriptInstanceCall call_func; |
| 471 | GDExtensionScriptInstanceNotification2 notification_func; |
| 472 | |
| 473 | GDExtensionScriptInstanceToString to_string_func; |
| 474 | |
| 475 | GDExtensionScriptInstanceRefCountIncremented refcount_incremented_func; |
| 476 | GDExtensionScriptInstanceRefCountDecremented refcount_decremented_func; |
| 477 | |
| 478 | GDExtensionScriptInstanceGetScript get_script_func; |
| 479 | |
| 480 | GDExtensionScriptInstanceIsPlaceholder is_placeholder_func; |
| 481 | |
| 482 | GDExtensionScriptInstanceSet set_fallback_func; |
| 483 | GDExtensionScriptInstanceGet get_fallback_func; |
| 484 | |
| 485 | GDExtensionScriptInstanceGetLanguage get_language_func; |
| 486 | |
| 487 | GDExtensionScriptInstanceFree free_func; |
| 488 | |
| 489 | } GDExtensionScriptInstanceInfo2; |
| 490 | |
| 491 | /* INITIALIZATION */ |
| 492 | |
| 493 | typedef enum { |
| 494 | GDEXTENSION_INITIALIZATION_CORE, |
| 495 | GDEXTENSION_INITIALIZATION_SERVERS, |
| 496 | GDEXTENSION_INITIALIZATION_SCENE, |
| 497 | GDEXTENSION_INITIALIZATION_EDITOR, |
| 498 | GDEXTENSION_MAX_INITIALIZATION_LEVEL, |
| 499 | } GDExtensionInitializationLevel; |
| 500 | |
| 501 | typedef struct { |
| 502 | /* Minimum initialization level required. |
| 503 | * If Core or Servers, the extension needs editor or game restart to take effect */ |
| 504 | GDExtensionInitializationLevel minimum_initialization_level; |
| 505 | /* Up to the user to supply when initializing */ |
| 506 | void *userdata; |
| 507 | /* This function will be called multiple times for each initialization level. */ |
| 508 | void (*initialize)(void *userdata, GDExtensionInitializationLevel p_level); |
| 509 | void (*deinitialize)(void *userdata, GDExtensionInitializationLevel p_level); |
| 510 | } GDExtensionInitialization; |
| 511 | |
| 512 | typedef void (*GDExtensionInterfaceFunctionPtr)(); |
| 513 | typedef GDExtensionInterfaceFunctionPtr (*GDExtensionInterfaceGetProcAddress)(const char *p_function_name); |
| 514 | |
| 515 | /* |
| 516 | * Each GDExtension should define a C function that matches the signature of GDExtensionInitializationFunction, |
| 517 | * and export it so that it can be loaded via dlopen() or equivalent for the given platform. |
| 518 | * |
| 519 | * For example: |
| 520 | * |
| 521 | * GDExtensionBool my_extension_init(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization); |
| 522 | * |
| 523 | * This function's name must be specified as the 'entry_symbol' in the .gdextension file. |
| 524 | * |
| 525 | * This makes it the entry point of the GDExtension and will be called on initialization. |
| 526 | * |
| 527 | * The GDExtension can then modify the r_initialization structure, setting the minimum initialization level, |
| 528 | * and providing pointers to functions that will be called at various stages of initialization/shutdown. |
| 529 | * |
| 530 | * The rest of the GDExtension's interface to Godot consists of function pointers that can be loaded |
| 531 | * by calling p_get_proc_address("...") with the name of the function. |
| 532 | * |
| 533 | * For example: |
| 534 | * |
| 535 | * GDExtensionInterfaceGetGodotVersion *get_godot_version = (GDExtensionInterfaceGetGodotVersion)p_get_proc_address("get_godot_version"); |
| 536 | * |
| 537 | * You can then call it like a normal function: |
| 538 | * |
| 539 | * GDExtensionGodotVersion godot_version; |
| 540 | * get_godot_version(&godot_version); |
| 541 | * printf("Godot v%d.%d.%d\n", godot_version.major, godot_version.minor, godot_version.patch); |
| 542 | * |
| 543 | * All of these interface functions are described below, together with the name that's used to load it, |
| 544 | * and the function pointer typedef that shows its signature. |
| 545 | */ |
| 546 | typedef GDExtensionBool (*GDExtensionInitializationFunction)(GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization); |
| 547 | |
| 548 | /* INTERFACE */ |
| 549 | |
| 550 | typedef struct { |
| 551 | uint32_t major; |
| 552 | uint32_t minor; |
| 553 | uint32_t patch; |
| 554 | const char *string; |
| 555 | } GDExtensionGodotVersion; |
| 556 | |
| 557 | /** |
| 558 | * @name get_godot_version |
| 559 | * @since 4.1 |
| 560 | * |
| 561 | * Gets the Godot version that the GDExtension was loaded into. |
| 562 | * |
| 563 | * @param r_godot_version A pointer to the structure to write the version information into. |
| 564 | */ |
| 565 | typedef void (*GDExtensionInterfaceGetGodotVersion)(GDExtensionGodotVersion *r_godot_version); |
| 566 | |
| 567 | /* INTERFACE: Memory */ |
| 568 | |
| 569 | /** |
| 570 | * @name mem_alloc |
| 571 | * @since 4.1 |
| 572 | * |
| 573 | * Allocates memory. |
| 574 | * |
| 575 | * @param p_bytes The amount of memory to allocate in bytes. |
| 576 | * |
| 577 | * @return A pointer to the allocated memory, or NULL if unsuccessful. |
| 578 | */ |
| 579 | typedef void *(*GDExtensionInterfaceMemAlloc)(size_t p_bytes); |
| 580 | |
| 581 | /** |
| 582 | * @name mem_realloc |
| 583 | * @since 4.1 |
| 584 | * |
| 585 | * Reallocates memory. |
| 586 | * |
| 587 | * @param p_ptr A pointer to the previously allocated memory. |
| 588 | * @param p_bytes The number of bytes to resize the memory block to. |
| 589 | * |
| 590 | * @return A pointer to the allocated memory, or NULL if unsuccessful. |
| 591 | */ |
| 592 | typedef void *(*GDExtensionInterfaceMemRealloc)(void *p_ptr, size_t p_bytes); |
| 593 | |
| 594 | /** |
| 595 | * @name mem_free |
| 596 | * @since 4.1 |
| 597 | * |
| 598 | * Frees memory. |
| 599 | * |
| 600 | * @param p_ptr A pointer to the previously allocated memory. |
| 601 | */ |
| 602 | typedef void (*GDExtensionInterfaceMemFree)(void *p_ptr); |
| 603 | |
| 604 | /* INTERFACE: Godot Core */ |
| 605 | |
| 606 | /** |
| 607 | * @name print_error |
| 608 | * @since 4.1 |
| 609 | * |
| 610 | * Logs an error to Godot's built-in debugger and to the OS terminal. |
| 611 | * |
| 612 | * @param p_description The code trigging the error. |
| 613 | * @param p_function The function name where the error occurred. |
| 614 | * @param p_file The file where the error occurred. |
| 615 | * @param p_line The line where the error occurred. |
| 616 | * @param p_editor_notify Whether or not to notify the editor. |
| 617 | */ |
| 618 | typedef void (*GDExtensionInterfacePrintError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 619 | |
| 620 | /** |
| 621 | * @name print_error_with_message |
| 622 | * @since 4.1 |
| 623 | * |
| 624 | * Logs an error with a message to Godot's built-in debugger and to the OS terminal. |
| 625 | * |
| 626 | * @param p_description The code trigging the error. |
| 627 | * @param p_message The message to show along with the error. |
| 628 | * @param p_function The function name where the error occurred. |
| 629 | * @param p_file The file where the error occurred. |
| 630 | * @param p_line The line where the error occurred. |
| 631 | * @param p_editor_notify Whether or not to notify the editor. |
| 632 | */ |
| 633 | typedef void (*GDExtensionInterfacePrintErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 634 | |
| 635 | /** |
| 636 | * @name print_warning |
| 637 | * @since 4.1 |
| 638 | * |
| 639 | * Logs a warning to Godot's built-in debugger and to the OS terminal. |
| 640 | * |
| 641 | * @param p_description The code trigging the warning. |
| 642 | * @param p_function The function name where the warning occurred. |
| 643 | * @param p_file The file where the warning occurred. |
| 644 | * @param p_line The line where the warning occurred. |
| 645 | * @param p_editor_notify Whether or not to notify the editor. |
| 646 | */ |
| 647 | typedef void (*GDExtensionInterfacePrintWarning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 648 | |
| 649 | /** |
| 650 | * @name print_warning_with_message |
| 651 | * @since 4.1 |
| 652 | * |
| 653 | * Logs a warning with a message to Godot's built-in debugger and to the OS terminal. |
| 654 | * |
| 655 | * @param p_description The code trigging the warning. |
| 656 | * @param p_message The message to show along with the warning. |
| 657 | * @param p_function The function name where the warning occurred. |
| 658 | * @param p_file The file where the warning occurred. |
| 659 | * @param p_line The line where the warning occurred. |
| 660 | * @param p_editor_notify Whether or not to notify the editor. |
| 661 | */ |
| 662 | typedef void (*GDExtensionInterfacePrintWarningWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 663 | |
| 664 | /** |
| 665 | * @name print_script_error |
| 666 | * @since 4.1 |
| 667 | * |
| 668 | * Logs a script error to Godot's built-in debugger and to the OS terminal. |
| 669 | * |
| 670 | * @param p_description The code trigging the error. |
| 671 | * @param p_function The function name where the error occurred. |
| 672 | * @param p_file The file where the error occurred. |
| 673 | * @param p_line The line where the error occurred. |
| 674 | * @param p_editor_notify Whether or not to notify the editor. |
| 675 | */ |
| 676 | typedef void (*GDExtensionInterfacePrintScriptError)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 677 | |
| 678 | /** |
| 679 | * @name print_script_error_with_message |
| 680 | * @since 4.1 |
| 681 | * |
| 682 | * Logs a script error with a message to Godot's built-in debugger and to the OS terminal. |
| 683 | * |
| 684 | * @param p_description The code trigging the error. |
| 685 | * @param p_message The message to show along with the error. |
| 686 | * @param p_function The function name where the error occurred. |
| 687 | * @param p_file The file where the error occurred. |
| 688 | * @param p_line The line where the error occurred. |
| 689 | * @param p_editor_notify Whether or not to notify the editor. |
| 690 | */ |
| 691 | typedef void (*GDExtensionInterfacePrintScriptErrorWithMessage)(const char *p_description, const char *p_message, const char *p_function, const char *p_file, int32_t p_line, GDExtensionBool p_editor_notify); |
| 692 | |
| 693 | /** |
| 694 | * @name get_native_struct_size |
| 695 | * @since 4.1 |
| 696 | * |
| 697 | * Gets the size of a native struct (ex. ObjectID) in bytes. |
| 698 | * |
| 699 | * @param p_name A pointer to a StringName identifying the struct name. |
| 700 | * |
| 701 | * @return The size in bytes. |
| 702 | */ |
| 703 | typedef uint64_t (*GDExtensionInterfaceGetNativeStructSize)(GDExtensionConstStringNamePtr p_name); |
| 704 | |
| 705 | /* INTERFACE: Variant */ |
| 706 | |
| 707 | /** |
| 708 | * @name variant_new_copy |
| 709 | * @since 4.1 |
| 710 | * |
| 711 | * Copies one Variant into a another. |
| 712 | * |
| 713 | * @param r_dest A pointer to the destination Variant. |
| 714 | * @param p_src A pointer to the source Variant. |
| 715 | */ |
| 716 | typedef void (*GDExtensionInterfaceVariantNewCopy)(GDExtensionUninitializedVariantPtr r_dest, GDExtensionConstVariantPtr p_src); |
| 717 | |
| 718 | /** |
| 719 | * @name variant_new_nil |
| 720 | * @since 4.1 |
| 721 | * |
| 722 | * Creates a new Variant containing nil. |
| 723 | * |
| 724 | * @param r_dest A pointer to the destination Variant. |
| 725 | */ |
| 726 | typedef void (*GDExtensionInterfaceVariantNewNil)(GDExtensionUninitializedVariantPtr r_dest); |
| 727 | |
| 728 | /** |
| 729 | * @name variant_destroy |
| 730 | * @since 4.1 |
| 731 | * |
| 732 | * Destroys a Variant. |
| 733 | * |
| 734 | * @param p_self A pointer to the Variant to destroy. |
| 735 | */ |
| 736 | typedef void (*GDExtensionInterfaceVariantDestroy)(GDExtensionVariantPtr p_self); |
| 737 | |
| 738 | /** |
| 739 | * @name variant_call |
| 740 | * @since 4.1 |
| 741 | * |
| 742 | * Calls a method on a Variant. |
| 743 | * |
| 744 | * @param p_self A pointer to the Variant. |
| 745 | * @param p_method A pointer to a StringName identifying the method. |
| 746 | * @param p_args A pointer to a C array of Variant. |
| 747 | * @param p_argument_count The number of arguments. |
| 748 | * @param r_return A pointer a Variant which will be assigned the return value. |
| 749 | * @param r_error A pointer the structure which will hold error information. |
| 750 | * |
| 751 | * @see Variant::callp() |
| 752 | */ |
| 753 | typedef void (*GDExtensionInterfaceVariantCall)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error); |
| 754 | |
| 755 | /** |
| 756 | * @name variant_call_static |
| 757 | * @since 4.1 |
| 758 | * |
| 759 | * Calls a static method on a Variant. |
| 760 | * |
| 761 | * @param p_self A pointer to the Variant. |
| 762 | * @param p_method A pointer to a StringName identifying the method. |
| 763 | * @param p_args A pointer to a C array of Variant. |
| 764 | * @param p_argument_count The number of arguments. |
| 765 | * @param r_return A pointer a Variant which will be assigned the return value. |
| 766 | * @param r_error A pointer the structure which will be updated with error information. |
| 767 | * |
| 768 | * @see Variant::call_static() |
| 769 | */ |
| 770 | typedef void (*GDExtensionInterfaceVariantCallStatic)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_argument_count, GDExtensionUninitializedVariantPtr r_return, GDExtensionCallError *r_error); |
| 771 | |
| 772 | /** |
| 773 | * @name variant_evaluate |
| 774 | * @since 4.1 |
| 775 | * |
| 776 | * Evaluate an operator on two Variants. |
| 777 | * |
| 778 | * @param p_op The operator to evaluate. |
| 779 | * @param p_a The first Variant. |
| 780 | * @param p_b The second Variant. |
| 781 | * @param r_return A pointer a Variant which will be assigned the return value. |
| 782 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 783 | * |
| 784 | * @see Variant::evaluate() |
| 785 | */ |
| 786 | typedef void (*GDExtensionInterfaceVariantEvaluate)(GDExtensionVariantOperator p_op, GDExtensionConstVariantPtr p_a, GDExtensionConstVariantPtr p_b, GDExtensionUninitializedVariantPtr r_return, GDExtensionBool *r_valid); |
| 787 | |
| 788 | /** |
| 789 | * @name variant_set |
| 790 | * @since 4.1 |
| 791 | * |
| 792 | * Sets a key on a Variant to a value. |
| 793 | * |
| 794 | * @param p_self A pointer to the Variant. |
| 795 | * @param p_key A pointer to a Variant representing the key. |
| 796 | * @param p_value A pointer to a Variant representing the value. |
| 797 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 798 | * |
| 799 | * @see Variant::set() |
| 800 | */ |
| 801 | typedef void (*GDExtensionInterfaceVariantSet)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); |
| 802 | |
| 803 | /** |
| 804 | * @name variant_set_named |
| 805 | * @since 4.1 |
| 806 | * |
| 807 | * Sets a named key on a Variant to a value. |
| 808 | * |
| 809 | * @param p_self A pointer to the Variant. |
| 810 | * @param p_key A pointer to a StringName representing the key. |
| 811 | * @param p_value A pointer to a Variant representing the value. |
| 812 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 813 | * |
| 814 | * @see Variant::set_named() |
| 815 | */ |
| 816 | typedef void (*GDExtensionInterfaceVariantSetNamed)(GDExtensionVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); |
| 817 | |
| 818 | /** |
| 819 | * @name variant_set_keyed |
| 820 | * @since 4.1 |
| 821 | * |
| 822 | * Sets a keyed property on a Variant to a value. |
| 823 | * |
| 824 | * @param p_self A pointer to the Variant. |
| 825 | * @param p_key A pointer to a Variant representing the key. |
| 826 | * @param p_value A pointer to a Variant representing the value. |
| 827 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 828 | * |
| 829 | * @see Variant::set_keyed() |
| 830 | */ |
| 831 | typedef void (*GDExtensionInterfaceVariantSetKeyed)(GDExtensionVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid); |
| 832 | |
| 833 | /** |
| 834 | * @name variant_set_indexed |
| 835 | * @since 4.1 |
| 836 | * |
| 837 | * Sets an index on a Variant to a value. |
| 838 | * |
| 839 | * @param p_self A pointer to the Variant. |
| 840 | * @param p_index The index. |
| 841 | * @param p_value A pointer to a Variant representing the value. |
| 842 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 843 | * @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds. |
| 844 | */ |
| 845 | typedef void (*GDExtensionInterfaceVariantSetIndexed)(GDExtensionVariantPtr p_self, GDExtensionInt p_index, GDExtensionConstVariantPtr p_value, GDExtensionBool *r_valid, GDExtensionBool *r_oob); |
| 846 | |
| 847 | /** |
| 848 | * @name variant_get |
| 849 | * @since 4.1 |
| 850 | * |
| 851 | * Gets the value of a key from a Variant. |
| 852 | * |
| 853 | * @param p_self A pointer to the Variant. |
| 854 | * @param p_key A pointer to a Variant representing the key. |
| 855 | * @param r_ret A pointer to a Variant which will be assigned the value. |
| 856 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 857 | */ |
| 858 | typedef void (*GDExtensionInterfaceVariantGet)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); |
| 859 | |
| 860 | /** |
| 861 | * @name variant_get_named |
| 862 | * @since 4.1 |
| 863 | * |
| 864 | * Gets the value of a named key from a Variant. |
| 865 | * |
| 866 | * @param p_self A pointer to the Variant. |
| 867 | * @param p_key A pointer to a StringName representing the key. |
| 868 | * @param r_ret A pointer to a Variant which will be assigned the value. |
| 869 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 870 | */ |
| 871 | typedef void (*GDExtensionInterfaceVariantGetNamed)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); |
| 872 | |
| 873 | /** |
| 874 | * @name variant_get_keyed |
| 875 | * @since 4.1 |
| 876 | * |
| 877 | * Gets the value of a keyed property from a Variant. |
| 878 | * |
| 879 | * @param p_self A pointer to the Variant. |
| 880 | * @param p_key A pointer to a Variant representing the key. |
| 881 | * @param r_ret A pointer to a Variant which will be assigned the value. |
| 882 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 883 | */ |
| 884 | typedef void (*GDExtensionInterfaceVariantGetKeyed)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); |
| 885 | |
| 886 | /** |
| 887 | * @name variant_get_indexed |
| 888 | * @since 4.1 |
| 889 | * |
| 890 | * Gets the value of an index from a Variant. |
| 891 | * |
| 892 | * @param p_self A pointer to the Variant. |
| 893 | * @param p_index The index. |
| 894 | * @param r_ret A pointer to a Variant which will be assigned the value. |
| 895 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 896 | * @param r_oob A pointer to a boolean which will be set to true if the index is out of bounds. |
| 897 | */ |
| 898 | typedef void (*GDExtensionInterfaceVariantGetIndexed)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_index, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid, GDExtensionBool *r_oob); |
| 899 | |
| 900 | /** |
| 901 | * @name variant_iter_init |
| 902 | * @since 4.1 |
| 903 | * |
| 904 | * Initializes an iterator over a Variant. |
| 905 | * |
| 906 | * @param p_self A pointer to the Variant. |
| 907 | * @param r_iter A pointer to a Variant which will be assigned the iterator. |
| 908 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 909 | * |
| 910 | * @return true if the operation is valid; otherwise false. |
| 911 | * |
| 912 | * @see Variant::iter_init() |
| 913 | */ |
| 914 | typedef GDExtensionBool (*GDExtensionInterfaceVariantIterInit)(GDExtensionConstVariantPtr p_self, GDExtensionUninitializedVariantPtr r_iter, GDExtensionBool *r_valid); |
| 915 | |
| 916 | /** |
| 917 | * @name variant_iter_next |
| 918 | * @since 4.1 |
| 919 | * |
| 920 | * Gets the next value for an iterator over a Variant. |
| 921 | * |
| 922 | * @param p_self A pointer to the Variant. |
| 923 | * @param r_iter A pointer to a Variant which will be assigned the iterator. |
| 924 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 925 | * |
| 926 | * @return true if the operation is valid; otherwise false. |
| 927 | * |
| 928 | * @see Variant::iter_next() |
| 929 | */ |
| 930 | typedef GDExtensionBool (*GDExtensionInterfaceVariantIterNext)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionBool *r_valid); |
| 931 | |
| 932 | /** |
| 933 | * @name variant_iter_get |
| 934 | * @since 4.1 |
| 935 | * |
| 936 | * Gets the next value for an iterator over a Variant. |
| 937 | * |
| 938 | * @param p_self A pointer to the Variant. |
| 939 | * @param r_iter A pointer to a Variant which will be assigned the iterator. |
| 940 | * @param r_ret A pointer to a Variant which will be assigned false if the operation is invalid. |
| 941 | * @param r_valid A pointer to a boolean which will be set to false if the operation is invalid. |
| 942 | * |
| 943 | * @see Variant::iter_get() |
| 944 | */ |
| 945 | typedef void (*GDExtensionInterfaceVariantIterGet)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_iter, GDExtensionUninitializedVariantPtr r_ret, GDExtensionBool *r_valid); |
| 946 | |
| 947 | /** |
| 948 | * @name variant_hash |
| 949 | * @since 4.1 |
| 950 | * |
| 951 | * Gets the hash of a Variant. |
| 952 | * |
| 953 | * @param p_self A pointer to the Variant. |
| 954 | * |
| 955 | * @return The hash value. |
| 956 | * |
| 957 | * @see Variant::hash() |
| 958 | */ |
| 959 | typedef GDExtensionInt (*GDExtensionInterfaceVariantHash)(GDExtensionConstVariantPtr p_self); |
| 960 | |
| 961 | /** |
| 962 | * @name variant_recursive_hash |
| 963 | * @since 4.1 |
| 964 | * |
| 965 | * Gets the recursive hash of a Variant. |
| 966 | * |
| 967 | * @param p_self A pointer to the Variant. |
| 968 | * @param p_recursion_count The number of recursive loops so far. |
| 969 | * |
| 970 | * @return The hash value. |
| 971 | * |
| 972 | * @see Variant::recursive_hash() |
| 973 | */ |
| 974 | typedef GDExtensionInt (*GDExtensionInterfaceVariantRecursiveHash)(GDExtensionConstVariantPtr p_self, GDExtensionInt p_recursion_count); |
| 975 | |
| 976 | /** |
| 977 | * @name variant_hash_compare |
| 978 | * @since 4.1 |
| 979 | * |
| 980 | * Compares two Variants by their hash. |
| 981 | * |
| 982 | * @param p_self A pointer to the Variant. |
| 983 | * @param p_other A pointer to the other Variant to compare it to. |
| 984 | * |
| 985 | * @return The hash value. |
| 986 | * |
| 987 | * @see Variant::hash_compare() |
| 988 | */ |
| 989 | typedef GDExtensionBool (*GDExtensionInterfaceVariantHashCompare)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_other); |
| 990 | |
| 991 | /** |
| 992 | * @name variant_booleanize |
| 993 | * @since 4.1 |
| 994 | * |
| 995 | * Converts a Variant to a boolean. |
| 996 | * |
| 997 | * @param p_self A pointer to the Variant. |
| 998 | * |
| 999 | * @return The boolean value of the Variant. |
| 1000 | */ |
| 1001 | typedef GDExtensionBool (*GDExtensionInterfaceVariantBooleanize)(GDExtensionConstVariantPtr p_self); |
| 1002 | |
| 1003 | /** |
| 1004 | * @name variant_duplicate |
| 1005 | * @since 4.1 |
| 1006 | * |
| 1007 | * Duplicates a Variant. |
| 1008 | * |
| 1009 | * @param p_self A pointer to the Variant. |
| 1010 | * @param r_ret A pointer to a Variant to store the duplicated value. |
| 1011 | * @param p_deep Whether or not to duplicate deeply (when supported by the Variant type). |
| 1012 | */ |
| 1013 | typedef void (*GDExtensionInterfaceVariantDuplicate)(GDExtensionConstVariantPtr p_self, GDExtensionVariantPtr r_ret, GDExtensionBool p_deep); |
| 1014 | |
| 1015 | /** |
| 1016 | * @name variant_stringify |
| 1017 | * @since 4.1 |
| 1018 | * |
| 1019 | * Converts a Variant to a string. |
| 1020 | * |
| 1021 | * @param p_self A pointer to the Variant. |
| 1022 | * @param r_ret A pointer to a String to store the resulting value. |
| 1023 | */ |
| 1024 | typedef void (*GDExtensionInterfaceVariantStringify)(GDExtensionConstVariantPtr p_self, GDExtensionStringPtr r_ret); |
| 1025 | |
| 1026 | /** |
| 1027 | * @name variant_get_type |
| 1028 | * @since 4.1 |
| 1029 | * |
| 1030 | * Gets the type of a Variant. |
| 1031 | * |
| 1032 | * @param p_self A pointer to the Variant. |
| 1033 | * |
| 1034 | * @return The variant type. |
| 1035 | */ |
| 1036 | typedef GDExtensionVariantType (*GDExtensionInterfaceVariantGetType)(GDExtensionConstVariantPtr p_self); |
| 1037 | |
| 1038 | /** |
| 1039 | * @name variant_has_method |
| 1040 | * @since 4.1 |
| 1041 | * |
| 1042 | * Checks if a Variant has the given method. |
| 1043 | * |
| 1044 | * @param p_self A pointer to the Variant. |
| 1045 | * @param p_method A pointer to a StringName with the method name. |
| 1046 | * |
| 1047 | * @return |
| 1048 | */ |
| 1049 | typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMethod)(GDExtensionConstVariantPtr p_self, GDExtensionConstStringNamePtr p_method); |
| 1050 | |
| 1051 | /** |
| 1052 | * @name variant_has_member |
| 1053 | * @since 4.1 |
| 1054 | * |
| 1055 | * Checks if a type of Variant has the given member. |
| 1056 | * |
| 1057 | * @param p_type The Variant type. |
| 1058 | * @param p_member A pointer to a StringName with the member name. |
| 1059 | * |
| 1060 | * @return |
| 1061 | */ |
| 1062 | typedef GDExtensionBool (*GDExtensionInterfaceVariantHasMember)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); |
| 1063 | |
| 1064 | /** |
| 1065 | * @name variant_has_key |
| 1066 | * @since 4.1 |
| 1067 | * |
| 1068 | * Checks if a Variant has a key. |
| 1069 | * |
| 1070 | * @param p_self A pointer to the Variant. |
| 1071 | * @param p_key A pointer to a Variant representing the key. |
| 1072 | * @param r_valid A pointer to a boolean which will be set to false if the key doesn't exist. |
| 1073 | * |
| 1074 | * @return true if the key exists; otherwise false. |
| 1075 | */ |
| 1076 | typedef GDExtensionBool (*GDExtensionInterfaceVariantHasKey)(GDExtensionConstVariantPtr p_self, GDExtensionConstVariantPtr p_key, GDExtensionBool *r_valid); |
| 1077 | |
| 1078 | /** |
| 1079 | * @name variant_get_type_name |
| 1080 | * @since 4.1 |
| 1081 | * |
| 1082 | * Gets the name of a Variant type. |
| 1083 | * |
| 1084 | * @param p_type The Variant type. |
| 1085 | * @param r_name A pointer to a String to store the Variant type name. |
| 1086 | */ |
| 1087 | typedef void (*GDExtensionInterfaceVariantGetTypeName)(GDExtensionVariantType p_type, GDExtensionUninitializedStringPtr r_name); |
| 1088 | |
| 1089 | /** |
| 1090 | * @name variant_can_convert |
| 1091 | * @since 4.1 |
| 1092 | * |
| 1093 | * Checks if Variants can be converted from one type to another. |
| 1094 | * |
| 1095 | * @param p_from The Variant type to convert from. |
| 1096 | * @param p_to The Variant type to convert to. |
| 1097 | * |
| 1098 | * @return true if the conversion is possible; otherwise false. |
| 1099 | */ |
| 1100 | typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvert)(GDExtensionVariantType p_from, GDExtensionVariantType p_to); |
| 1101 | |
| 1102 | /** |
| 1103 | * @name variant_can_convert_strict |
| 1104 | * @since 4.1 |
| 1105 | * |
| 1106 | * Checks if Variant can be converted from one type to another using stricter rules. |
| 1107 | * |
| 1108 | * @param p_from The Variant type to convert from. |
| 1109 | * @param p_to The Variant type to convert to. |
| 1110 | * |
| 1111 | * @return true if the conversion is possible; otherwise false. |
| 1112 | */ |
| 1113 | typedef GDExtensionBool (*GDExtensionInterfaceVariantCanConvertStrict)(GDExtensionVariantType p_from, GDExtensionVariantType p_to); |
| 1114 | |
| 1115 | /** |
| 1116 | * @name get_variant_from_type_constructor |
| 1117 | * @since 4.1 |
| 1118 | * |
| 1119 | * Gets a pointer to a function that can create a Variant of the given type from a raw value. |
| 1120 | * |
| 1121 | * @param p_type The Variant type. |
| 1122 | * |
| 1123 | * @return A pointer to a function that can create a Variant of the given type from a raw value. |
| 1124 | */ |
| 1125 | typedef GDExtensionVariantFromTypeConstructorFunc (*GDExtensionInterfaceGetVariantFromTypeConstructor)(GDExtensionVariantType p_type); |
| 1126 | |
| 1127 | /** |
| 1128 | * @name get_variant_to_type_constructor |
| 1129 | * @since 4.1 |
| 1130 | * |
| 1131 | * Gets a pointer to a function that can get the raw value from a Variant of the given type. |
| 1132 | * |
| 1133 | * @param p_type The Variant type. |
| 1134 | * |
| 1135 | * @return A pointer to a function that can get the raw value from a Variant of the given type. |
| 1136 | */ |
| 1137 | typedef GDExtensionTypeFromVariantConstructorFunc (*GDExtensionInterfaceGetVariantToTypeConstructor)(GDExtensionVariantType p_type); |
| 1138 | |
| 1139 | /** |
| 1140 | * @name variant_get_ptr_operator_evaluator |
| 1141 | * @since 4.1 |
| 1142 | * |
| 1143 | * Gets a pointer to a function that can evaluate the given Variant operator on the given Variant types. |
| 1144 | * |
| 1145 | * @param p_operator The variant operator. |
| 1146 | * @param p_type_a The type of the first Variant. |
| 1147 | * @param p_type_b The type of the second Variant. |
| 1148 | * |
| 1149 | * @return A pointer to a function that can evaluate the given Variant operator on the given Variant types. |
| 1150 | */ |
| 1151 | typedef GDExtensionPtrOperatorEvaluator (*GDExtensionInterfaceVariantGetPtrOperatorEvaluator)(GDExtensionVariantOperator p_operator, GDExtensionVariantType p_type_a, GDExtensionVariantType p_type_b); |
| 1152 | |
| 1153 | /** |
| 1154 | * @name variant_get_ptr_builtin_method |
| 1155 | * @since 4.1 |
| 1156 | * |
| 1157 | * Gets a pointer to a function that can call a builtin method on a type of Variant. |
| 1158 | * |
| 1159 | * @param p_type The Variant type. |
| 1160 | * @param p_method A pointer to a StringName with the method name. |
| 1161 | * @param p_hash A hash representing the method signature. |
| 1162 | * |
| 1163 | * @return A pointer to a function that can call a builtin method on a type of Variant. |
| 1164 | */ |
| 1165 | typedef GDExtensionPtrBuiltInMethod (*GDExtensionInterfaceVariantGetPtrBuiltinMethod)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_method, GDExtensionInt p_hash); |
| 1166 | |
| 1167 | /** |
| 1168 | * @name variant_get_ptr_constructor |
| 1169 | * @since 4.1 |
| 1170 | * |
| 1171 | * Gets a pointer to a function that can call one of the constructors for a type of Variant. |
| 1172 | * |
| 1173 | * @param p_type The Variant type. |
| 1174 | * @param p_constructor The index of the constructor. |
| 1175 | * |
| 1176 | * @return A pointer to a function that can call one of the constructors for a type of Variant. |
| 1177 | */ |
| 1178 | typedef GDExtensionPtrConstructor (*GDExtensionInterfaceVariantGetPtrConstructor)(GDExtensionVariantType p_type, int32_t p_constructor); |
| 1179 | |
| 1180 | /** |
| 1181 | * @name variant_get_ptr_destructor |
| 1182 | * @since 4.1 |
| 1183 | * |
| 1184 | * Gets a pointer to a function than can call the destructor for a type of Variant. |
| 1185 | * |
| 1186 | * @param p_type The Variant type. |
| 1187 | * |
| 1188 | * @return A pointer to a function than can call the destructor for a type of Variant. |
| 1189 | */ |
| 1190 | typedef GDExtensionPtrDestructor (*GDExtensionInterfaceVariantGetPtrDestructor)(GDExtensionVariantType p_type); |
| 1191 | |
| 1192 | /** |
| 1193 | * @name variant_construct |
| 1194 | * @since 4.1 |
| 1195 | * |
| 1196 | * Constructs a Variant of the given type, using the first constructor that matches the given arguments. |
| 1197 | * |
| 1198 | * @param p_type The Variant type. |
| 1199 | * @param p_base A pointer to a Variant to store the constructed value. |
| 1200 | * @param p_args A pointer to a C array of Variant pointers representing the arguments for the constructor. |
| 1201 | * @param p_argument_count The number of arguments to pass to the constructor. |
| 1202 | * @param r_error A pointer the structure which will be updated with error information. |
| 1203 | */ |
| 1204 | typedef void (*GDExtensionInterfaceVariantConstruct)(GDExtensionVariantType p_type, GDExtensionUninitializedVariantPtr r_base, const GDExtensionConstVariantPtr *p_args, int32_t p_argument_count, GDExtensionCallError *r_error); |
| 1205 | |
| 1206 | /** |
| 1207 | * @name variant_get_ptr_setter |
| 1208 | * @since 4.1 |
| 1209 | * |
| 1210 | * Gets a pointer to a function that can call a member's setter on the given Variant type. |
| 1211 | * |
| 1212 | * @param p_type The Variant type. |
| 1213 | * @param p_member A pointer to a StringName with the member name. |
| 1214 | * |
| 1215 | * @return A pointer to a function that can call a member's setter on the given Variant type. |
| 1216 | */ |
| 1217 | typedef GDExtensionPtrSetter (*GDExtensionInterfaceVariantGetPtrSetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); |
| 1218 | |
| 1219 | /** |
| 1220 | * @name variant_get_ptr_getter |
| 1221 | * @since 4.1 |
| 1222 | * |
| 1223 | * Gets a pointer to a function that can call a member's getter on the given Variant type. |
| 1224 | * |
| 1225 | * @param p_type The Variant type. |
| 1226 | * @param p_member A pointer to a StringName with the member name. |
| 1227 | * |
| 1228 | * @return A pointer to a function that can call a member's getter on the given Variant type. |
| 1229 | */ |
| 1230 | typedef GDExtensionPtrGetter (*GDExtensionInterfaceVariantGetPtrGetter)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_member); |
| 1231 | |
| 1232 | /** |
| 1233 | * @name variant_get_ptr_indexed_setter |
| 1234 | * @since 4.1 |
| 1235 | * |
| 1236 | * Gets a pointer to a function that can set an index on the given Variant type. |
| 1237 | * |
| 1238 | * @param p_type The Variant type. |
| 1239 | * |
| 1240 | * @return A pointer to a function that can set an index on the given Variant type. |
| 1241 | */ |
| 1242 | typedef GDExtensionPtrIndexedSetter (*GDExtensionInterfaceVariantGetPtrIndexedSetter)(GDExtensionVariantType p_type); |
| 1243 | |
| 1244 | /** |
| 1245 | * @name variant_get_ptr_indexed_getter |
| 1246 | * @since 4.1 |
| 1247 | * |
| 1248 | * Gets a pointer to a function that can get an index on the given Variant type. |
| 1249 | * |
| 1250 | * @param p_type The Variant type. |
| 1251 | * |
| 1252 | * @return A pointer to a function that can get an index on the given Variant type. |
| 1253 | */ |
| 1254 | typedef GDExtensionPtrIndexedGetter (*GDExtensionInterfaceVariantGetPtrIndexedGetter)(GDExtensionVariantType p_type); |
| 1255 | |
| 1256 | /** |
| 1257 | * @name variant_get_ptr_keyed_setter |
| 1258 | * @since 4.1 |
| 1259 | * |
| 1260 | * Gets a pointer to a function that can set a key on the given Variant type. |
| 1261 | * |
| 1262 | * @param p_type The Variant type. |
| 1263 | * |
| 1264 | * @return A pointer to a function that can set a key on the given Variant type. |
| 1265 | */ |
| 1266 | typedef GDExtensionPtrKeyedSetter (*GDExtensionInterfaceVariantGetPtrKeyedSetter)(GDExtensionVariantType p_type); |
| 1267 | |
| 1268 | /** |
| 1269 | * @name variant_get_ptr_keyed_getter |
| 1270 | * @since 4.1 |
| 1271 | * |
| 1272 | * Gets a pointer to a function that can get a key on the given Variant type. |
| 1273 | * |
| 1274 | * @param p_type The Variant type. |
| 1275 | * |
| 1276 | * @return A pointer to a function that can get a key on the given Variant type. |
| 1277 | */ |
| 1278 | typedef GDExtensionPtrKeyedGetter (*GDExtensionInterfaceVariantGetPtrKeyedGetter)(GDExtensionVariantType p_type); |
| 1279 | |
| 1280 | /** |
| 1281 | * @name variant_get_ptr_keyed_checker |
| 1282 | * @since 4.1 |
| 1283 | * |
| 1284 | * Gets a pointer to a function that can check a key on the given Variant type. |
| 1285 | * |
| 1286 | * @param p_type The Variant type. |
| 1287 | * |
| 1288 | * @return A pointer to a function that can check a key on the given Variant type. |
| 1289 | */ |
| 1290 | typedef GDExtensionPtrKeyedChecker (*GDExtensionInterfaceVariantGetPtrKeyedChecker)(GDExtensionVariantType p_type); |
| 1291 | |
| 1292 | /** |
| 1293 | * @name variant_get_constant_value |
| 1294 | * @since 4.1 |
| 1295 | * |
| 1296 | * Gets the value of a constant from the given Variant type. |
| 1297 | * |
| 1298 | * @param p_type The Variant type. |
| 1299 | * @param p_constant A pointer to a StringName with the constant name. |
| 1300 | * @param r_ret A pointer to a Variant to store the value. |
| 1301 | */ |
| 1302 | typedef void (*GDExtensionInterfaceVariantGetConstantValue)(GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_constant, GDExtensionUninitializedVariantPtr r_ret); |
| 1303 | |
| 1304 | /** |
| 1305 | * @name variant_get_ptr_utility_function |
| 1306 | * @since 4.1 |
| 1307 | * |
| 1308 | * Gets a pointer to a function that can call a Variant utility function. |
| 1309 | * |
| 1310 | * @param p_function A pointer to a StringName with the function name. |
| 1311 | * @param p_hash A hash representing the function signature. |
| 1312 | * |
| 1313 | * @return A pointer to a function that can call a Variant utility function. |
| 1314 | */ |
| 1315 | typedef GDExtensionPtrUtilityFunction (*GDExtensionInterfaceVariantGetPtrUtilityFunction)(GDExtensionConstStringNamePtr p_function, GDExtensionInt p_hash); |
| 1316 | |
| 1317 | /* INTERFACE: String Utilities */ |
| 1318 | |
| 1319 | /** |
| 1320 | * @name string_new_with_latin1_chars |
| 1321 | * @since 4.1 |
| 1322 | * |
| 1323 | * Creates a String from a Latin-1 encoded C string. |
| 1324 | * |
| 1325 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1326 | * @param p_contents A pointer to a Latin-1 encoded C string (null terminated). |
| 1327 | */ |
| 1328 | typedef void (*GDExtensionInterfaceStringNewWithLatin1Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents); |
| 1329 | |
| 1330 | /** |
| 1331 | * @name string_new_with_utf8_chars |
| 1332 | * @since 4.1 |
| 1333 | * |
| 1334 | * Creates a String from a UTF-8 encoded C string. |
| 1335 | * |
| 1336 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1337 | * @param p_contents A pointer to a UTF-8 encoded C string (null terminated). |
| 1338 | */ |
| 1339 | typedef void (*GDExtensionInterfaceStringNewWithUtf8Chars)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents); |
| 1340 | |
| 1341 | /** |
| 1342 | * @name string_new_with_utf16_chars |
| 1343 | * @since 4.1 |
| 1344 | * |
| 1345 | * Creates a String from a UTF-16 encoded C string. |
| 1346 | * |
| 1347 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1348 | * @param p_contents A pointer to a UTF-16 encoded C string (null terminated). |
| 1349 | */ |
| 1350 | typedef void (*GDExtensionInterfaceStringNewWithUtf16Chars)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents); |
| 1351 | |
| 1352 | /** |
| 1353 | * @name string_new_with_utf32_chars |
| 1354 | * @since 4.1 |
| 1355 | * |
| 1356 | * Creates a String from a UTF-32 encoded C string. |
| 1357 | * |
| 1358 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1359 | * @param p_contents A pointer to a UTF-32 encoded C string (null terminated). |
| 1360 | */ |
| 1361 | typedef void (*GDExtensionInterfaceStringNewWithUtf32Chars)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents); |
| 1362 | |
| 1363 | /** |
| 1364 | * @name string_new_with_wide_chars |
| 1365 | * @since 4.1 |
| 1366 | * |
| 1367 | * Creates a String from a wide C string. |
| 1368 | * |
| 1369 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1370 | * @param p_contents A pointer to a wide C string (null terminated). |
| 1371 | */ |
| 1372 | typedef void (*GDExtensionInterfaceStringNewWithWideChars)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents); |
| 1373 | |
| 1374 | /** |
| 1375 | * @name string_new_with_latin1_chars_and_len |
| 1376 | * @since 4.1 |
| 1377 | * |
| 1378 | * Creates a String from a Latin-1 encoded C string with the given length. |
| 1379 | * |
| 1380 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1381 | * @param p_contents A pointer to a Latin-1 encoded C string. |
| 1382 | * @param p_size The number of characters. |
| 1383 | */ |
| 1384 | typedef void (*GDExtensionInterfaceStringNewWithLatin1CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size); |
| 1385 | |
| 1386 | /** |
| 1387 | * @name string_new_with_utf8_chars_and_len |
| 1388 | * @since 4.1 |
| 1389 | * |
| 1390 | * Creates a String from a UTF-8 encoded C string with the given length. |
| 1391 | * |
| 1392 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1393 | * @param p_contents A pointer to a UTF-8 encoded C string. |
| 1394 | * @param p_size The number of characters. |
| 1395 | */ |
| 1396 | typedef void (*GDExtensionInterfaceStringNewWithUtf8CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char *p_contents, GDExtensionInt p_size); |
| 1397 | |
| 1398 | /** |
| 1399 | * @name string_new_with_utf16_chars_and_len |
| 1400 | * @since 4.1 |
| 1401 | * |
| 1402 | * Creates a String from a UTF-16 encoded C string with the given length. |
| 1403 | * |
| 1404 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1405 | * @param p_contents A pointer to a UTF-16 encoded C string. |
| 1406 | * @param p_size The number of characters. |
| 1407 | */ |
| 1408 | typedef void (*GDExtensionInterfaceStringNewWithUtf16CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char16_t *p_contents, GDExtensionInt p_size); |
| 1409 | |
| 1410 | /** |
| 1411 | * @name string_new_with_utf32_chars_and_len |
| 1412 | * @since 4.1 |
| 1413 | * |
| 1414 | * Creates a String from a UTF-32 encoded C string with the given length. |
| 1415 | * |
| 1416 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1417 | * @param p_contents A pointer to a UTF-32 encoded C string. |
| 1418 | * @param p_size The number of characters. |
| 1419 | */ |
| 1420 | typedef void (*GDExtensionInterfaceStringNewWithUtf32CharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const char32_t *p_contents, GDExtensionInt p_size); |
| 1421 | |
| 1422 | /** |
| 1423 | * @name string_new_with_wide_chars_and_len |
| 1424 | * @since 4.1 |
| 1425 | * |
| 1426 | * Creates a String from a wide C string with the given length. |
| 1427 | * |
| 1428 | * @param r_dest A pointer to a Variant to hold the newly created String. |
| 1429 | * @param p_contents A pointer to a wide C string. |
| 1430 | * @param p_size The number of characters. |
| 1431 | */ |
| 1432 | typedef void (*GDExtensionInterfaceStringNewWithWideCharsAndLen)(GDExtensionUninitializedStringPtr r_dest, const wchar_t *p_contents, GDExtensionInt p_size); |
| 1433 | |
| 1434 | /** |
| 1435 | * @name string_to_latin1_chars |
| 1436 | * @since 4.1 |
| 1437 | * |
| 1438 | * Converts a String to a Latin-1 encoded C string. |
| 1439 | * |
| 1440 | * It doesn't write a null terminator. |
| 1441 | * |
| 1442 | * @param p_self A pointer to the String. |
| 1443 | * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. |
| 1444 | * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. |
| 1445 | * |
| 1446 | * @return The resulting encoded string length in characters (not bytes), not including a null terminator. |
| 1447 | */ |
| 1448 | typedef GDExtensionInt (*GDExtensionInterfaceStringToLatin1Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length); |
| 1449 | |
| 1450 | /** |
| 1451 | * @name string_to_utf8_chars |
| 1452 | * @since 4.1 |
| 1453 | * |
| 1454 | * Converts a String to a UTF-8 encoded C string. |
| 1455 | * |
| 1456 | * It doesn't write a null terminator. |
| 1457 | * |
| 1458 | * @param p_self A pointer to the String. |
| 1459 | * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. |
| 1460 | * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. |
| 1461 | * |
| 1462 | * @return The resulting encoded string length in characters (not bytes), not including a null terminator. |
| 1463 | */ |
| 1464 | typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf8Chars)(GDExtensionConstStringPtr p_self, char *r_text, GDExtensionInt p_max_write_length); |
| 1465 | |
| 1466 | /** |
| 1467 | * @name string_to_utf16_chars |
| 1468 | * @since 4.1 |
| 1469 | * |
| 1470 | * Converts a String to a UTF-16 encoded C string. |
| 1471 | * |
| 1472 | * It doesn't write a null terminator. |
| 1473 | * |
| 1474 | * @param p_self A pointer to the String. |
| 1475 | * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. |
| 1476 | * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. |
| 1477 | * |
| 1478 | * @return The resulting encoded string length in characters (not bytes), not including a null terminator. |
| 1479 | */ |
| 1480 | typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf16Chars)(GDExtensionConstStringPtr p_self, char16_t *r_text, GDExtensionInt p_max_write_length); |
| 1481 | |
| 1482 | /** |
| 1483 | * @name string_to_utf32_chars |
| 1484 | * @since 4.1 |
| 1485 | * |
| 1486 | * Converts a String to a UTF-32 encoded C string. |
| 1487 | * |
| 1488 | * It doesn't write a null terminator. |
| 1489 | * |
| 1490 | * @param p_self A pointer to the String. |
| 1491 | * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. |
| 1492 | * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. |
| 1493 | * |
| 1494 | * @return The resulting encoded string length in characters (not bytes), not including a null terminator. |
| 1495 | */ |
| 1496 | typedef GDExtensionInt (*GDExtensionInterfaceStringToUtf32Chars)(GDExtensionConstStringPtr p_self, char32_t *r_text, GDExtensionInt p_max_write_length); |
| 1497 | |
| 1498 | /** |
| 1499 | * @name string_to_wide_chars |
| 1500 | * @since 4.1 |
| 1501 | * |
| 1502 | * Converts a String to a wide C string. |
| 1503 | * |
| 1504 | * It doesn't write a null terminator. |
| 1505 | * |
| 1506 | * @param p_self A pointer to the String. |
| 1507 | * @param r_text A pointer to the buffer to hold the resulting data. If NULL is passed in, only the length will be computed. |
| 1508 | * @param p_max_write_length The maximum number of characters that can be written to r_text. It has no affect on the return value. |
| 1509 | * |
| 1510 | * @return The resulting encoded string length in characters (not bytes), not including a null terminator. |
| 1511 | */ |
| 1512 | typedef GDExtensionInt (*GDExtensionInterfaceStringToWideChars)(GDExtensionConstStringPtr p_self, wchar_t *r_text, GDExtensionInt p_max_write_length); |
| 1513 | |
| 1514 | /** |
| 1515 | * @name string_operator_index |
| 1516 | * @since 4.1 |
| 1517 | * |
| 1518 | * Gets a pointer to the character at the given index from a String. |
| 1519 | * |
| 1520 | * @param p_self A pointer to the String. |
| 1521 | * @param p_index The index. |
| 1522 | * |
| 1523 | * @return A pointer to the requested character. |
| 1524 | */ |
| 1525 | typedef char32_t *(*GDExtensionInterfaceStringOperatorIndex)(GDExtensionStringPtr p_self, GDExtensionInt p_index); |
| 1526 | |
| 1527 | /** |
| 1528 | * @name string_operator_index_const |
| 1529 | * @since 4.1 |
| 1530 | * |
| 1531 | * Gets a const pointer to the character at the given index from a String. |
| 1532 | * |
| 1533 | * @param p_self A pointer to the String. |
| 1534 | * @param p_index The index. |
| 1535 | * |
| 1536 | * @return A const pointer to the requested character. |
| 1537 | */ |
| 1538 | typedef const char32_t *(*GDExtensionInterfaceStringOperatorIndexConst)(GDExtensionConstStringPtr p_self, GDExtensionInt p_index); |
| 1539 | |
| 1540 | /** |
| 1541 | * @name string_operator_plus_eq_string |
| 1542 | * @since 4.1 |
| 1543 | * |
| 1544 | * Appends another String to a String. |
| 1545 | * |
| 1546 | * @param p_self A pointer to the String. |
| 1547 | * @param p_b A pointer to the other String to append. |
| 1548 | */ |
| 1549 | typedef void (*GDExtensionInterfaceStringOperatorPlusEqString)(GDExtensionStringPtr p_self, GDExtensionConstStringPtr p_b); |
| 1550 | |
| 1551 | /** |
| 1552 | * @name string_operator_plus_eq_char |
| 1553 | * @since 4.1 |
| 1554 | * |
| 1555 | * Appends a character to a String. |
| 1556 | * |
| 1557 | * @param p_self A pointer to the String. |
| 1558 | * @param p_b A pointer to the character to append. |
| 1559 | */ |
| 1560 | typedef void (*GDExtensionInterfaceStringOperatorPlusEqChar)(GDExtensionStringPtr p_self, char32_t p_b); |
| 1561 | |
| 1562 | /** |
| 1563 | * @name string_operator_plus_eq_cstr |
| 1564 | * @since 4.1 |
| 1565 | * |
| 1566 | * Appends a Latin-1 encoded C string to a String. |
| 1567 | * |
| 1568 | * @param p_self A pointer to the String. |
| 1569 | * @param p_b A pointer to a Latin-1 encoded C string (null terminated). |
| 1570 | */ |
| 1571 | typedef void (*GDExtensionInterfaceStringOperatorPlusEqCstr)(GDExtensionStringPtr p_self, const char *p_b); |
| 1572 | |
| 1573 | /** |
| 1574 | * @name string_operator_plus_eq_wcstr |
| 1575 | * @since 4.1 |
| 1576 | * |
| 1577 | * Appends a wide C string to a String. |
| 1578 | * |
| 1579 | * @param p_self A pointer to the String. |
| 1580 | * @param p_b A pointer to a wide C string (null terminated). |
| 1581 | */ |
| 1582 | typedef void (*GDExtensionInterfaceStringOperatorPlusEqWcstr)(GDExtensionStringPtr p_self, const wchar_t *p_b); |
| 1583 | |
| 1584 | /** |
| 1585 | * @name string_operator_plus_eq_c32str |
| 1586 | * @since 4.1 |
| 1587 | * |
| 1588 | * Appends a UTF-32 encoded C string to a String. |
| 1589 | * |
| 1590 | * @param p_self A pointer to the String. |
| 1591 | * @param p_b A pointer to a UTF-32 encoded C string (null terminated). |
| 1592 | */ |
| 1593 | typedef void (*GDExtensionInterfaceStringOperatorPlusEqC32str)(GDExtensionStringPtr p_self, const char32_t *p_b); |
| 1594 | |
| 1595 | /** |
| 1596 | * @name string_resize |
| 1597 | * @since 4.2 |
| 1598 | * |
| 1599 | * Resizes the underlying string data to the given number of characters. |
| 1600 | * |
| 1601 | * Space needs to be allocated for the null terminating character ('\0') which |
| 1602 | * also must be added manually, in order for all string functions to work correctly. |
| 1603 | * |
| 1604 | * Warning: This is an error-prone operation - only use it if there's no other |
| 1605 | * efficient way to accomplish your goal. |
| 1606 | * |
| 1607 | * @param p_self A pointer to the String. |
| 1608 | * @param p_resize The new length for the String. |
| 1609 | * |
| 1610 | * @return Error code signifying if the operation successful. |
| 1611 | */ |
| 1612 | typedef GDExtensionInt (*GDExtensionInterfaceStringResize)(GDExtensionStringPtr p_self, GDExtensionInt p_resize); |
| 1613 | |
| 1614 | /* INTERFACE: XMLParser Utilities */ |
| 1615 | |
| 1616 | /** |
| 1617 | * @name xml_parser_open_buffer |
| 1618 | * @since 4.1 |
| 1619 | * |
| 1620 | * Opens a raw XML buffer on an XMLParser instance. |
| 1621 | * |
| 1622 | * @param p_instance A pointer to an XMLParser object. |
| 1623 | * @param p_buffer A pointer to the buffer. |
| 1624 | * @param p_size The size of the buffer. |
| 1625 | * |
| 1626 | * @return A Godot error code (ex. OK, ERR_INVALID_DATA, etc). |
| 1627 | * |
| 1628 | * @see XMLParser::open_buffer() |
| 1629 | */ |
| 1630 | typedef GDExtensionInt (*GDExtensionInterfaceXmlParserOpenBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_buffer, size_t p_size); |
| 1631 | |
| 1632 | /* INTERFACE: FileAccess Utilities */ |
| 1633 | |
| 1634 | /** |
| 1635 | * @name file_access_store_buffer |
| 1636 | * @since 4.1 |
| 1637 | * |
| 1638 | * Stores the given buffer using an instance of FileAccess. |
| 1639 | * |
| 1640 | * @param p_instance A pointer to a FileAccess object. |
| 1641 | * @param p_src A pointer to the buffer. |
| 1642 | * @param p_length The size of the buffer. |
| 1643 | * |
| 1644 | * @see FileAccess::store_buffer() |
| 1645 | */ |
| 1646 | typedef void (*GDExtensionInterfaceFileAccessStoreBuffer)(GDExtensionObjectPtr p_instance, const uint8_t *p_src, uint64_t p_length); |
| 1647 | |
| 1648 | /** |
| 1649 | * @name file_access_get_buffer |
| 1650 | * @since 4.1 |
| 1651 | * |
| 1652 | * Reads the next p_length bytes into the given buffer using an instance of FileAccess. |
| 1653 | * |
| 1654 | * @param p_instance A pointer to a FileAccess object. |
| 1655 | * @param p_dst A pointer to the buffer to store the data. |
| 1656 | * @param p_length The requested number of bytes to read. |
| 1657 | * |
| 1658 | * @return The actual number of bytes read (may be less than requested). |
| 1659 | */ |
| 1660 | typedef uint64_t (*GDExtensionInterfaceFileAccessGetBuffer)(GDExtensionConstObjectPtr p_instance, uint8_t *p_dst, uint64_t p_length); |
| 1661 | |
| 1662 | /* INTERFACE: WorkerThreadPool Utilities */ |
| 1663 | |
| 1664 | /** |
| 1665 | * @name worker_thread_pool_add_native_group_task |
| 1666 | * @since 4.1 |
| 1667 | * |
| 1668 | * Adds a group task to an instance of WorkerThreadPool. |
| 1669 | * |
| 1670 | * @param p_instance A pointer to a WorkerThreadPool object. |
| 1671 | * @param p_func A pointer to a function to run in the thread pool. |
| 1672 | * @param p_userdata A pointer to arbitrary data which will be passed to p_func. |
| 1673 | * @param p_tasks The number of tasks needed in the group. |
| 1674 | * @param p_high_priority Whether or not this is a high priority task. |
| 1675 | * @param p_description A pointer to a String with the task description. |
| 1676 | * |
| 1677 | * @return The task group ID. |
| 1678 | * |
| 1679 | * @see WorkerThreadPool::add_group_task() |
| 1680 | */ |
| 1681 | typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeGroupTask)(GDExtensionObjectPtr p_instance, void (*p_func)(void *, uint32_t), void *p_userdata, int p_elements, int p_tasks, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description); |
| 1682 | |
| 1683 | /** |
| 1684 | * @name worker_thread_pool_add_native_task |
| 1685 | * @since 4.1 |
| 1686 | * |
| 1687 | * Adds a task to an instance of WorkerThreadPool. |
| 1688 | * |
| 1689 | * @param p_instance A pointer to a WorkerThreadPool object. |
| 1690 | * @param p_func A pointer to a function to run in the thread pool. |
| 1691 | * @param p_userdata A pointer to arbitrary data which will be passed to p_func. |
| 1692 | * @param p_high_priority Whether or not this is a high priority task. |
| 1693 | * @param p_description A pointer to a String with the task description. |
| 1694 | * |
| 1695 | * @return The task ID. |
| 1696 | */ |
| 1697 | typedef int64_t (*GDExtensionInterfaceWorkerThreadPoolAddNativeTask)(GDExtensionObjectPtr p_instance, void (*p_func)(void *), void *p_userdata, GDExtensionBool p_high_priority, GDExtensionConstStringPtr p_description); |
| 1698 | |
| 1699 | /* INTERFACE: Packed Array */ |
| 1700 | |
| 1701 | /** |
| 1702 | * @name packed_byte_array_operator_index |
| 1703 | * @since 4.1 |
| 1704 | * |
| 1705 | * Gets a pointer to a byte in a PackedByteArray. |
| 1706 | * |
| 1707 | * @param p_self A pointer to a PackedByteArray object. |
| 1708 | * @param p_index The index of the byte to get. |
| 1709 | * |
| 1710 | * @return A pointer to the requested byte. |
| 1711 | */ |
| 1712 | typedef uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1713 | |
| 1714 | /** |
| 1715 | * @name packed_byte_array_operator_index_const |
| 1716 | * @since 4.1 |
| 1717 | * |
| 1718 | * Gets a const pointer to a byte in a PackedByteArray. |
| 1719 | * |
| 1720 | * @param p_self A const pointer to a PackedByteArray object. |
| 1721 | * @param p_index The index of the byte to get. |
| 1722 | * |
| 1723 | * @return A const pointer to the requested byte. |
| 1724 | */ |
| 1725 | typedef const uint8_t *(*GDExtensionInterfacePackedByteArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1726 | |
| 1727 | /** |
| 1728 | * @name packed_color_array_operator_index |
| 1729 | * @since 4.1 |
| 1730 | * |
| 1731 | * Gets a pointer to a color in a PackedColorArray. |
| 1732 | * |
| 1733 | * @param p_self A pointer to a PackedColorArray object. |
| 1734 | * @param p_index The index of the Color to get. |
| 1735 | * |
| 1736 | * @return A pointer to the requested Color. |
| 1737 | */ |
| 1738 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1739 | |
| 1740 | /** |
| 1741 | * @name packed_color_array_operator_index_const |
| 1742 | * @since 4.1 |
| 1743 | * |
| 1744 | * Gets a const pointer to a color in a PackedColorArray. |
| 1745 | * |
| 1746 | * @param p_self A const pointer to a const PackedColorArray object. |
| 1747 | * @param p_index The index of the Color to get. |
| 1748 | * |
| 1749 | * @return A const pointer to the requested Color. |
| 1750 | */ |
| 1751 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedColorArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1752 | |
| 1753 | /** |
| 1754 | * @name packed_float32_array_operator_index |
| 1755 | * @since 4.1 |
| 1756 | * |
| 1757 | * Gets a pointer to a 32-bit float in a PackedFloat32Array. |
| 1758 | * |
| 1759 | * @param p_self A pointer to a PackedFloat32Array object. |
| 1760 | * @param p_index The index of the float to get. |
| 1761 | * |
| 1762 | * @return A pointer to the requested 32-bit float. |
| 1763 | */ |
| 1764 | typedef float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1765 | |
| 1766 | /** |
| 1767 | * @name packed_float32_array_operator_index_const |
| 1768 | * @since 4.1 |
| 1769 | * |
| 1770 | * Gets a const pointer to a 32-bit float in a PackedFloat32Array. |
| 1771 | * |
| 1772 | * @param p_self A const pointer to a PackedFloat32Array object. |
| 1773 | * @param p_index The index of the float to get. |
| 1774 | * |
| 1775 | * @return A const pointer to the requested 32-bit float. |
| 1776 | */ |
| 1777 | typedef const float *(*GDExtensionInterfacePackedFloat32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1778 | |
| 1779 | /** |
| 1780 | * @name packed_float64_array_operator_index |
| 1781 | * @since 4.1 |
| 1782 | * |
| 1783 | * Gets a pointer to a 64-bit float in a PackedFloat64Array. |
| 1784 | * |
| 1785 | * @param p_self A pointer to a PackedFloat64Array object. |
| 1786 | * @param p_index The index of the float to get. |
| 1787 | * |
| 1788 | * @return A pointer to the requested 64-bit float. |
| 1789 | */ |
| 1790 | typedef double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1791 | |
| 1792 | /** |
| 1793 | * @name packed_float64_array_operator_index_const |
| 1794 | * @since 4.1 |
| 1795 | * |
| 1796 | * Gets a const pointer to a 64-bit float in a PackedFloat64Array. |
| 1797 | * |
| 1798 | * @param p_self A const pointer to a PackedFloat64Array object. |
| 1799 | * @param p_index The index of the float to get. |
| 1800 | * |
| 1801 | * @return A const pointer to the requested 64-bit float. |
| 1802 | */ |
| 1803 | typedef const double *(*GDExtensionInterfacePackedFloat64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1804 | |
| 1805 | /** |
| 1806 | * @name packed_int32_array_operator_index |
| 1807 | * @since 4.1 |
| 1808 | * |
| 1809 | * Gets a pointer to a 32-bit integer in a PackedInt32Array. |
| 1810 | * |
| 1811 | * @param p_self A pointer to a PackedInt32Array object. |
| 1812 | * @param p_index The index of the integer to get. |
| 1813 | * |
| 1814 | * @return A pointer to the requested 32-bit integer. |
| 1815 | */ |
| 1816 | typedef int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1817 | |
| 1818 | /** |
| 1819 | * @name packed_int32_array_operator_index_const |
| 1820 | * @since 4.1 |
| 1821 | * |
| 1822 | * Gets a const pointer to a 32-bit integer in a PackedInt32Array. |
| 1823 | * |
| 1824 | * @param p_self A const pointer to a PackedInt32Array object. |
| 1825 | * @param p_index The index of the integer to get. |
| 1826 | * |
| 1827 | * @return A const pointer to the requested 32-bit integer. |
| 1828 | */ |
| 1829 | typedef const int32_t *(*GDExtensionInterfacePackedInt32ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1830 | |
| 1831 | /** |
| 1832 | * @name packed_int64_array_operator_index |
| 1833 | * @since 4.1 |
| 1834 | * |
| 1835 | * Gets a pointer to a 64-bit integer in a PackedInt64Array. |
| 1836 | * |
| 1837 | * @param p_self A pointer to a PackedInt64Array object. |
| 1838 | * @param p_index The index of the integer to get. |
| 1839 | * |
| 1840 | * @return A pointer to the requested 64-bit integer. |
| 1841 | */ |
| 1842 | typedef int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1843 | |
| 1844 | /** |
| 1845 | * @name packed_int64_array_operator_index_const |
| 1846 | * @since 4.1 |
| 1847 | * |
| 1848 | * Gets a const pointer to a 64-bit integer in a PackedInt64Array. |
| 1849 | * |
| 1850 | * @param p_self A const pointer to a PackedInt64Array object. |
| 1851 | * @param p_index The index of the integer to get. |
| 1852 | * |
| 1853 | * @return A const pointer to the requested 64-bit integer. |
| 1854 | */ |
| 1855 | typedef const int64_t *(*GDExtensionInterfacePackedInt64ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1856 | |
| 1857 | /** |
| 1858 | * @name packed_string_array_operator_index |
| 1859 | * @since 4.1 |
| 1860 | * |
| 1861 | * Gets a pointer to a string in a PackedStringArray. |
| 1862 | * |
| 1863 | * @param p_self A pointer to a PackedStringArray object. |
| 1864 | * @param p_index The index of the String to get. |
| 1865 | * |
| 1866 | * @return A pointer to the requested String. |
| 1867 | */ |
| 1868 | typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1869 | |
| 1870 | /** |
| 1871 | * @name packed_string_array_operator_index_const |
| 1872 | * @since 4.1 |
| 1873 | * |
| 1874 | * Gets a const pointer to a string in a PackedStringArray. |
| 1875 | * |
| 1876 | * @param p_self A const pointer to a PackedStringArray object. |
| 1877 | * @param p_index The index of the String to get. |
| 1878 | * |
| 1879 | * @return A const pointer to the requested String. |
| 1880 | */ |
| 1881 | typedef GDExtensionStringPtr (*GDExtensionInterfacePackedStringArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1882 | |
| 1883 | /** |
| 1884 | * @name packed_vector2_array_operator_index |
| 1885 | * @since 4.1 |
| 1886 | * |
| 1887 | * Gets a pointer to a Vector2 in a PackedVector2Array. |
| 1888 | * |
| 1889 | * @param p_self A pointer to a PackedVector2Array object. |
| 1890 | * @param p_index The index of the Vector2 to get. |
| 1891 | * |
| 1892 | * @return A pointer to the requested Vector2. |
| 1893 | */ |
| 1894 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1895 | |
| 1896 | /** |
| 1897 | * @name packed_vector2_array_operator_index_const |
| 1898 | * @since 4.1 |
| 1899 | * |
| 1900 | * Gets a const pointer to a Vector2 in a PackedVector2Array. |
| 1901 | * |
| 1902 | * @param p_self A const pointer to a PackedVector2Array object. |
| 1903 | * @param p_index The index of the Vector2 to get. |
| 1904 | * |
| 1905 | * @return A const pointer to the requested Vector2. |
| 1906 | */ |
| 1907 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector2ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1908 | |
| 1909 | /** |
| 1910 | * @name packed_vector3_array_operator_index |
| 1911 | * @since 4.1 |
| 1912 | * |
| 1913 | * Gets a pointer to a Vector3 in a PackedVector3Array. |
| 1914 | * |
| 1915 | * @param p_self A pointer to a PackedVector3Array object. |
| 1916 | * @param p_index The index of the Vector3 to get. |
| 1917 | * |
| 1918 | * @return A pointer to the requested Vector3. |
| 1919 | */ |
| 1920 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1921 | |
| 1922 | /** |
| 1923 | * @name packed_vector3_array_operator_index_const |
| 1924 | * @since 4.1 |
| 1925 | * |
| 1926 | * Gets a const pointer to a Vector3 in a PackedVector3Array. |
| 1927 | * |
| 1928 | * @param p_self A const pointer to a PackedVector3Array object. |
| 1929 | * @param p_index The index of the Vector3 to get. |
| 1930 | * |
| 1931 | * @return A const pointer to the requested Vector3. |
| 1932 | */ |
| 1933 | typedef GDExtensionTypePtr (*GDExtensionInterfacePackedVector3ArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1934 | |
| 1935 | /** |
| 1936 | * @name array_operator_index |
| 1937 | * @since 4.1 |
| 1938 | * |
| 1939 | * Gets a pointer to a Variant in an Array. |
| 1940 | * |
| 1941 | * @param p_self A pointer to an Array object. |
| 1942 | * @param p_index The index of the Variant to get. |
| 1943 | * |
| 1944 | * @return A pointer to the requested Variant. |
| 1945 | */ |
| 1946 | typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionInt p_index); |
| 1947 | |
| 1948 | /** |
| 1949 | * @name array_operator_index_const |
| 1950 | * @since 4.1 |
| 1951 | * |
| 1952 | * Gets a const pointer to a Variant in an Array. |
| 1953 | * |
| 1954 | * @param p_self A const pointer to an Array object. |
| 1955 | * @param p_index The index of the Variant to get. |
| 1956 | * |
| 1957 | * @return A const pointer to the requested Variant. |
| 1958 | */ |
| 1959 | typedef GDExtensionVariantPtr (*GDExtensionInterfaceArrayOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionInt p_index); |
| 1960 | |
| 1961 | /** |
| 1962 | * @name array_ref |
| 1963 | * @since 4.1 |
| 1964 | * |
| 1965 | * Sets an Array to be a reference to another Array object. |
| 1966 | * |
| 1967 | * @param p_self A pointer to the Array object to update. |
| 1968 | * @param p_from A pointer to the Array object to reference. |
| 1969 | */ |
| 1970 | typedef void (*GDExtensionInterfaceArrayRef)(GDExtensionTypePtr p_self, GDExtensionConstTypePtr p_from); |
| 1971 | |
| 1972 | /** |
| 1973 | * @name array_set_typed |
| 1974 | * @since 4.1 |
| 1975 | * |
| 1976 | * Makes an Array into a typed Array. |
| 1977 | * |
| 1978 | * @param p_self A pointer to the Array. |
| 1979 | * @param p_type The type of Variant the Array will store. |
| 1980 | * @param p_class_name A pointer to a StringName with the name of the object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT). |
| 1981 | * @param p_script A pointer to a Script object (if p_type is GDEXTENSION_VARIANT_TYPE_OBJECT and the base class is extended by a script). |
| 1982 | */ |
| 1983 | typedef void (*GDExtensionInterfaceArraySetTyped)(GDExtensionTypePtr p_self, GDExtensionVariantType p_type, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstVariantPtr p_script); |
| 1984 | |
| 1985 | /* INTERFACE: Dictionary */ |
| 1986 | |
| 1987 | /** |
| 1988 | * @name dictionary_operator_index |
| 1989 | * @since 4.1 |
| 1990 | * |
| 1991 | * Gets a pointer to a Variant in a Dictionary with the given key. |
| 1992 | * |
| 1993 | * @param p_self A pointer to a Dictionary object. |
| 1994 | * @param p_key A pointer to a Variant representing the key. |
| 1995 | * |
| 1996 | * @return A pointer to a Variant representing the value at the given key. |
| 1997 | */ |
| 1998 | typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndex)(GDExtensionTypePtr p_self, GDExtensionConstVariantPtr p_key); |
| 1999 | |
| 2000 | /** |
| 2001 | * @name dictionary_operator_index_const |
| 2002 | * @since 4.1 |
| 2003 | * |
| 2004 | * Gets a const pointer to a Variant in a Dictionary with the given key. |
| 2005 | * |
| 2006 | * @param p_self A const pointer to a Dictionary object. |
| 2007 | * @param p_key A pointer to a Variant representing the key. |
| 2008 | * |
| 2009 | * @return A const pointer to a Variant representing the value at the given key. |
| 2010 | */ |
| 2011 | typedef GDExtensionVariantPtr (*GDExtensionInterfaceDictionaryOperatorIndexConst)(GDExtensionConstTypePtr p_self, GDExtensionConstVariantPtr p_key); |
| 2012 | |
| 2013 | /* INTERFACE: Object */ |
| 2014 | |
| 2015 | /** |
| 2016 | * @name object_method_bind_call |
| 2017 | * @since 4.1 |
| 2018 | * |
| 2019 | * Calls a method on an Object. |
| 2020 | * |
| 2021 | * @param p_method_bind A pointer to the MethodBind representing the method on the Object's class. |
| 2022 | * @param p_instance A pointer to the Object. |
| 2023 | * @param p_args A pointer to a C array of Variants representing the arguments. |
| 2024 | * @param p_arg_count The number of arguments. |
| 2025 | * @param r_ret A pointer to Variant which will receive the return value. |
| 2026 | * @param r_error A pointer to a GDExtensionCallError struct that will receive error information. |
| 2027 | */ |
| 2028 | typedef void (*GDExtensionInterfaceObjectMethodBindCall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstVariantPtr *p_args, GDExtensionInt p_arg_count, GDExtensionUninitializedVariantPtr r_ret, GDExtensionCallError *r_error); |
| 2029 | |
| 2030 | /** |
| 2031 | * @name object_method_bind_ptrcall |
| 2032 | * @since 4.1 |
| 2033 | * |
| 2034 | * Calls a method on an Object (using a "ptrcall"). |
| 2035 | * |
| 2036 | * @param p_method_bind A pointer to the MethodBind representing the method on the Object's class. |
| 2037 | * @param p_instance A pointer to the Object. |
| 2038 | * @param p_args A pointer to a C array representing the arguments. |
| 2039 | * @param r_ret A pointer to the Object that will receive the return value. |
| 2040 | */ |
| 2041 | typedef void (*GDExtensionInterfaceObjectMethodBindPtrcall)(GDExtensionMethodBindPtr p_method_bind, GDExtensionObjectPtr p_instance, const GDExtensionConstTypePtr *p_args, GDExtensionTypePtr r_ret); |
| 2042 | |
| 2043 | /** |
| 2044 | * @name object_destroy |
| 2045 | * @since 4.1 |
| 2046 | * |
| 2047 | * Destroys an Object. |
| 2048 | * |
| 2049 | * @param p_o A pointer to the Object. |
| 2050 | */ |
| 2051 | typedef void (*GDExtensionInterfaceObjectDestroy)(GDExtensionObjectPtr p_o); |
| 2052 | |
| 2053 | /** |
| 2054 | * @name global_get_singleton |
| 2055 | * @since 4.1 |
| 2056 | * |
| 2057 | * Gets a global singleton by name. |
| 2058 | * |
| 2059 | * @param p_name A pointer to a StringName with the singleton name. |
| 2060 | * |
| 2061 | * @return A pointer to the singleton Object. |
| 2062 | */ |
| 2063 | typedef GDExtensionObjectPtr (*GDExtensionInterfaceGlobalGetSingleton)(GDExtensionConstStringNamePtr p_name); |
| 2064 | |
| 2065 | /** |
| 2066 | * @name object_get_instance_binding |
| 2067 | * @since 4.1 |
| 2068 | * |
| 2069 | * Gets a pointer representing an Object's instance binding. |
| 2070 | * |
| 2071 | * @param p_o A pointer to the Object. |
| 2072 | * @param p_library A token the library received by the GDExtension's entry point function. |
| 2073 | * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct. |
| 2074 | * |
| 2075 | * @return |
| 2076 | */ |
| 2077 | typedef void *(*GDExtensionInterfaceObjectGetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, const GDExtensionInstanceBindingCallbacks *p_callbacks); |
| 2078 | |
| 2079 | /** |
| 2080 | * @name object_set_instance_binding |
| 2081 | * @since 4.1 |
| 2082 | * |
| 2083 | * Sets an Object's instance binding. |
| 2084 | * |
| 2085 | * @param p_o A pointer to the Object. |
| 2086 | * @param p_library A token the library received by the GDExtension's entry point function. |
| 2087 | * @param p_binding A pointer to the instance binding. |
| 2088 | * @param p_callbacks A pointer to a GDExtensionInstanceBindingCallbacks struct. |
| 2089 | */ |
| 2090 | typedef void (*GDExtensionInterfaceObjectSetInstanceBinding)(GDExtensionObjectPtr p_o, void *p_token, void *p_binding, const GDExtensionInstanceBindingCallbacks *p_callbacks); |
| 2091 | |
| 2092 | /** |
| 2093 | * @name object_set_instance |
| 2094 | * @since 4.1 |
| 2095 | * |
| 2096 | * Sets an extension class instance on a Object. |
| 2097 | * |
| 2098 | * @param p_o A pointer to the Object. |
| 2099 | * @param p_classname A pointer to a StringName with the registered extension class's name. |
| 2100 | * @param p_instance A pointer to the extension class instance. |
| 2101 | */ |
| 2102 | typedef void (*GDExtensionInterfaceObjectSetInstance)(GDExtensionObjectPtr p_o, GDExtensionConstStringNamePtr p_classname, GDExtensionClassInstancePtr p_instance); /* p_classname should be a registered extension class and should extend the p_o object's class. */ |
| 2103 | |
| 2104 | /** |
| 2105 | * @name object_get_class_name |
| 2106 | * @since 4.1 |
| 2107 | * |
| 2108 | * Gets the class name of an Object. |
| 2109 | * |
| 2110 | * @param p_object A pointer to the Object. |
| 2111 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2112 | * @param r_class_name A pointer to a String to receive the class name. |
| 2113 | * |
| 2114 | * @return true if successful in getting the class name; otherwise false. |
| 2115 | */ |
| 2116 | typedef GDExtensionBool (*GDExtensionInterfaceObjectGetClassName)(GDExtensionConstObjectPtr p_object, GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringNamePtr r_class_name); |
| 2117 | |
| 2118 | /** |
| 2119 | * @name object_cast_to |
| 2120 | * @since 4.1 |
| 2121 | * |
| 2122 | * Casts an Object to a different type. |
| 2123 | * |
| 2124 | * @param p_object A pointer to the Object. |
| 2125 | * @param p_class_tag A pointer uniquely identifying a built-in class in the ClassDB. |
| 2126 | * |
| 2127 | * @return Returns a pointer to the Object, or NULL if it can't be cast to the requested type. |
| 2128 | */ |
| 2129 | typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectCastTo)(GDExtensionConstObjectPtr p_object, void *p_class_tag); |
| 2130 | |
| 2131 | /** |
| 2132 | * @name object_get_instance_from_id |
| 2133 | * @since 4.1 |
| 2134 | * |
| 2135 | * Gets an Object by its instance ID. |
| 2136 | * |
| 2137 | * @param p_instance_id The instance ID. |
| 2138 | * |
| 2139 | * @return A pointer to the Object. |
| 2140 | */ |
| 2141 | typedef GDExtensionObjectPtr (*GDExtensionInterfaceObjectGetInstanceFromId)(GDObjectInstanceID p_instance_id); |
| 2142 | |
| 2143 | /** |
| 2144 | * @name object_get_instance_id |
| 2145 | * @since 4.1 |
| 2146 | * |
| 2147 | * Gets the instance ID from an Object. |
| 2148 | * |
| 2149 | * @param p_object A pointer to the Object. |
| 2150 | * |
| 2151 | * @return The instance ID. |
| 2152 | */ |
| 2153 | typedef GDObjectInstanceID (*GDExtensionInterfaceObjectGetInstanceId)(GDExtensionConstObjectPtr p_object); |
| 2154 | |
| 2155 | /* INTERFACE: Reference */ |
| 2156 | |
| 2157 | /** |
| 2158 | * @name ref_get_object |
| 2159 | * @since 4.1 |
| 2160 | * |
| 2161 | * Gets the Object from a reference. |
| 2162 | * |
| 2163 | * @param p_ref A pointer to the reference. |
| 2164 | * |
| 2165 | * @return A pointer to the Object from the reference or NULL. |
| 2166 | */ |
| 2167 | typedef GDExtensionObjectPtr (*GDExtensionInterfaceRefGetObject)(GDExtensionConstRefPtr p_ref); |
| 2168 | |
| 2169 | /** |
| 2170 | * @name ref_set_object |
| 2171 | * @since 4.1 |
| 2172 | * |
| 2173 | * Sets the Object referred to by a reference. |
| 2174 | * |
| 2175 | * @param p_ref A pointer to the reference. |
| 2176 | * @param p_object A pointer to the Object to refer to. |
| 2177 | */ |
| 2178 | typedef void (*GDExtensionInterfaceRefSetObject)(GDExtensionRefPtr p_ref, GDExtensionObjectPtr p_object); |
| 2179 | |
| 2180 | /* INTERFACE: Script Instance */ |
| 2181 | |
| 2182 | /** |
| 2183 | * @name script_instance_create |
| 2184 | * @since 4.1 |
| 2185 | * @deprecated in Godot 4.2. Use `script_instance_create2` instead. |
| 2186 | * |
| 2187 | * Creates a script instance that contains the given info and instance data. |
| 2188 | * |
| 2189 | * @param p_info A pointer to a GDExtensionScriptInstanceInfo struct. |
| 2190 | * @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info. |
| 2191 | * |
| 2192 | * @return A pointer to a ScriptInstanceExtension object. |
| 2193 | */ |
| 2194 | typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate)(const GDExtensionScriptInstanceInfo *p_info, GDExtensionScriptInstanceDataPtr p_instance_data); |
| 2195 | |
| 2196 | /** |
| 2197 | * @name script_instance_create2 |
| 2198 | * @since 4.2 |
| 2199 | * |
| 2200 | * Creates a script instance that contains the given info and instance data. |
| 2201 | * |
| 2202 | * @param p_info A pointer to a GDExtensionScriptInstanceInfo2 struct. |
| 2203 | * @param p_instance_data A pointer to a data representing the script instance in the GDExtension. This will be passed to all the function pointers on p_info. |
| 2204 | * |
| 2205 | * @return A pointer to a ScriptInstanceExtension object. |
| 2206 | */ |
| 2207 | typedef GDExtensionScriptInstancePtr (*GDExtensionInterfaceScriptInstanceCreate2)(const GDExtensionScriptInstanceInfo2 *p_info, GDExtensionScriptInstanceDataPtr p_instance_data); |
| 2208 | |
| 2209 | /** |
| 2210 | * @name placeholder_script_instance_create |
| 2211 | * @since 4.2 |
| 2212 | * |
| 2213 | * Creates a placeholder script instance for a given script and instance. |
| 2214 | * |
| 2215 | * This interface is optional as a custom placeholder could also be created with script_instance_create(). |
| 2216 | * |
| 2217 | * @param p_language A pointer to a ScriptLanguage. |
| 2218 | * @param p_script A pointer to a Script. |
| 2219 | * @param p_owner A pointer to an Object. |
| 2220 | * |
| 2221 | * @return A pointer to a PlaceHolderScriptInstance object. |
| 2222 | */ |
| 2223 | typedef GDExtensionScriptInstancePtr (*GDExtensionInterfacePlaceHolderScriptInstanceCreate)(GDExtensionObjectPtr p_language, GDExtensionObjectPtr p_script, GDExtensionObjectPtr p_owner); |
| 2224 | |
| 2225 | /** |
| 2226 | * @name placeholder_script_instance_update |
| 2227 | * @since 4.2 |
| 2228 | * |
| 2229 | * Updates a placeholder script instance with the given properties and values. |
| 2230 | * |
| 2231 | * The passed in placeholder must be an instance of PlaceHolderScriptInstance |
| 2232 | * such as the one returned by placeholder_script_instance_create(). |
| 2233 | * |
| 2234 | * @param p_placeholder A pointer to a PlaceHolderScriptInstance. |
| 2235 | * @param p_properties A pointer to an Array of Dictionary representing PropertyInfo. |
| 2236 | * @param p_values A pointer to a Dictionary mapping StringName to Variant values. |
| 2237 | */ |
| 2238 | typedef void (*GDExtensionInterfacePlaceHolderScriptInstanceUpdate)(GDExtensionScriptInstancePtr p_placeholder, GDExtensionConstTypePtr p_properties, GDExtensionConstTypePtr p_values); |
| 2239 | |
| 2240 | /** |
| 2241 | * @name object_get_script_instance |
| 2242 | * @since 4.2 |
| 2243 | * |
| 2244 | * Get the script instance data attached to this object. |
| 2245 | * |
| 2246 | * @param p_object A pointer to the Object. |
| 2247 | * @param p_language A pointer to the language expected for this script instance. |
| 2248 | * |
| 2249 | * @return A GDExtensionScriptInstanceDataPtr that was attached to this object as part of script_instance_create. |
| 2250 | */ |
| 2251 | typedef GDExtensionScriptInstanceDataPtr (*GDExtensionInterfaceObjectGetScriptInstance)(GDExtensionConstObjectPtr p_object, GDExtensionObjectPtr p_language); |
| 2252 | |
| 2253 | /* INTERFACE: ClassDB */ |
| 2254 | |
| 2255 | /** |
| 2256 | * @name classdb_construct_object |
| 2257 | * @since 4.1 |
| 2258 | * |
| 2259 | * Constructs an Object of the requested class. |
| 2260 | * |
| 2261 | * The passed class must be a built-in godot class, or an already-registered extension class. In both cases, object_set_instance() should be called to fully initialize the object. |
| 2262 | * |
| 2263 | * @param p_classname A pointer to a StringName with the class name. |
| 2264 | * |
| 2265 | * @return A pointer to the newly created Object. |
| 2266 | */ |
| 2267 | typedef GDExtensionObjectPtr (*GDExtensionInterfaceClassdbConstructObject)(GDExtensionConstStringNamePtr p_classname); |
| 2268 | |
| 2269 | /** |
| 2270 | * @name classdb_get_method_bind |
| 2271 | * @since 4.1 |
| 2272 | * |
| 2273 | * Gets a pointer to the MethodBind in ClassDB for the given class, method and hash. |
| 2274 | * |
| 2275 | * @param p_classname A pointer to a StringName with the class name. |
| 2276 | * @param p_methodname A pointer to a StringName with the method name. |
| 2277 | * @param p_hash A hash representing the function signature. |
| 2278 | * |
| 2279 | * @return A pointer to the MethodBind from ClassDB. |
| 2280 | */ |
| 2281 | typedef GDExtensionMethodBindPtr (*GDExtensionInterfaceClassdbGetMethodBind)(GDExtensionConstStringNamePtr p_classname, GDExtensionConstStringNamePtr p_methodname, GDExtensionInt p_hash); |
| 2282 | |
| 2283 | /** |
| 2284 | * @name classdb_get_class_tag |
| 2285 | * @since 4.1 |
| 2286 | * |
| 2287 | * Gets a pointer uniquely identifying the given built-in class in the ClassDB. |
| 2288 | * |
| 2289 | * @param p_classname A pointer to a StringName with the class name. |
| 2290 | * |
| 2291 | * @return A pointer uniquely identifying the built-in class in the ClassDB. |
| 2292 | */ |
| 2293 | typedef void *(*GDExtensionInterfaceClassdbGetClassTag)(GDExtensionConstStringNamePtr p_classname); |
| 2294 | |
| 2295 | /* INTERFACE: ClassDB Extension */ |
| 2296 | |
| 2297 | /** |
| 2298 | * @name classdb_register_extension_class |
| 2299 | * @since 4.1 |
| 2300 | * @deprecated in Godot 4.2. Use `classdb_register_extension_class2` instead. |
| 2301 | * |
| 2302 | * Registers an extension class in the ClassDB. |
| 2303 | * |
| 2304 | * Provided struct can be safely freed once the function returns. |
| 2305 | * |
| 2306 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2307 | * @param p_class_name A pointer to a StringName with the class name. |
| 2308 | * @param p_parent_class_name A pointer to a StringName with the parent class name. |
| 2309 | * @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo struct. |
| 2310 | */ |
| 2311 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo *p_extension_funcs); |
| 2312 | |
| 2313 | /** |
| 2314 | * @name classdb_register_extension_class2 |
| 2315 | * @since 4.2 |
| 2316 | * |
| 2317 | * Registers an extension class in the ClassDB. |
| 2318 | * |
| 2319 | * Provided struct can be safely freed once the function returns. |
| 2320 | * |
| 2321 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2322 | * @param p_class_name A pointer to a StringName with the class name. |
| 2323 | * @param p_parent_class_name A pointer to a StringName with the parent class name. |
| 2324 | * @param p_extension_funcs A pointer to a GDExtensionClassCreationInfo2 struct. |
| 2325 | */ |
| 2326 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClass2)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_parent_class_name, const GDExtensionClassCreationInfo2 *p_extension_funcs); |
| 2327 | |
| 2328 | /** |
| 2329 | * @name classdb_register_extension_class_method |
| 2330 | * @since 4.1 |
| 2331 | * |
| 2332 | * Registers a method on an extension class in the ClassDB. |
| 2333 | * |
| 2334 | * Provided struct can be safely freed once the function returns. |
| 2335 | * |
| 2336 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2337 | * @param p_class_name A pointer to a StringName with the class name. |
| 2338 | * @param p_method_info A pointer to a GDExtensionClassMethodInfo struct. |
| 2339 | */ |
| 2340 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassMethod)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionClassMethodInfo *p_method_info); |
| 2341 | |
| 2342 | /** |
| 2343 | * @name classdb_register_extension_class_integer_constant |
| 2344 | * @since 4.1 |
| 2345 | * |
| 2346 | * Registers an integer constant on an extension class in the ClassDB. |
| 2347 | * |
| 2348 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2349 | * @param p_class_name A pointer to a StringName with the class name. |
| 2350 | * @param p_enum_name A pointer to a StringName with the enum name. |
| 2351 | * @param p_constant_name A pointer to a StringName with the constant name. |
| 2352 | * @param p_constant_value The constant value. |
| 2353 | * @param p_is_bitfield Whether or not this is a bit field. |
| 2354 | */ |
| 2355 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassIntegerConstant)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_enum_name, GDExtensionConstStringNamePtr p_constant_name, GDExtensionInt p_constant_value, GDExtensionBool p_is_bitfield); |
| 2356 | |
| 2357 | /** |
| 2358 | * @name classdb_register_extension_class_property |
| 2359 | * @since 4.1 |
| 2360 | * |
| 2361 | * Registers a property on an extension class in the ClassDB. |
| 2362 | * |
| 2363 | * Provided struct can be safely freed once the function returns. |
| 2364 | * |
| 2365 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2366 | * @param p_class_name A pointer to a StringName with the class name. |
| 2367 | * @param p_info A pointer to a GDExtensionPropertyInfo struct. |
| 2368 | * @param p_setter A pointer to a StringName with the name of the setter method. |
| 2369 | * @param p_getter A pointer to a StringName with the name of the getter method. |
| 2370 | */ |
| 2371 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassProperty)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter); |
| 2372 | |
| 2373 | /** |
| 2374 | * @name classdb_register_extension_class_property_indexed |
| 2375 | * @since 4.2 |
| 2376 | * |
| 2377 | * Registers an indexed property on an extension class in the ClassDB. |
| 2378 | * |
| 2379 | * Provided struct can be safely freed once the function returns. |
| 2380 | * |
| 2381 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2382 | * @param p_class_name A pointer to a StringName with the class name. |
| 2383 | * @param p_info A pointer to a GDExtensionPropertyInfo struct. |
| 2384 | * @param p_setter A pointer to a StringName with the name of the setter method. |
| 2385 | * @param p_getter A pointer to a StringName with the name of the getter method. |
| 2386 | * @param p_index The index to pass as the first argument to the getter and setter methods. |
| 2387 | */ |
| 2388 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyIndexed)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, const GDExtensionPropertyInfo *p_info, GDExtensionConstStringNamePtr p_setter, GDExtensionConstStringNamePtr p_getter, GDExtensionInt p_index); |
| 2389 | |
| 2390 | /** |
| 2391 | * @name classdb_register_extension_class_property_group |
| 2392 | * @since 4.1 |
| 2393 | * |
| 2394 | * Registers a property group on an extension class in the ClassDB. |
| 2395 | * |
| 2396 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2397 | * @param p_class_name A pointer to a StringName with the class name. |
| 2398 | * @param p_group_name A pointer to a String with the group name. |
| 2399 | * @param p_prefix A pointer to a String with the prefix used by properties in this group. |
| 2400 | */ |
| 2401 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertyGroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_group_name, GDExtensionConstStringPtr p_prefix); |
| 2402 | |
| 2403 | /** |
| 2404 | * @name classdb_register_extension_class_property_subgroup |
| 2405 | * @since 4.1 |
| 2406 | * |
| 2407 | * Registers a property subgroup on an extension class in the ClassDB. |
| 2408 | * |
| 2409 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2410 | * @param p_class_name A pointer to a StringName with the class name. |
| 2411 | * @param p_subgroup_name A pointer to a String with the subgroup name. |
| 2412 | * @param p_prefix A pointer to a String with the prefix used by properties in this subgroup. |
| 2413 | */ |
| 2414 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassPropertySubgroup)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringPtr p_subgroup_name, GDExtensionConstStringPtr p_prefix); |
| 2415 | |
| 2416 | /** |
| 2417 | * @name classdb_register_extension_class_signal |
| 2418 | * @since 4.1 |
| 2419 | * |
| 2420 | * Registers a signal on an extension class in the ClassDB. |
| 2421 | * |
| 2422 | * Provided structs can be safely freed once the function returns. |
| 2423 | * |
| 2424 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2425 | * @param p_class_name A pointer to a StringName with the class name. |
| 2426 | * @param p_signal_name A pointer to a StringName with the signal name. |
| 2427 | * @param p_argument_info A pointer to a GDExtensionPropertyInfo struct. |
| 2428 | * @param p_argument_count The number of arguments the signal receives. |
| 2429 | */ |
| 2430 | typedef void (*GDExtensionInterfaceClassdbRegisterExtensionClassSignal)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name, GDExtensionConstStringNamePtr p_signal_name, const GDExtensionPropertyInfo *p_argument_info, GDExtensionInt p_argument_count); |
| 2431 | |
| 2432 | /** |
| 2433 | * @name classdb_unregister_extension_class |
| 2434 | * @since 4.1 |
| 2435 | * |
| 2436 | * Unregisters an extension class in the ClassDB. |
| 2437 | * |
| 2438 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2439 | * @param p_class_name A pointer to a StringName with the class name. |
| 2440 | */ |
| 2441 | typedef void (*GDExtensionInterfaceClassdbUnregisterExtensionClass)(GDExtensionClassLibraryPtr p_library, GDExtensionConstStringNamePtr p_class_name); /* Unregistering a parent class before a class that inherits it will result in failure. Inheritors must be unregistered first. */ |
| 2442 | |
| 2443 | /** |
| 2444 | * @name get_library_path |
| 2445 | * @since 4.1 |
| 2446 | * |
| 2447 | * Gets the path to the current GDExtension library. |
| 2448 | * |
| 2449 | * @param p_library A pointer the library received by the GDExtension's entry point function. |
| 2450 | * @param r_path A pointer to a String which will receive the path. |
| 2451 | */ |
| 2452 | typedef void (*GDExtensionInterfaceGetLibraryPath)(GDExtensionClassLibraryPtr p_library, GDExtensionUninitializedStringPtr r_path); |
| 2453 | |
| 2454 | /** |
| 2455 | * @name editor_add_plugin |
| 2456 | * @since 4.1 |
| 2457 | * |
| 2458 | * Adds an editor plugin. |
| 2459 | * |
| 2460 | * It's safe to call during initialization. |
| 2461 | * |
| 2462 | * @param p_class_name A pointer to a StringName with the name of a class (descending from EditorPlugin) which is already registered with ClassDB. |
| 2463 | */ |
| 2464 | typedef void (*GDExtensionInterfaceEditorAddPlugin)(GDExtensionConstStringNamePtr p_class_name); |
| 2465 | |
| 2466 | /** |
| 2467 | * @name editor_remove_plugin |
| 2468 | * @since 4.1 |
| 2469 | * |
| 2470 | * Removes an editor plugin. |
| 2471 | * |
| 2472 | * @param p_class_name A pointer to a StringName with the name of a class that was previously added as an editor plugin. |
| 2473 | */ |
| 2474 | typedef void (*GDExtensionInterfaceEditorRemovePlugin)(GDExtensionConstStringNamePtr p_class_name); |
| 2475 | |
| 2476 | #ifdef __cplusplus |
| 2477 | } |
| 2478 | #endif |
| 2479 | |
| 2480 | #endif // GDEXTENSION_INTERFACE_H |
| 2481 | |