MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _append_xml_method

Method _append_xml_method

modules/mono/editor/bindings_generator.cpp:1088–1160  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1086}
1087
1088void BindingsGenerator::_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) {
1089 if (p_link_target_parts[0] == name_cache.type_at_GlobalScope) {
1090 if (OS::get_singleton()->is_stdout_verbose()) {
1091 OS::get_singleton()->print("Cannot resolve @GlobalScope method reference in documentation: %s\n", p_link_target.utf8().get_data());
1092 }
1093
1094 /// @todo Map what we can
1095 _append_xml_undeclared(p_xml_output, p_link_target);
1096 } else if (!p_target_itype || !p_target_itype->is_object_type) {
1097 if (OS::get_singleton()->is_stdout_verbose()) {
1098 if (p_target_itype) {
1099 OS::get_singleton()->print("Cannot resolve method reference for non-GodotObject type in documentation: %s\n", p_link_target.utf8().get_data());
1100 } else {
1101 OS::get_singleton()->print("Cannot resolve type from method reference in documentation: %s\n", p_link_target.utf8().get_data());
1102 }
1103 }
1104
1105 /// @todo Map what we can
1106 _append_xml_undeclared(p_xml_output, p_link_target);
1107 } else {
1108 if (p_target_cname == "_init") {
1109 // The _init method is not declared in C#, reference the constructor instead
1110 p_xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".");
1111 p_xml_output.append(p_target_itype->proxy_name);
1112 p_xml_output.append(".");
1113 p_xml_output.append(p_target_itype->proxy_name);
1114 p_xml_output.append("()\"/>");
1115 } else {
1116 const MethodInterface *target_imethod = p_target_itype->find_method_by_name(p_target_cname);
1117
1118 if (target_imethod) {
1119 const String method_name = p_target_itype->proxy_name + "." + target_imethod->proxy_name;
1120 if (!_validate_api_type(p_target_itype, p_source_itype)) {
1121 _append_xml_undeclared(p_xml_output, method_name);
1122 } else {
1123 p_xml_output.append("<see cref=\"" BINDINGS_NAMESPACE ".");
1124 p_xml_output.append(method_name);
1125 p_xml_output.append("(");
1126 bool first_key = true;
1127 for (const ArgumentInterface &iarg : target_imethod->arguments) {
1128 const TypeInterface *arg_type = _get_type_or_null(iarg.type);
1129
1130 if (first_key) {
1131 first_key = false;
1132 } else {
1133 p_xml_output.append(", ");
1134 }
1135 if (!arg_type) {
1136 ERR_PRINT("Cannot resolve argument type in documentation: '" + p_link_target + "'.");
1137 p_xml_output.append(iarg.type.cname);
1138 continue;
1139 }
1140 if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL) {
1141 p_xml_output.append("Nullable{");
1142 }
1143 String arg_cs_type = arg_type->cs_type + _get_generic_type_parameters(*arg_type, iarg.type.generic_type_parameters);
1144 p_xml_output.append(arg_cs_type.replacen("<", "{").replacen(">", "}").replacen("params ", ""));
1145 if (iarg.def_param_mode == ArgumentInterface::NULLABLE_VAL) {

Callers

nothing calls this directly

Calls 8

replacenMethod · 0.80
is_stdout_verboseMethod · 0.45
printMethod · 0.45
get_dataMethod · 0.45
utf8Method · 0.45
appendMethod · 0.45
find_method_by_nameMethod · 0.45

Tested by

no test coverage detected