1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-28 16:07:14 +00:00

Add inheriting classes to DocTools

This commit is contained in:
A Thousand Ships
2023-08-16 14:00:59 +02:00
parent 4b55c81eba
commit dc86483e3a
5 changed files with 93 additions and 62 deletions

View File

@@ -307,21 +307,21 @@ void DocTools::merge_from(const DocTools &p_data) {
}
}
void DocTools::remove_from(const DocTools &p_data) {
for (const KeyValue<String, DocData::ClassDoc> &E : p_data.class_list) {
if (class_list.has(E.key)) {
class_list.erase(E.key);
}
}
}
void DocTools::add_doc(const DocData::ClassDoc &p_class_doc) {
ERR_FAIL_COND(p_class_doc.name.is_empty());
class_list[p_class_doc.name] = p_class_doc;
inheriting[p_class_doc.inherits].insert(p_class_doc.name);
}
void DocTools::remove_doc(const String &p_class_name) {
ERR_FAIL_COND(p_class_name.is_empty() || !class_list.has(p_class_name));
const String &inherits = class_list[p_class_name].inherits;
if (inheriting.has(inherits)) {
inheriting[inherits].erase(p_class_name);
if (inheriting[inherits].is_empty()) {
inheriting.erase(inherits);
}
}
class_list.erase(p_class_name);
}
@@ -391,6 +391,8 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
c.name = cname;
c.inherits = ClassDB::get_parent_class(name);
inheriting[c.inherits].insert(cname);
List<PropertyInfo> properties;
List<PropertyInfo> own_properties;
@@ -692,6 +694,7 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
// it's not a ClassDB-exposed class.
class_list["Variant"] = DocData::ClassDoc();
class_list["Variant"].name = "Variant";
inheriting[""].insert("Variant");
}
// Add Variant data types.
@@ -709,6 +712,8 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
DocData::ClassDoc &c = class_list[cname];
c.name = cname;
inheriting[""].insert(cname);
Callable::CallError cerror;
Variant v;
Variant::construct(Variant::Type(i), v, nullptr, 0, cerror);
@@ -870,6 +875,8 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
DocData::ClassDoc &c = class_list[cname];
c.name = cname;
inheriting[""].insert(cname);
// Global constants.
for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) {
DocData::ConstantDoc cd;
@@ -953,6 +960,8 @@ void DocTools::generate(BitField<GenerateFlags> p_flags) {
DocData::ClassDoc c;
c.name = cname;
inheriting[""].insert(cname);
// Get functions.
List<MethodInfo> minfo;
lang->get_public_functions(&minfo);
@@ -1195,6 +1204,8 @@ Error DocTools::_load(Ref<XMLParser> parser) {
c.inherits = parser->get_named_attribute_value("inherits");
}
inheriting[c.inherits].insert(name);
if (parser->has_attribute("is_deprecated")) {
c.is_deprecated = parser->get_named_attribute_value("is_deprecated").to_lower() == "true";
}