Path: blob/master/modules/mono/editor/bindings_generator.h
10278 views
/**************************************************************************/1/* bindings_generator.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */8/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */9/* */10/* Permission is hereby granted, free of charge, to any person obtaining */11/* a copy of this software and associated documentation files (the */12/* "Software"), to deal in the Software without restriction, including */13/* without limitation the rights to use, copy, modify, merge, publish, */14/* distribute, sublicense, and/or sell copies of the Software, and to */15/* permit persons to whom the Software is furnished to do so, subject to */16/* the following conditions: */17/* */18/* The above copyright notice and this permission notice shall be */19/* included in all copies or substantial portions of the Software. */20/* */21/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */22/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */23/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */24/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */25/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */26/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */27/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */28/**************************************************************************/2930#pragma once3132#ifdef DEBUG_ENABLED3334#include "core/doc_data.h"35#include "core/object/class_db.h"36#include "core/string/string_builder.h"37#include "core/string/ustring.h"38#include "core/typedefs.h"39#include "editor/doc/doc_tools.h"40#include "editor/doc/editor_help.h"4142class BindingsGenerator {43struct ConstantInterface {44String name;45String proxy_name;46int64_t value = 0;47const DocData::ConstantDoc *const_doc = nullptr;4849bool is_deprecated = false;50String deprecation_message;5152ConstantInterface() {}5354ConstantInterface(const String &p_name, const String &p_proxy_name, int64_t p_value) {55name = p_name;56proxy_name = p_proxy_name;57value = p_value;58}59};6061struct EnumInterface {62StringName cname;63String proxy_name;64List<ConstantInterface> constants;65bool is_flags = false;6667_FORCE_INLINE_ bool operator==(const EnumInterface &p_ienum) const {68return p_ienum.cname == cname;69}7071EnumInterface() {}7273EnumInterface(const StringName &p_cname, const String &p_proxy_name, bool p_is_flags) {74cname = p_cname;75proxy_name = p_proxy_name;76is_flags = p_is_flags;77}78};7980struct PropertyInterface {81StringName cname;82String proxy_name;83int index = 0;8485StringName setter;86StringName getter;8788/**89* Determines if the property will be hidden with the [EditorBrowsable(EditorBrowsableState.Never)]90* attribute.91* We do this for propertyies that have the PROPERTY_USAGE_INTERNAL flag, because they are not meant92* to be exposed to scripting but we can't remove them to prevent breaking compatibility.93*/94bool is_hidden = false;9596const DocData::PropertyDoc *prop_doc;9798bool is_deprecated = false;99String deprecation_message;100};101102struct TypeReference {103StringName cname;104bool is_enum = false;105106List<TypeReference> generic_type_parameters;107108TypeReference() {}109110TypeReference(const StringName &p_cname) :111cname(p_cname) {}112};113114struct ArgumentInterface {115enum DefaultParamMode {116CONSTANT,117NULLABLE_VAL,118NULLABLE_REF119};120121TypeReference type;122123String name;124125Variant def_param_value;126DefaultParamMode def_param_mode = CONSTANT;127128/**129* Determines the expression for the parameter default value.130* Formatting elements:131* %0 or %s: [cs_type] of the argument type132*/133String default_argument;134135ArgumentInterface() {}136};137138struct MethodInterface {139String name;140StringName cname;141142/**143* Name of the C# method144*/145String proxy_name;146147/**148* Hash of the ClassDB method149*/150uint64_t hash = 0;151152/**153* [TypeInterface::name] of the return type154*/155TypeReference return_type;156157/**158* Determines if the method has a variable number of arguments (VarArg)159*/160bool is_vararg = false;161162/**163* Determines if the method is static.164*/165bool is_static = false;166167/**168* Virtual methods ("virtual" as defined by the Godot API) are methods that by default do nothing,169* but can be overridden by the user to add custom functionality.170* e.g.: _ready, _process, etc.171*/172bool is_virtual = false;173174/**175* Determines if the call should fallback to Godot's object.Call(string, params) in C#.176*/177bool requires_object_call = false;178179/**180* Determines if the method visibility is 'internal' (visible only to files in the same assembly).181* Currently, we only use this for methods that are not meant to be exposed,182* but are required by properties as getters or setters.183* Methods that are not meant to be exposed are those that begin with underscore and are not virtual.184*/185bool is_internal = false;186187/**188* Determines if the method will be hidden with the [EditorBrowsable(EditorBrowsableState.Never)]189* attribute.190* We do this for methods that we don't want to expose but need to be public to prevent breaking191* compat (i.e: methods with 'is_compat' set to true.)192*/193bool is_hidden = false;194195/**196* Determines if the method is a compatibility method added to avoid breaking binary compatibility.197* These methods will be generated but hidden and are considered deprecated.198*/199bool is_compat = false;200201List<ArgumentInterface> arguments;202203const DocData::MethodDoc *method_doc = nullptr;204205bool is_deprecated = false;206String deprecation_message;207208void add_argument(const ArgumentInterface &argument) {209arguments.push_back(argument);210}211212MethodInterface() {}213};214215struct SignalInterface {216String name;217StringName cname;218219/**220* Name of the C# method221*/222String proxy_name;223224List<ArgumentInterface> arguments;225226const DocData::MethodDoc *method_doc = nullptr;227228bool is_deprecated = false;229String deprecation_message;230231void add_argument(const ArgumentInterface &argument) {232arguments.push_back(argument);233}234235SignalInterface() {}236};237238struct TypeInterface {239/**240* Identifier name for this type.241* Also used to format [c_out].242*/243String name;244StringName cname;245246int type_parameter_count = 0;247248/**249* Identifier name of the base class.250*/251StringName base_name;252253/**254* Name of the C# class255*/256String proxy_name;257258ClassDB::APIType api_type = ClassDB::API_NONE;259260bool is_enum = false;261bool is_object_type = false;262bool is_singleton = false;263bool is_singleton_instance = false;264bool is_ref_counted = false;265bool is_span_compatible = false;266267/**268* Class is a singleton, but can't be declared as a static class as that would269* break backwards compatibility. As such, instead of going with a static class,270* we use the actual singleton pattern (private constructor with instance property),271* which doesn't break compatibility.272*/273bool is_compat_singleton = false;274275/**276* Determines whether the native return value of this type must be disposed277* by the generated internal call (think of `godot_string`, whose destructor278* must be called). Some structs that are disposable may still disable this279* flag if the ownership is transferred.280*/281bool c_type_is_disposable_struct = false;282283/**284* Determines whether the native return value of this type must be zero initialized285* before its address is passed to ptrcall. This is required for types whose destructor286* is called before being assigned the return value by `PtrToArg::encode`, e.g.:287* Array, Dictionary, String, StringName, Variant.288* It's not necessary to set this to `true` if [c_type_is_disposable_struct] is already `true`.289*/290bool c_ret_needs_default_initialization = false;291292/**293* Used only by Object-derived types.294* Determines if this type is not abstract (incomplete).295* e.g.: CanvasItem cannot be instantiated.296*/297bool is_instantiable = false;298299/**300* Used only by Object-derived types.301* Determines if the C# class owns the native handle and must free it somehow when disposed.302* e.g.: RefCounted types must notify when the C# instance is disposed, for proper refcounting.303*/304bool memory_own = false;305306// !! The comments of the following fields make reference to other fields via square brackets, e.g.: [field_name]307// !! When renaming those fields, make sure to rename their references in the comments308309// --- C INTERFACE ---310311/**312* One or more statements that transform the parameter before being passed as argument of a ptrcall.313* If the statement adds a local that must be passed as the argument instead of the parameter,314* the expression with the name of that local must be specified with [c_arg_in].315* Formatting elements:316* %0: [c_type] of the parameter317* %1: name of the parameter318* %2-4: reserved319* %5: indentation text320*/321String c_in;322323/**324* One or more statements that transform the parameter before being passed as argument of a vararg call.325* If the statement adds a local that must be passed as the argument instead of the parameter,326* the name of that local must be specified with [c_arg_in].327* Formatting elements:328* %0: [c_type] of the parameter329* %1: name of the parameter330* %2-4: reserved331* %5: indentation text332*/333String c_in_vararg;334335/**336* Determines the expression that will be passed as argument to ptrcall.337* By default the value equals the name of the parameter,338* this varies for types that require special manipulation via [c_in].339* Formatting elements:340* %0 or %s: name of the parameter341*/342String c_arg_in = "%s";343344/**345* One or more statements that determine how a variable of this type is returned from a function.346* It must contain the return statement(s).347* Formatting elements:348* %0: [c_type_out] of the return type349* %1: name of the variable to be returned350* %2: [name] of the return type351* ---------------------------------------352* If [ret_as_byref_arg] is true, the format is different. Instead of using a return statement,353* the value must be assigned to a parameter. This type of this parameter is a pointer to [c_type_out].354* Formatting elements:355* %0: [c_type_out] of the return type356* %1: name of the variable to be returned357* %2: [name] of the return type358* %3-4: reserved359* %5: indentation text360*/361String c_out;362363/**364* The actual expected type, as seen (in most cases) in Variant copy constructors365* Used for the type of the return variable and to format [c_in].366* The value must be the following depending of the type:367* Object-derived types: Object*368* Other types: [name]369* -- Exceptions --370* VarArg (fictitious type to represent variable arguments): Array371* float: double (because ptrcall only supports double)372* int: int64_t (because ptrcall only supports int64_t and uint64_t)373* RefCounted types override this for the type of the return variable: Ref<RefCounted>374*/375String c_type;376377/**378* Determines the type used for parameters in function signatures.379*/380String c_type_in;381382/**383* Determines the return type used for function signatures.384* Also used to construct a default value to return in case of errors,385* and to format [c_out].386*/387String c_type_out;388389// --- C# INTERFACE ---390391/**392* An expression that overrides the way the parameter is passed to the internal call.393* If empty, the parameter is passed as is.394* Formatting elements:395* %0: name of the parameter396* %1: [c_type] of the parameter397*/398String cs_in_expr;399bool cs_in_expr_is_unsafe = false;400401/**402* One or more statements that transform the parameter before being passed to the internal call.403* If the statement adds a local that must be passed as the argument instead of the parameter,404* the expression with the name of that local must be specified with [cs_in_expr].405* Formatting elements:406* %0: [c_type] of the parameter407* %1: name of the parameter408* %2-4: reserved409* %5: indentation text410*/411String cs_in;412413/**414* One or more statements that determine how a variable of this type is returned from a method.415* It must contain the return statement(s).416* Formatting elements:417* %0: internal method name418* %1: internal method call arguments without surrounding parenthesis419* %2: [cs_type] of the return type420* %3: [c_type_out] of the return type421* %4: reserved422* %5: indentation text423*/424String cs_out;425426/**427* Type used for method signatures, both for parameters and the return type.428* Same as [proxy_name] except for variable arguments (VarArg) and collections (which include the namespace).429*/430String cs_type;431432/**433* Formatting elements:434* %0: input expression of type `in godot_variant`435* %1: [cs_type] of this type436* %2: [name] of this type437*/438String cs_variant_to_managed;439440/**441* Formatting elements:442* %0: input expression443* %1: [cs_type] of this type444* %2: [name] of this type445*/446String cs_managed_to_variant;447448const DocData::ClassDoc *class_doc = nullptr;449450bool is_deprecated = false;451String deprecation_message;452453List<ConstantInterface> constants;454List<EnumInterface> enums;455List<PropertyInterface> properties;456List<MethodInterface> methods;457List<SignalInterface> signals_;458HashSet<String> ignored_members;459460bool has_virtual_methods = false;461462const MethodInterface *find_method_by_name(const StringName &p_cname) const {463for (const MethodInterface &E : methods) {464if (E.cname == p_cname) {465return &E;466}467}468469return nullptr;470}471472const MethodInterface *find_method_by_proxy_name(const String &p_proxy_name) const {473for (const MethodInterface &E : methods) {474if (E.proxy_name == p_proxy_name) {475return &E;476}477}478479return nullptr;480}481482const PropertyInterface *find_property_by_name(const StringName &p_cname) const {483for (const PropertyInterface &E : properties) {484if (E.cname == p_cname) {485return &E;486}487}488489return nullptr;490}491492const PropertyInterface *find_property_by_proxy_name(const String &p_proxy_name) const {493for (const PropertyInterface &E : properties) {494if (E.proxy_name == p_proxy_name) {495return &E;496}497}498499return nullptr;500}501502const SignalInterface *find_signal_by_name(const StringName &p_cname) const {503for (const SignalInterface &E : signals_) {504if (E.cname == p_cname) {505return &E;506}507}508509return nullptr;510}511512const SignalInterface *find_signal_by_proxy_name(const String &p_proxy_name) const {513for (const SignalInterface &E : signals_) {514if (E.proxy_name == p_proxy_name) {515return &E;516}517}518519return nullptr;520}521522bool is_intentionally_ignored(const String &p_name) const {523return ignored_members.has(p_name);524}525526private:527static DocData::ClassDoc *_get_type_doc(TypeInterface &itype) {528String doc_name = itype.name.begins_with("_") ? itype.name.substr(1) : itype.name;529return &EditorHelp::get_doc_data()->class_list[doc_name];530}531532static void _init_value_type(TypeInterface &itype) {533if (itype.proxy_name.is_empty()) {534itype.proxy_name = itype.name;535}536537itype.cs_type = itype.proxy_name;538itype.c_type = itype.cs_type;539itype.c_type_in = itype.cs_type + "*";540itype.c_type_out = itype.cs_type;541542itype.class_doc = _get_type_doc(itype);543}544545static void _init_object_type(TypeInterface &itype, ClassDB::APIType p_api_type) {546if (itype.proxy_name.is_empty()) {547itype.proxy_name = itype.name;548}549550if (itype.proxy_name.begins_with("_")) {551itype.proxy_name = itype.proxy_name.substr(1);552}553554itype.api_type = p_api_type;555itype.is_object_type = true;556557itype.class_doc = _get_type_doc(itype);558}559560public:561static TypeInterface create_value_type(const String &p_name, const String &p_proxy_name) {562TypeInterface itype;563itype.name = p_name;564itype.cname = p_name;565itype.proxy_name = p_proxy_name;566_init_value_type(itype);567return itype;568}569570static TypeInterface create_value_type(const StringName &p_cname, const String &p_proxy_name) {571TypeInterface itype;572itype.name = p_cname;573itype.cname = p_cname;574itype.proxy_name = p_proxy_name;575_init_value_type(itype);576return itype;577}578579static TypeInterface create_value_type(const String &p_name) {580TypeInterface itype;581itype.name = p_name;582itype.cname = p_name;583_init_value_type(itype);584return itype;585}586587static TypeInterface create_value_type(const StringName &p_cname) {588TypeInterface itype;589itype.name = p_cname;590itype.cname = p_cname;591_init_value_type(itype);592return itype;593}594595static TypeInterface create_object_type(const StringName &p_cname, const String &p_proxy_name, ClassDB::APIType p_api_type) {596TypeInterface itype;597itype.name = p_cname;598itype.cname = p_cname;599itype.proxy_name = p_proxy_name;600_init_object_type(itype, p_api_type);601return itype;602}603604static TypeInterface create_object_type(const StringName &p_cname, ClassDB::APIType p_api_type) {605TypeInterface itype;606itype.name = p_cname;607itype.cname = p_cname;608_init_object_type(itype, p_api_type);609return itype;610}611612static void postsetup_enum_type(TypeInterface &r_enum_itype);613614TypeInterface() {615static String default_cs_variant_to_managed = "VariantUtils.ConvertTo<%1>(%0)";616static String default_cs_managed_to_variant = "VariantUtils.CreateFrom<%1>(%0)";617cs_variant_to_managed = default_cs_variant_to_managed;618cs_managed_to_variant = default_cs_managed_to_variant;619}620};621622struct InternalCall {623String name;624String unique_sig; // Unique signature to avoid duplicates in containers625bool editor_only = false;626627bool is_vararg = false;628bool is_static = false;629TypeReference return_type;630List<TypeReference> argument_types;631632_FORCE_INLINE_ int get_arguments_count() const { return argument_types.size(); }633634InternalCall() {}635636InternalCall(ClassDB::APIType api_type, const String &p_name, const String &p_unique_sig = String()) {637name = p_name;638unique_sig = p_unique_sig;639editor_only = api_type == ClassDB::API_EDITOR;640}641642inline bool operator==(const InternalCall &p_a) const {643return p_a.unique_sig == unique_sig;644}645};646647bool log_print_enabled = true;648bool initialized = false;649650HashMap<StringName, TypeInterface> obj_types;651652HashMap<StringName, TypeInterface> builtin_types;653HashMap<StringName, TypeInterface> enum_types;654655List<EnumInterface> global_enums;656List<ConstantInterface> global_constants;657658List<InternalCall> method_icalls;659/// Stores the unique internal calls from [method_icalls] that are assigned to each method.660HashMap<const MethodInterface *, const InternalCall *> method_icalls_map;661662HashMap<StringName, List<StringName>> blacklisted_methods;663HashSet<StringName> compat_singletons;664665void _initialize_blacklisted_methods();666void _initialize_compat_singletons();667668struct NameCache {669StringName type_void = "void";670StringName type_Variant = "Variant";671StringName type_VarArg = "VarArg";672StringName type_Object = "Object";673StringName type_RefCounted = "RefCounted";674StringName type_RID = "RID";675StringName type_Callable = "Callable";676StringName type_Signal = "Signal";677StringName type_String = "String";678StringName type_StringName = "StringName";679StringName type_NodePath = "NodePath";680StringName type_Array_generic = "Array_@generic";681StringName type_Dictionary_generic = "Dictionary_@generic";682StringName type_at_GlobalScope = "@GlobalScope";683StringName enum_Error = "Error";684685StringName type_sbyte = "sbyte";686StringName type_short = "short";687StringName type_int = "int";688StringName type_byte = "byte";689StringName type_ushort = "ushort";690StringName type_uint = "uint";691StringName type_long = "long";692StringName type_ulong = "ulong";693694StringName type_bool = "bool";695StringName type_float = "float";696StringName type_double = "double";697698StringName type_Vector2 = "Vector2";699StringName type_Rect2 = "Rect2";700StringName type_Vector3 = "Vector3";701StringName type_Vector3i = "Vector3i";702StringName type_Vector4 = "Vector4";703StringName type_Vector4i = "Vector4i";704705// Object not included as it must be checked for all derived classes706static constexpr int nullable_types_count = 19;707StringName nullable_types[nullable_types_count] = {708type_String,709type_StringName,710type_NodePath,711712type_Array_generic,713type_Dictionary_generic,714StringName(_STR(Array)),715StringName(_STR(Dictionary)),716StringName(_STR(Callable)),717StringName(_STR(Signal)),718719StringName(_STR(PackedByteArray)),720StringName(_STR(PackedInt32Array)),721StringName(_STR(PackedInt64Array)),722StringName(_STR(PackedFloat32Array)),723StringName(_STR(PackedFloat64Array)),724StringName(_STR(PackedStringArray)),725StringName(_STR(PackedVector2Array)),726StringName(_STR(PackedVector3Array)),727StringName(_STR(PackedColorArray)),728StringName(_STR(PackedVector4Array)),729};730731bool is_nullable_type(const StringName &p_type) const {732for (int i = 0; i < nullable_types_count; i++) {733if (p_type == nullable_types[i]) {734return true;735}736}737738return false;739}740741NameCache() {}742743private:744NameCache(const NameCache &);745void operator=(const NameCache &);746};747748NameCache name_cache;749750const ConstantInterface *find_constant_by_name(const String &p_name, const List<ConstantInterface> &p_constants) const {751for (const ConstantInterface &E : p_constants) {752if (E.name == p_name) {753return &E;754}755}756757return nullptr;758}759760inline String get_arg_unique_sig(const TypeInterface &p_type) {761// For parameters, we treat reference and non-reference derived types the same.762if (p_type.is_object_type) {763return "Obj";764} else if (p_type.is_enum) {765return "int";766} else if (p_type.cname == name_cache.type_Array_generic) {767return "Array";768} else if (p_type.cname == name_cache.type_Dictionary_generic) {769return "Dictionary";770}771772return p_type.name;773}774775inline String get_ret_unique_sig(const TypeInterface *p_type) {776// Reference derived return types are treated differently.777if (p_type->is_ref_counted) {778return "Ref";779} else if (p_type->is_object_type) {780return "Obj";781} else if (p_type->is_enum) {782return "int";783} else if (p_type->cname == name_cache.type_Array_generic) {784return "Array";785} else if (p_type->cname == name_cache.type_Dictionary_generic) {786return "Dictionary";787}788789return p_type->name;790}791792String bbcode_to_text(const String &p_bbcode, const TypeInterface *p_itype);793String bbcode_to_xml(const String &p_bbcode, const TypeInterface *p_itype, bool p_is_signal = false);794795void _append_text_method(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);796void _append_text_member(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);797void _append_text_signal(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);798void _append_text_enum(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);799void _append_text_constant(StringBuilder &p_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);800void _append_text_constant_in_global_scope(StringBuilder &p_output, const String &p_target_cname, const String &p_link_target);801void _append_text_param(StringBuilder &p_output, const String &p_link_target);802void _append_text_undeclared(StringBuilder &p_output, const String &p_link_target);803804void _append_xml_method(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts, const TypeInterface *p_source_itype);805void _append_xml_member(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts, const TypeInterface *p_source_itype);806void _append_xml_signal(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts, const TypeInterface *p_source_itype);807void _append_xml_enum(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts, const TypeInterface *p_source_itype);808void _append_xml_constant(StringBuilder &p_xml_output, const TypeInterface *p_target_itype, const StringName &p_target_cname, const String &p_link_target, const Vector<String> &p_link_target_parts);809void _append_xml_constant_in_global_scope(StringBuilder &p_xml_output, const String &p_target_cname, const String &p_link_target);810void _append_xml_param(StringBuilder &p_xml_output, const String &p_link_target, bool p_is_signal);811void _append_xml_undeclared(StringBuilder &p_xml_output, const String &p_link_target);812813bool _validate_api_type(const TypeInterface *p_target_itype, const TypeInterface *p_source_itype);814815int _determine_enum_prefix(const EnumInterface &p_ienum);816void _apply_prefix_to_enum_constants(EnumInterface &p_ienum, int p_prefix_length);817818Error _populate_method_icalls_table(const TypeInterface &p_itype);819820const TypeInterface *_get_type_or_null(const TypeReference &p_typeref);821const TypeInterface *_get_type_or_singleton_or_null(const TypeReference &p_typeref);822823const String _get_generic_type_parameters(const TypeInterface &p_itype, const List<TypeReference> &p_generic_type_parameters);824825StringName _get_type_name_from_meta(Variant::Type p_type, GodotTypeInfo::Metadata p_meta);826StringName _get_int_type_name_from_meta(GodotTypeInfo::Metadata p_meta);827StringName _get_float_type_name_from_meta(GodotTypeInfo::Metadata p_meta);828829bool _arg_default_value_from_variant(const Variant &p_val, ArgumentInterface &r_iarg);830bool _arg_default_value_is_assignable_to_type(const Variant &p_val, const TypeInterface &p_arg_type);831832bool _populate_object_type_interfaces();833void _populate_builtin_type_interfaces();834835void _populate_global_constants();836837bool _method_has_conflicting_signature(const MethodInterface &p_imethod, const TypeInterface &p_itype);838bool _method_has_conflicting_signature(const MethodInterface &p_imethod_left, const MethodInterface &p_imethod_right);839840Error _generate_cs_type(const TypeInterface &itype, const String &p_output_file);841842Error _generate_cs_property(const TypeInterface &p_itype, const PropertyInterface &p_iprop, StringBuilder &p_output);843Error _generate_cs_method(const TypeInterface &p_itype, const MethodInterface &p_imethod, int &p_method_bind_count, StringBuilder &p_output, bool p_use_span);844Error _generate_cs_signal(const BindingsGenerator::TypeInterface &p_itype, const BindingsGenerator::SignalInterface &p_isignal, StringBuilder &p_output);845846Error _generate_cs_native_calls(const InternalCall &p_icall, StringBuilder &r_output);847848void _generate_array_extensions(StringBuilder &p_output);849void _generate_global_constants(StringBuilder &p_output);850851Error _save_file(const String &p_path, const StringBuilder &p_content);852853void _log(const char *p_format, ...) _PRINTF_FORMAT_ATTRIBUTE_2_3;854855void _initialize();856857public:858Error generate_cs_core_project(const String &p_proj_dir);859Error generate_cs_editor_project(const String &p_proj_dir);860Error generate_cs_api(const String &p_output_dir);861862_FORCE_INLINE_ bool is_log_print_enabled() { return log_print_enabled; }863_FORCE_INLINE_ void set_log_print_enabled(bool p_enabled) { log_print_enabled = p_enabled; }864865_FORCE_INLINE_ bool is_initialized() { return initialized; }866867static void handle_cmdline_args(const List<String> &p_cmdline_args);868869BindingsGenerator() {870_initialize();871}872};873874#endif // DEBUG_ENABLED875876877