2023-01-10 14:26:54 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* doc_data.cpp */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "doc_data.h"
|
2014-02-16 00:16:33 +00:00
|
|
|
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/engine.h"
|
|
|
|
#include "core/global_constants.h"
|
|
|
|
#include "core/io/compression.h"
|
|
|
|
#include "core/io/marshalls.h"
|
|
|
|
#include "core/os/dir_access.h"
|
|
|
|
#include "core/project_settings.h"
|
|
|
|
#include "core/script_language.h"
|
2021-12-16 10:22:44 +00:00
|
|
|
#include "core/translation.h"
|
2018-09-11 16:13:45 +00:00
|
|
|
#include "core/version.h"
|
2021-05-07 20:21:03 +00:00
|
|
|
#include "editor/editor_settings.h"
|
2014-06-30 01:41:02 +00:00
|
|
|
#include "scene/resources/theme.h"
|
2014-02-16 00:16:33 +00:00
|
|
|
|
2021-12-16 10:22:44 +00:00
|
|
|
static String _get_indent(const String &p_text) {
|
|
|
|
String indent;
|
|
|
|
bool has_text = false;
|
|
|
|
int line_start = 0;
|
|
|
|
|
|
|
|
for (int i = 0; i < p_text.length(); i++) {
|
|
|
|
const char32_t c = p_text[i];
|
|
|
|
if (c == '\n') {
|
|
|
|
line_start = i + 1;
|
|
|
|
} else if (c > 32) {
|
|
|
|
has_text = true;
|
|
|
|
indent = p_text.substr(line_start, i - line_start);
|
|
|
|
break; // Indentation of the first line that has text.
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!has_text) {
|
|
|
|
return p_text;
|
|
|
|
}
|
|
|
|
return indent;
|
|
|
|
}
|
|
|
|
|
|
|
|
static String _translate_doc_string(const String &p_text) {
|
|
|
|
const String indent = _get_indent(p_text);
|
|
|
|
const String message = p_text.dedent().strip_edges();
|
|
|
|
const String translated = TranslationServer::get_singleton()->doc_translate(message);
|
|
|
|
// No need to restore stripped edges because they'll be stripped again later.
|
|
|
|
return translated.indent(indent);
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void DocData::merge_from(const DocData &p_data) {
|
|
|
|
for (Map<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
ClassDoc &c = E->get();
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (!p_data.class_list.has(c.name)) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
const ClassDoc &cf = p_data.class_list[c.name];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
c.description = cf.description;
|
|
|
|
c.brief_description = cf.brief_description;
|
2017-09-12 20:42:36 +00:00
|
|
|
c.tutorials = cf.tutorials;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.methods.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
MethodDoc &m = c.methods.write[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < cf.methods.size(); j++) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (cf.methods[j].name != m.name) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
if (cf.methods[j].arguments.size() != m.arguments.size()) {
|
2015-04-22 03:25:13 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2016-05-03 06:45:54 +00:00
|
|
|
// since polymorphic functions are allowed we need to check the type of
|
|
|
|
// the arguments so we make sure they are different.
|
|
|
|
int arg_count = cf.methods[j].arguments.size();
|
2016-05-04 14:46:28 +00:00
|
|
|
Vector<bool> arg_used;
|
|
|
|
arg_used.resize(arg_count);
|
2021-05-05 10:44:11 +00:00
|
|
|
for (int l = 0; l < arg_count; ++l) {
|
2018-07-25 01:11:03 +00:00
|
|
|
arg_used.write[l] = false;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2016-05-03 06:45:54 +00:00
|
|
|
// also there is no guarantee that argument ordering will match, so we
|
|
|
|
// have to check one by one so we make sure we have an exact match
|
|
|
|
for (int k = 0; k < arg_count; ++k) {
|
2021-05-05 10:44:11 +00:00
|
|
|
for (int l = 0; l < arg_count; ++l) {
|
2016-05-03 06:45:54 +00:00
|
|
|
if (cf.methods[j].arguments[k].type == m.arguments[l].type && !arg_used[l]) {
|
2018-07-25 01:11:03 +00:00
|
|
|
arg_used.write[l] = true;
|
2016-05-03 06:45:54 +00:00
|
|
|
break;
|
|
|
|
}
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2016-05-03 06:45:54 +00:00
|
|
|
}
|
|
|
|
bool not_the_same = false;
|
2021-05-05 10:44:11 +00:00
|
|
|
for (int l = 0; l < arg_count; ++l) {
|
|
|
|
if (!arg_used[l]) { // at least one of the arguments was different
|
2016-05-03 06:45:54 +00:00
|
|
|
not_the_same = true;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (not_the_same) {
|
2016-05-03 06:45:54 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2015-04-22 03:25:13 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
const MethodDoc &mf = cf.methods[j];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
m.description = mf.description;
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.signals.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
MethodDoc &m = c.signals.write[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < cf.signals.size(); j++) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (cf.signals[j].name != m.name) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
const MethodDoc &mf = cf.signals[j];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
m.description = mf.description;
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.constants.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
ConstantDoc &m = c.constants.write[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < cf.constants.size(); j++) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (cf.constants[j].name != m.name) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
const ConstantDoc &mf = cf.constants[j];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
m.description = mf.description;
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.properties.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
PropertyDoc &p = c.properties.write[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < cf.properties.size(); j++) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (cf.properties[j].name != p.name) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
const PropertyDoc &pf = cf.properties[j];
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
p.description = pf.description;
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.theme_properties.size(); i++) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc &ti = c.theme_properties.write[i];
|
2014-06-30 01:41:02 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < cf.theme_properties.size(); j++) {
|
2021-08-06 15:07:21 +00:00
|
|
|
if (cf.theme_properties[j].name != ti.name || cf.theme_properties[j].data_type != ti.data_type) {
|
2014-06-30 01:41:02 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2021-08-06 15:07:21 +00:00
|
|
|
const ThemeItemDoc &pf = cf.theme_properties[j];
|
2014-06-30 01:41:02 +00:00
|
|
|
|
2021-08-06 15:07:21 +00:00
|
|
|
ti.description = pf.description;
|
2014-06-30 01:41:02 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-16 11:12:22 +00:00
|
|
|
void DocData::remove_from(const DocData &p_data) {
|
2017-03-05 15:44:50 +00:00
|
|
|
for (Map<String, ClassDoc>::Element *E = p_data.class_list.front(); E; E = E->next()) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (class_list.has(E->key())) {
|
2016-12-16 11:12:22 +00:00
|
|
|
class_list.erase(E->key());
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2016-12-16 11:12:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-29 05:15:46 +00:00
|
|
|
static void return_doc_from_retinfo(DocData::MethodDoc &p_method, const PropertyInfo &p_retinfo) {
|
|
|
|
if (p_retinfo.type == Variant::INT && p_retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
|
|
|
|
p_method.return_enum = p_retinfo.class_name;
|
2021-05-05 10:44:11 +00:00
|
|
|
if (p_method.return_enum.begins_with("_")) { //proxy class
|
2017-09-16 10:50:07 +00:00
|
|
|
p_method.return_enum = p_method.return_enum.substr(1, p_method.return_enum.length());
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-08-29 05:15:46 +00:00
|
|
|
p_method.return_type = "int";
|
|
|
|
} else if (p_retinfo.class_name != StringName()) {
|
|
|
|
p_method.return_type = p_retinfo.class_name;
|
|
|
|
} else if (p_retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
|
|
|
|
p_method.return_type = p_retinfo.hint_string;
|
|
|
|
} else if (p_retinfo.type == Variant::NIL && p_retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
|
|
|
|
p_method.return_type = "Variant";
|
|
|
|
} else if (p_retinfo.type == Variant::NIL) {
|
|
|
|
p_method.return_type = "void";
|
|
|
|
} else {
|
|
|
|
p_method.return_type = Variant::get_type_name(p_retinfo.type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void argument_doc_from_arginfo(DocData::ArgumentDoc &p_argument, const PropertyInfo &p_arginfo) {
|
|
|
|
p_argument.name = p_arginfo.name;
|
|
|
|
|
|
|
|
if (p_arginfo.type == Variant::INT && p_arginfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
|
|
|
|
p_argument.enumeration = p_arginfo.class_name;
|
2021-05-05 10:44:11 +00:00
|
|
|
if (p_argument.enumeration.begins_with("_")) { //proxy class
|
2017-09-16 10:50:07 +00:00
|
|
|
p_argument.enumeration = p_argument.enumeration.substr(1, p_argument.enumeration.length());
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-08-29 05:15:46 +00:00
|
|
|
p_argument.type = "int";
|
|
|
|
} else if (p_arginfo.class_name != StringName()) {
|
|
|
|
p_argument.type = p_arginfo.class_name;
|
|
|
|
} else if (p_arginfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
|
|
|
|
p_argument.type = p_arginfo.hint_string;
|
|
|
|
} else if (p_arginfo.type == Variant::NIL) {
|
|
|
|
// Parameters cannot be void, so PROPERTY_USAGE_NIL_IS_VARIANT is not necessary
|
|
|
|
p_argument.type = "Variant";
|
|
|
|
} else {
|
|
|
|
p_argument.type = Variant::get_type_name(p_arginfo.type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-03 10:42:34 +00:00
|
|
|
static Variant get_documentation_default_value(const StringName &p_class_name, const StringName &p_property_name, bool &r_default_value_valid) {
|
|
|
|
Variant default_value = Variant();
|
|
|
|
r_default_value_valid = false;
|
|
|
|
|
|
|
|
if (ClassDB::can_instance(p_class_name)) {
|
|
|
|
default_value = ClassDB::class_get_default_property_value(p_class_name, p_property_name, &r_default_value_valid);
|
|
|
|
} else {
|
|
|
|
// Cannot get default value of classes that can't be instanced
|
|
|
|
List<StringName> inheriting_classes;
|
|
|
|
ClassDB::get_direct_inheriters_from_class(p_class_name, &inheriting_classes);
|
|
|
|
for (List<StringName>::Element *E2 = inheriting_classes.front(); E2; E2 = E2->next()) {
|
|
|
|
if (ClassDB::can_instance(E2->get())) {
|
|
|
|
default_value = ClassDB::class_get_default_property_value(E2->get(), p_property_name, &r_default_value_valid);
|
2021-05-05 10:44:11 +00:00
|
|
|
if (r_default_value_valid) {
|
2019-09-03 10:42:34 +00:00
|
|
|
break;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-09-03 10:42:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return default_value;
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void DocData::generate(bool p_basic_types) {
|
2015-06-29 03:29:49 +00:00
|
|
|
List<StringName> classes;
|
2017-01-03 02:03:46 +00:00
|
|
|
ClassDB::get_class_list(&classes);
|
2015-06-29 03:29:49 +00:00
|
|
|
classes.sort_custom<StringName::AlphCompare>();
|
2020-01-26 14:18:06 +00:00
|
|
|
// Move ProjectSettings, so that other classes can register properties there.
|
2020-01-22 20:37:56 +00:00
|
|
|
classes.move_to_back(classes.find("ProjectSettings"));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-11-24 15:32:59 +00:00
|
|
|
bool skip_setter_getter_methods = true;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while (classes.size()) {
|
2017-11-24 16:59:43 +00:00
|
|
|
Set<StringName> setters_getters;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
String name = classes.front()->get();
|
2020-04-20 10:29:34 +00:00
|
|
|
if (!ClassDB::is_class_exposed(name)) {
|
|
|
|
print_verbose(vformat("Class '%s' is not exposed, skipping.", name));
|
|
|
|
classes.pop_front();
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
String cname = name;
|
2021-05-05 10:44:11 +00:00
|
|
|
if (cname.begins_with("_")) { //proxy class
|
2017-03-05 15:44:50 +00:00
|
|
|
cname = cname.substr(1, name.length());
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
class_list[cname] = ClassDoc();
|
|
|
|
ClassDoc &c = class_list[cname];
|
|
|
|
c.name = cname;
|
|
|
|
c.inherits = ClassDB::get_parent_class(name);
|
2017-01-04 04:16:14 +00:00
|
|
|
|
|
|
|
List<PropertyInfo> properties;
|
2019-09-03 10:42:34 +00:00
|
|
|
List<PropertyInfo> own_properties;
|
2021-05-07 20:21:03 +00:00
|
|
|
|
|
|
|
// Special case for editor and project settings, so they can be documented.
|
|
|
|
if (name == "EditorSettings") {
|
|
|
|
// We don't create the full blown EditorSettings (+ config file) with `create()`,
|
|
|
|
// instead we just make a local instance to get default values.
|
|
|
|
Ref<EditorSettings> edset = memnew(EditorSettings);
|
|
|
|
edset->get_property_list(&properties);
|
|
|
|
own_properties = properties;
|
|
|
|
} else if (name == "ProjectSettings") {
|
2018-06-11 16:41:16 +00:00
|
|
|
ProjectSettings::get_singleton()->get_property_list(&properties);
|
2019-09-03 10:42:34 +00:00
|
|
|
own_properties = properties;
|
2018-06-11 16:41:16 +00:00
|
|
|
} else {
|
2019-09-03 10:42:34 +00:00
|
|
|
ClassDB::get_property_list(name, &properties);
|
|
|
|
ClassDB::get_property_list(name, &own_properties, true);
|
2018-06-11 16:41:16 +00:00
|
|
|
}
|
|
|
|
|
2019-09-03 10:42:34 +00:00
|
|
|
List<PropertyInfo>::Element *EO = own_properties.front();
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
|
2021-05-04 14:00:45 +00:00
|
|
|
bool inherited = EO == nullptr;
|
2019-09-03 10:42:34 +00:00
|
|
|
if (EO && EO->get() == E->get()) {
|
|
|
|
inherited = false;
|
|
|
|
EO = EO->next();
|
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (E->get().usage & PROPERTY_USAGE_GROUP || E->get().usage & PROPERTY_USAGE_CATEGORY || E->get().usage & PROPERTY_USAGE_INTERNAL) {
|
2017-01-04 04:16:14 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-01-04 04:16:14 +00:00
|
|
|
|
|
|
|
PropertyDoc prop;
|
2017-03-05 15:44:50 +00:00
|
|
|
prop.name = E->get().name;
|
2019-09-03 10:42:34 +00:00
|
|
|
prop.overridden = inherited;
|
|
|
|
|
2021-12-02 20:15:17 +00:00
|
|
|
if (inherited) {
|
|
|
|
String parent = ClassDB::get_parent_class(c.name);
|
|
|
|
while (!ClassDB::has_property(parent, prop.name, true)) {
|
|
|
|
parent = ClassDB::get_parent_class(parent);
|
|
|
|
}
|
|
|
|
prop.overrides = parent;
|
|
|
|
}
|
|
|
|
|
2019-06-29 12:51:33 +00:00
|
|
|
bool default_value_valid = false;
|
2020-01-22 13:22:21 +00:00
|
|
|
Variant default_value;
|
2019-06-29 12:51:33 +00:00
|
|
|
|
2021-05-07 20:21:03 +00:00
|
|
|
if (name == "EditorSettings") {
|
|
|
|
if (E->get().name == "resource_local_to_scene" || E->get().name == "resource_name" || E->get().name == "resource_path" || E->get().name == "script") {
|
|
|
|
// Don't include spurious properties in the generated EditorSettings class reference.
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-22 13:22:21 +00:00
|
|
|
if (name == "ProjectSettings") {
|
|
|
|
// Special case for project settings, so that settings are not taken from the current project's settings
|
|
|
|
if (E->get().name == "script" ||
|
|
|
|
ProjectSettings::get_singleton()->get_order(E->get().name) >= ProjectSettings::NO_BUILTIN_ORDER_BASE) {
|
2019-09-03 10:42:34 +00:00
|
|
|
continue;
|
2020-01-22 13:22:21 +00:00
|
|
|
}
|
|
|
|
if (E->get().usage & PROPERTY_USAGE_EDITOR) {
|
2021-10-10 20:40:32 +00:00
|
|
|
if (!ProjectSettings::get_singleton()->get_ignore_value_in_docs(E->get().name)) {
|
|
|
|
default_value = ProjectSettings::get_singleton()->property_get_revert(E->get().name);
|
|
|
|
default_value_valid = true;
|
|
|
|
}
|
2020-01-22 13:22:21 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
default_value = get_documentation_default_value(name, E->get().name, default_value_valid);
|
|
|
|
|
|
|
|
if (inherited) {
|
|
|
|
bool base_default_value_valid = false;
|
|
|
|
Variant base_default_value = get_documentation_default_value(ClassDB::get_parent_class(name), E->get().name, base_default_value_valid);
|
2021-05-05 10:44:11 +00:00
|
|
|
if (!default_value_valid || !base_default_value_valid || default_value == base_default_value) {
|
2020-01-22 13:22:21 +00:00
|
|
|
continue;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2020-01-22 13:22:21 +00:00
|
|
|
}
|
2019-06-01 13:42:22 +00:00
|
|
|
}
|
|
|
|
|
2019-07-12 18:17:12 +00:00
|
|
|
if (default_value_valid && default_value.get_type() != Variant::OBJECT) {
|
|
|
|
prop.default_value = default_value.get_construct_string().replace("\n", "");
|
2019-06-29 12:51:33 +00:00
|
|
|
}
|
|
|
|
|
2019-09-03 10:42:34 +00:00
|
|
|
StringName setter = ClassDB::get_property_setter(name, E->get().name);
|
|
|
|
StringName getter = ClassDB::get_property_getter(name, E->get().name);
|
|
|
|
|
|
|
|
prop.setter = setter;
|
|
|
|
prop.getter = getter;
|
|
|
|
|
2017-08-23 22:10:32 +00:00
|
|
|
bool found_type = false;
|
|
|
|
if (getter != StringName()) {
|
|
|
|
MethodBind *mb = ClassDB::get_method(name, getter);
|
|
|
|
if (mb) {
|
|
|
|
PropertyInfo retinfo = mb->get_return_info();
|
|
|
|
|
|
|
|
found_type = true;
|
|
|
|
if (retinfo.type == Variant::INT && retinfo.usage & PROPERTY_USAGE_CLASS_IS_ENUM) {
|
|
|
|
prop.enumeration = retinfo.class_name;
|
2023-04-10 16:00:15 +00:00
|
|
|
if (prop.enumeration.begins_with("_")) { //proxy class
|
|
|
|
prop.enumeration = prop.enumeration.substr(1, prop.enumeration.length());
|
|
|
|
}
|
2017-08-23 22:10:32 +00:00
|
|
|
prop.type = "int";
|
|
|
|
} else if (retinfo.class_name != StringName()) {
|
|
|
|
prop.type = retinfo.class_name;
|
|
|
|
} else if (retinfo.hint == PROPERTY_HINT_RESOURCE_TYPE) {
|
|
|
|
prop.type = retinfo.hint_string;
|
|
|
|
} else if (retinfo.type == Variant::NIL && retinfo.usage & PROPERTY_USAGE_NIL_IS_VARIANT) {
|
|
|
|
prop.type = "Variant";
|
|
|
|
} else if (retinfo.type == Variant::NIL) {
|
|
|
|
prop.type = "void";
|
|
|
|
} else {
|
|
|
|
prop.type = Variant::get_type_name(retinfo.type);
|
|
|
|
}
|
|
|
|
}
|
2017-11-24 15:32:59 +00:00
|
|
|
|
|
|
|
setters_getters.insert(getter);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (setter != StringName()) {
|
|
|
|
setters_getters.insert(setter);
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!found_type) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (E->get().type == Variant::OBJECT && E->get().hint == PROPERTY_HINT_RESOURCE_TYPE) {
|
2017-08-23 22:10:32 +00:00
|
|
|
prop.type = E->get().hint_string;
|
2021-05-05 10:44:11 +00:00
|
|
|
} else {
|
2017-08-23 22:10:32 +00:00
|
|
|
prop.type = Variant::get_type_name(E->get().type);
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
2017-01-04 04:16:14 +00:00
|
|
|
|
|
|
|
c.properties.push_back(prop);
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
List<MethodInfo> method_list;
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::get_method_list(name, &method_list, true);
|
2014-02-10 01:10:30 +00:00
|
|
|
method_list.sort();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (E->get().name == "" || (E->get().name[0] == '_' && !(E->get().flags & METHOD_FLAG_VIRTUAL))) {
|
2017-03-24 20:45:31 +00:00
|
|
|
continue; //hidden, don't count
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-06-27 14:10:09 +00:00
|
|
|
if (skip_setter_getter_methods && setters_getters.has(E->get().name)) {
|
|
|
|
// Don't skip parametric setters and getters, i.e. method which require
|
|
|
|
// one or more parameters to define what property should be set or retrieved.
|
|
|
|
// E.g. CPUParticles::set_param(Parameter param, float value).
|
|
|
|
if (E->get().arguments.size() == 0 /* getter */ || (E->get().arguments.size() == 1 && E->get().return_val.type == Variant::NIL /* setter */)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2017-11-24 15:32:59 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
MethodDoc method;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
method.name = E->get().name;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (E->get().flags & METHOD_FLAG_VIRTUAL) {
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers = "virtual";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-08-25 18:25:17 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (E->get().flags & METHOD_FLAG_CONST) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (method.qualifiers != "") {
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers += " ";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers += "const";
|
|
|
|
} else if (E->get().flags & METHOD_FLAG_VARARG) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (method.qualifiers != "") {
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers += " ";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers += "vararg";
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = -1; i < E->get().arguments.size(); i++) {
|
|
|
|
if (i == -1) {
|
2015-11-18 11:33:29 +00:00
|
|
|
#ifdef DEBUG_METHODS_ENABLED
|
2017-08-29 05:15:46 +00:00
|
|
|
return_doc_from_retinfo(method, E->get().return_val);
|
2015-11-18 11:33:29 +00:00
|
|
|
#endif
|
2014-02-10 01:10:30 +00:00
|
|
|
} else {
|
2017-08-29 05:15:46 +00:00
|
|
|
const PropertyInfo &arginfo = E->get().arguments[i];
|
|
|
|
ArgumentDoc argument;
|
|
|
|
argument_doc_from_arginfo(argument, arginfo);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-23 22:10:32 +00:00
|
|
|
int darg_idx = i - (E->get().arguments.size() - E->get().default_arguments.size());
|
|
|
|
if (darg_idx >= 0) {
|
|
|
|
Variant default_arg = E->get().default_arguments[darg_idx];
|
|
|
|
argument.default_value = default_arg.get_construct_string();
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
method.arguments.push_back(argument);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
c.methods.push_back(method);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<MethodInfo> signal_list;
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDB::get_signal_list(name, &signal_list, true);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
if (signal_list.size()) {
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<MethodInfo>::Element *EV = signal_list.front(); EV; EV = EV->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
MethodDoc signal;
|
2017-03-05 15:44:50 +00:00
|
|
|
signal.name = EV->get().name;
|
|
|
|
for (int i = 0; i < EV->get().arguments.size(); i++) {
|
2020-01-26 14:18:06 +00:00
|
|
|
const PropertyInfo &arginfo = EV->get().arguments[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
ArgumentDoc argument;
|
2020-01-26 14:18:06 +00:00
|
|
|
argument_doc_from_arginfo(argument, arginfo);
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
signal.arguments.push_back(argument);
|
|
|
|
}
|
|
|
|
|
|
|
|
c.signals.push_back(signal);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> constant_list;
|
2017-01-03 02:03:46 +00:00
|
|
|
ClassDB::get_integer_constant_list(name, &constant_list, true);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<String>::Element *E = constant_list.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
ConstantDoc constant;
|
2017-03-05 15:44:50 +00:00
|
|
|
constant.name = E->get();
|
|
|
|
constant.value = itos(ClassDB::get_integer_constant(name, E->get()));
|
2021-10-10 20:40:32 +00:00
|
|
|
constant.is_value_valid = true;
|
2017-08-23 22:10:32 +00:00
|
|
|
constant.enumeration = ClassDB::get_integer_constant_enum(name, E->get());
|
2014-02-10 01:10:30 +00:00
|
|
|
c.constants.push_back(constant);
|
|
|
|
}
|
|
|
|
|
2021-08-06 15:07:21 +00:00
|
|
|
// Theme items.
|
2014-06-30 01:41:02 +00:00
|
|
|
{
|
|
|
|
List<StringName> l;
|
2021-08-06 15:07:21 +00:00
|
|
|
|
|
|
|
Theme::get_default()->get_color_list(cname, &l);
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<StringName>::Element *E = l.front(); E; E = E->next()) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc tid;
|
|
|
|
tid.name = E->get();
|
|
|
|
tid.type = "Color";
|
|
|
|
tid.data_type = "color";
|
|
|
|
tid.default_value = Variant(Theme::get_default()->get_color(E->get(), cname)).get_construct_string();
|
|
|
|
c.theme_properties.push_back(tid);
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
l.clear();
|
2021-08-06 15:07:21 +00:00
|
|
|
Theme::get_default()->get_constant_list(cname, &l);
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<StringName>::Element *E = l.front(); E; E = E->next()) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc tid;
|
|
|
|
tid.name = E->get();
|
|
|
|
tid.type = "int";
|
|
|
|
tid.data_type = "constant";
|
|
|
|
tid.default_value = itos(Theme::get_default()->get_constant(E->get(), cname));
|
|
|
|
c.theme_properties.push_back(tid);
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
l.clear();
|
2021-08-06 15:07:21 +00:00
|
|
|
Theme::get_default()->get_font_list(cname, &l);
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<StringName>::Element *E = l.front(); E; E = E->next()) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc tid;
|
|
|
|
tid.name = E->get();
|
|
|
|
tid.type = "Font";
|
|
|
|
tid.data_type = "font";
|
|
|
|
c.theme_properties.push_back(tid);
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
2021-08-06 15:07:21 +00:00
|
|
|
|
2014-06-30 01:41:02 +00:00
|
|
|
l.clear();
|
2021-08-06 15:07:21 +00:00
|
|
|
Theme::get_default()->get_icon_list(cname, &l);
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<StringName>::Element *E = l.front(); E; E = E->next()) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc tid;
|
|
|
|
tid.name = E->get();
|
|
|
|
tid.type = "Texture";
|
|
|
|
tid.data_type = "icon";
|
|
|
|
c.theme_properties.push_back(tid);
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
2021-08-06 15:07:21 +00:00
|
|
|
|
2014-06-30 01:41:02 +00:00
|
|
|
l.clear();
|
2017-03-05 15:44:50 +00:00
|
|
|
Theme::get_default()->get_stylebox_list(cname, &l);
|
|
|
|
for (List<StringName>::Element *E = l.front(); E; E = E->next()) {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc tid;
|
|
|
|
tid.name = E->get();
|
|
|
|
tid.type = "StyleBox";
|
|
|
|
tid.data_type = "style";
|
|
|
|
c.theme_properties.push_back(tid);
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
2021-12-01 19:45:12 +00:00
|
|
|
|
|
|
|
c.theme_properties.sort();
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
classes.pop_front();
|
|
|
|
}
|
|
|
|
|
2016-06-29 22:54:22 +00:00
|
|
|
{
|
2020-01-26 14:18:06 +00:00
|
|
|
// So we can document the concept of Variant even if it's not a usable class per se.
|
2017-03-05 15:44:50 +00:00
|
|
|
class_list["Variant"] = ClassDoc();
|
|
|
|
class_list["Variant"].name = "Variant";
|
2016-06-29 22:54:22 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (!p_basic_types) {
|
2014-02-10 01:10:30 +00:00
|
|
|
return;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-01-26 14:18:06 +00:00
|
|
|
// Add Variant types.
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (i == Variant::NIL) {
|
2020-01-26 14:18:06 +00:00
|
|
|
continue; // Not exposed outside of 'null', should not be in class list.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
if (i == Variant::OBJECT) {
|
2020-01-26 14:18:06 +00:00
|
|
|
continue; // Use the core type instead.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
String cname = Variant::get_type_name(Variant::Type(i));
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
class_list[cname] = ClassDoc();
|
|
|
|
ClassDoc &c = class_list[cname];
|
|
|
|
c.name = cname;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
Variant::CallError cerror;
|
2021-05-04 14:00:45 +00:00
|
|
|
Variant v = Variant::construct(Variant::Type(i), nullptr, 0, cerror);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
List<MethodInfo> method_list;
|
|
|
|
v.get_method_list(&method_list);
|
|
|
|
method_list.sort();
|
|
|
|
Variant::get_constructor_list(Variant::Type(i), &method_list);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
for (List<MethodInfo>::Element *E = method_list.front(); E; E = E->next()) {
|
|
|
|
MethodInfo &mi = E->get();
|
|
|
|
MethodDoc method;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
method.name = mi.name;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
for (int j = 0; j < mi.arguments.size(); j++) {
|
|
|
|
PropertyInfo arginfo = mi.arguments[j];
|
2017-08-29 05:15:46 +00:00
|
|
|
ArgumentDoc ad;
|
2020-01-26 14:18:06 +00:00
|
|
|
argument_doc_from_arginfo(ad, mi.arguments[j]);
|
2017-08-29 05:15:46 +00:00
|
|
|
ad.name = arginfo.name;
|
|
|
|
|
2020-03-09 09:51:17 +00:00
|
|
|
int darg_idx = mi.default_arguments.size() - mi.arguments.size() + j;
|
|
|
|
if (darg_idx >= 0) {
|
|
|
|
Variant default_arg = mi.default_arguments[darg_idx];
|
|
|
|
ad.default_value = default_arg.get_construct_string();
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-29 05:15:46 +00:00
|
|
|
method.arguments.push_back(ad);
|
2017-05-20 15:38:03 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
if (mi.return_val.type == Variant::NIL) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (mi.return_val.name != "") {
|
2018-08-31 20:38:28 +00:00
|
|
|
method.return_type = "Variant";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-05-20 15:38:03 +00:00
|
|
|
} else {
|
|
|
|
method.return_type = Variant::get_type_name(mi.return_val.type);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
c.methods.push_back(method);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<PropertyInfo> properties;
|
|
|
|
v.get_property_list(&properties);
|
|
|
|
for (List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
|
|
|
|
PropertyInfo pi = E->get();
|
|
|
|
PropertyDoc property;
|
|
|
|
property.name = pi.name;
|
|
|
|
property.type = Variant::get_type_name(pi.type);
|
2019-06-01 13:42:22 +00:00
|
|
|
property.default_value = v.get(pi.name).get_construct_string();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
c.properties.push_back(property);
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
List<StringName> constants;
|
2017-12-15 15:43:27 +00:00
|
|
|
Variant::get_constants_for_type(Variant::Type(i), &constants);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-05-20 15:38:03 +00:00
|
|
|
for (List<StringName>::Element *E = constants.front(); E; E = E->next()) {
|
|
|
|
ConstantDoc constant;
|
|
|
|
constant.name = E->get();
|
2017-12-15 15:43:27 +00:00
|
|
|
Variant value = Variant::get_constant_value(Variant::Type(i), E->get());
|
|
|
|
constant.value = value.get_type() == Variant::INT ? itos(value) : value.get_construct_string();
|
2021-10-10 20:40:32 +00:00
|
|
|
constant.is_value_valid = true;
|
2017-05-20 15:38:03 +00:00
|
|
|
c.constants.push_back(constant);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//built in constants and functions
|
|
|
|
|
|
|
|
{
|
2017-11-15 17:45:34 +00:00
|
|
|
String cname = "@GlobalScope";
|
2017-03-05 15:44:50 +00:00
|
|
|
class_list[cname] = ClassDoc();
|
|
|
|
ClassDoc &c = class_list[cname];
|
|
|
|
c.name = cname;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
ConstantDoc cd;
|
2017-03-05 15:44:50 +00:00
|
|
|
cd.name = GlobalConstants::get_global_constant_name(i);
|
2021-10-10 20:40:32 +00:00
|
|
|
if (!GlobalConstants::get_ignore_value_in_docs(i)) {
|
|
|
|
cd.value = itos(GlobalConstants::get_global_constant_value(i));
|
|
|
|
cd.is_value_valid = true;
|
|
|
|
} else {
|
|
|
|
cd.is_value_valid = false;
|
|
|
|
}
|
2017-08-23 22:10:32 +00:00
|
|
|
cd.enumeration = GlobalConstants::get_global_constant_enum(i);
|
2014-02-10 01:10:30 +00:00
|
|
|
c.constants.push_back(cd);
|
|
|
|
}
|
|
|
|
|
2017-11-13 20:46:57 +00:00
|
|
|
List<Engine::Singleton> singletons;
|
|
|
|
Engine::get_singleton()->get_singletons(&singletons);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
//servers (this is kind of hackish)
|
2017-11-13 20:46:57 +00:00
|
|
|
for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
|
2014-02-10 01:10:30 +00:00
|
|
|
PropertyDoc pd;
|
2017-11-13 20:46:57 +00:00
|
|
|
Engine::Singleton &s = E->get();
|
2018-05-11 18:20:27 +00:00
|
|
|
if (!s.ptr) {
|
|
|
|
continue;
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
pd.name = s.name;
|
|
|
|
pd.type = s.ptr->get_class();
|
2021-05-05 10:44:11 +00:00
|
|
|
while (String(ClassDB::get_parent_class(pd.type)) != "Object") {
|
2017-03-05 15:44:50 +00:00
|
|
|
pd.type = ClassDB::get_parent_class(pd.type);
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
if (pd.type.begins_with("_")) {
|
2017-03-05 15:44:50 +00:00
|
|
|
pd.type = pd.type.substr(1, pd.type.length());
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
c.properties.push_back(pd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-17 13:06:13 +00:00
|
|
|
// Built-in script reference.
|
|
|
|
// We only add a doc entry for languages which actually define any built-in
|
|
|
|
// methods or constants.
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
{
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
ScriptLanguage *lang = ScriptServer::get_language(i);
|
2017-03-05 15:44:50 +00:00
|
|
|
String cname = "@" + lang->get_name();
|
2020-06-17 13:06:13 +00:00
|
|
|
ClassDoc c;
|
2017-03-05 15:44:50 +00:00
|
|
|
c.name = cname;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-06-17 13:06:13 +00:00
|
|
|
// Get functions.
|
2014-02-10 01:10:30 +00:00
|
|
|
List<MethodInfo> minfo;
|
|
|
|
lang->get_public_functions(&minfo);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (List<MethodInfo>::Element *E = minfo.front(); E; E = E->next()) {
|
|
|
|
MethodInfo &mi = E->get();
|
2014-02-10 01:10:30 +00:00
|
|
|
MethodDoc md;
|
2017-03-05 15:44:50 +00:00
|
|
|
md.name = mi.name;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-08-29 16:16:03 +00:00
|
|
|
if (mi.flags & METHOD_FLAG_VARARG) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (md.qualifiers != "") {
|
2017-08-29 16:16:03 +00:00
|
|
|
md.qualifiers += " ";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-08-29 16:16:03 +00:00
|
|
|
md.qualifiers += "vararg";
|
|
|
|
}
|
|
|
|
|
2017-08-29 05:15:46 +00:00
|
|
|
return_doc_from_retinfo(md, mi.return_val);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
for (int j = 0; j < mi.arguments.size(); j++) {
|
2014-02-10 01:10:30 +00:00
|
|
|
ArgumentDoc ad;
|
2019-02-12 20:10:08 +00:00
|
|
|
argument_doc_from_arginfo(ad, mi.arguments[j]);
|
2018-01-30 04:06:19 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
int darg_idx = j - (mi.arguments.size() - mi.default_arguments.size());
|
2018-01-30 04:06:19 +00:00
|
|
|
if (darg_idx >= 0) {
|
|
|
|
Variant default_arg = E->get().default_arguments[darg_idx];
|
|
|
|
ad.default_value = default_arg.get_construct_string();
|
|
|
|
}
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
md.arguments.push_back(ad);
|
|
|
|
}
|
|
|
|
|
|
|
|
c.methods.push_back(md);
|
|
|
|
}
|
|
|
|
|
2020-06-17 13:06:13 +00:00
|
|
|
// Get constants.
|
2021-05-04 12:20:36 +00:00
|
|
|
List<Pair<String, Variant>> cinfo;
|
2014-02-22 23:28:19 +00:00
|
|
|
lang->get_public_constants(&cinfo);
|
|
|
|
|
2021-05-04 12:20:36 +00:00
|
|
|
for (List<Pair<String, Variant>>::Element *E = cinfo.front(); E; E = E->next()) {
|
2014-02-22 23:28:19 +00:00
|
|
|
ConstantDoc cd;
|
2017-03-05 15:44:50 +00:00
|
|
|
cd.name = E->get().first;
|
|
|
|
cd.value = E->get().second;
|
2021-10-10 20:40:32 +00:00
|
|
|
cd.is_value_valid = true;
|
2014-02-22 23:28:19 +00:00
|
|
|
c.constants.push_back(cd);
|
|
|
|
}
|
2020-06-17 13:06:13 +00:00
|
|
|
|
|
|
|
// Skip adding the lang if it doesn't expose anything (e.g. C#).
|
|
|
|
if (c.methods.empty() && c.constants.empty()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
class_list[cname] = c;
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
static Error _parse_methods(Ref<XMLParser> &parser, Vector<DocData::MethodDoc> &methods) {
|
|
|
|
String section = parser->get_node_name();
|
|
|
|
String element = section.substr(0, section.length() - 1);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
|
|
|
if (parser->get_node_name() == element) {
|
2014-02-10 01:10:30 +00:00
|
|
|
DocData::MethodDoc method;
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
|
|
|
method.name = parser->get_attribute_value("name");
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->has_attribute("qualifiers")) {
|
2017-03-05 15:44:50 +00:00
|
|
|
method.qualifiers = parser->get_attribute_value("qualifiers");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
|
|
|
String name = parser->get_node_name();
|
|
|
|
if (name == "return") {
|
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
|
|
|
|
method.return_type = parser->get_attribute_value("type");
|
2017-09-02 19:52:45 +00:00
|
|
|
if (parser->has_attribute("enum")) {
|
|
|
|
method.return_enum = parser->get_attribute_value("enum");
|
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
} else if (name == "argument") {
|
2014-02-10 01:10:30 +00:00
|
|
|
DocData::ArgumentDoc argument;
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
|
|
|
argument.name = parser->get_attribute_value("name");
|
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
|
|
|
|
argument.type = parser->get_attribute_value("type");
|
2017-08-23 22:10:32 +00:00
|
|
|
if (parser->has_attribute("enum")) {
|
|
|
|
argument.enumeration = parser->get_attribute_value("enum");
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
method.arguments.push_back(argument);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
} else if (name == "description") {
|
2014-02-10 01:10:30 +00:00
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2017-11-11 01:11:24 +00:00
|
|
|
method.description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == element) {
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
methods.push_back(method);
|
|
|
|
|
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + parser->get_node_name() + ".");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == section) {
|
2014-02-10 01:10:30 +00:00
|
|
|
break;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
Error DocData::load_classes(const String &p_dir) {
|
|
|
|
Error err;
|
2017-09-12 21:06:26 +00:00
|
|
|
DirAccessRef da = DirAccess::open(p_dir, &err);
|
2017-09-12 20:42:36 +00:00
|
|
|
if (!da) {
|
2014-02-10 01:10:30 +00:00
|
|
|
return err;
|
2017-09-12 20:42:36 +00:00
|
|
|
}
|
2014-02-16 00:16:33 +00:00
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
da->list_dir_begin();
|
|
|
|
String path;
|
2019-07-25 09:09:57 +00:00
|
|
|
path = da->get_next();
|
2017-09-12 21:06:26 +00:00
|
|
|
while (path != String()) {
|
2019-07-25 09:09:57 +00:00
|
|
|
if (!da->current_is_dir() && path.ends_with("xml")) {
|
2017-09-12 20:42:36 +00:00
|
|
|
Ref<XMLParser> parser = memnew(XMLParser);
|
2019-02-12 20:10:08 +00:00
|
|
|
Error err2 = parser->open(p_dir.plus_file(path));
|
2021-05-05 10:44:11 +00:00
|
|
|
if (err2) {
|
2019-02-12 20:10:08 +00:00
|
|
|
return err2;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-09-12 20:42:36 +00:00
|
|
|
|
|
|
|
_load(parser);
|
|
|
|
}
|
2019-07-25 09:09:57 +00:00
|
|
|
path = da->get_next();
|
2017-09-12 20:42:36 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
da->list_dir_end();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
Error DocData::erase_classes(const String &p_dir) {
|
|
|
|
Error err;
|
2017-09-12 21:06:26 +00:00
|
|
|
DirAccessRef da = DirAccess::open(p_dir, &err);
|
2017-09-12 20:42:36 +00:00
|
|
|
if (!da) {
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> to_erase;
|
|
|
|
|
|
|
|
da->list_dir_begin();
|
|
|
|
String path;
|
2019-07-25 09:09:57 +00:00
|
|
|
path = da->get_next();
|
2017-09-12 21:06:26 +00:00
|
|
|
while (path != String()) {
|
2019-07-25 09:09:57 +00:00
|
|
|
if (!da->current_is_dir() && path.ends_with("xml")) {
|
2017-09-12 20:42:36 +00:00
|
|
|
to_erase.push_back(path);
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2019-07-25 09:09:57 +00:00
|
|
|
path = da->get_next();
|
2017-09-12 20:42:36 +00:00
|
|
|
}
|
|
|
|
da->list_dir_end();
|
|
|
|
|
2017-09-12 21:06:26 +00:00
|
|
|
while (to_erase.size()) {
|
2017-09-12 20:42:36 +00:00
|
|
|
da->remove(to_erase.front()->get());
|
|
|
|
to_erase.pop_front();
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
Error DocData::_load(Ref<XMLParser> parser) {
|
|
|
|
Error err = OK;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while ((err = parser->read()) == OK) {
|
2017-09-12 20:42:36 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT && parser->get_node_name() == "?xml") {
|
|
|
|
parser->skip_section();
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() != XMLParser::NODE_ELEMENT) {
|
2014-02-10 01:10:30 +00:00
|
|
|
continue; //no idea what this may be, but skipping anyway
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(parser->get_node_name() != "class", ERR_FILE_CORRUPT);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
2014-02-10 01:10:30 +00:00
|
|
|
String name = parser->get_attribute_value("name");
|
2017-03-05 15:44:50 +00:00
|
|
|
class_list[name] = ClassDoc();
|
|
|
|
ClassDoc &c = class_list[name];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
c.name = name;
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->has_attribute("inherits")) {
|
2014-02-10 01:10:30 +00:00
|
|
|
c.inherits = parser->get_attribute_value("inherits");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
2019-02-12 20:10:08 +00:00
|
|
|
String name2 = parser->get_node_name();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
if (name2 == "brief_description") {
|
2014-02-10 01:10:30 +00:00
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2017-11-11 01:11:24 +00:00
|
|
|
c.brief_description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "description") {
|
2014-02-10 01:10:30 +00:00
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2017-11-11 01:11:24 +00:00
|
|
|
c.description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "tutorials") {
|
2018-06-11 11:35:44 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
2019-02-12 20:10:08 +00:00
|
|
|
String name3 = parser->get_node_name();
|
2018-06-11 11:35:44 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
if (name3 == "link") {
|
2020-06-07 01:26:35 +00:00
|
|
|
TutorialDoc tutorial;
|
|
|
|
if (parser->has_attribute("title")) {
|
|
|
|
tutorial.title = parser->get_attribute_value("title");
|
|
|
|
}
|
2018-06-11 11:35:44 +00:00
|
|
|
parser->read();
|
2020-06-07 01:26:35 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
|
|
|
tutorial.link = parser->get_node_data().strip_edges();
|
|
|
|
c.tutorials.push_back(tutorial);
|
|
|
|
}
|
2018-06-11 11:35:44 +00:00
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
|
2018-06-11 11:35:44 +00:00
|
|
|
}
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "tutorials") {
|
2019-09-24 11:34:03 +00:00
|
|
|
break; // End of <tutorials>.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2018-06-11 11:35:44 +00:00
|
|
|
}
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "methods") {
|
|
|
|
Error err2 = _parse_methods(parser, c.methods);
|
|
|
|
ERR_FAIL_COND_V(err2, err2);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "signals") {
|
|
|
|
Error err2 = _parse_methods(parser, c.signals);
|
|
|
|
ERR_FAIL_COND_V(err2, err2);
|
|
|
|
} else if (name2 == "members") {
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
2019-02-12 20:10:08 +00:00
|
|
|
String name3 = parser->get_node_name();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
if (name3 == "member") {
|
|
|
|
PropertyDoc prop2;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.name = parser->get_attribute_value("name");
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.type = parser->get_attribute_value("type");
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->has_attribute("setter")) {
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.setter = parser->get_attribute_value("setter");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
if (parser->has_attribute("getter")) {
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.getter = parser->get_attribute_value("getter");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
|
|
|
if (parser->has_attribute("enum")) {
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.enumeration = parser->get_attribute_value("enum");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-09-24 11:34:03 +00:00
|
|
|
if (!parser->is_empty()) {
|
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2019-09-24 11:34:03 +00:00
|
|
|
prop2.description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-09-24 11:34:03 +00:00
|
|
|
}
|
2019-02-12 20:10:08 +00:00
|
|
|
c.properties.push_back(prop2);
|
2014-02-10 01:10:30 +00:00
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "members") {
|
2019-09-24 11:34:03 +00:00
|
|
|
break; // End of <members>.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "theme_items") {
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
2019-02-12 20:10:08 +00:00
|
|
|
String name3 = parser->get_node_name();
|
2014-06-30 01:41:02 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
if (name3 == "theme_item") {
|
2021-08-06 15:07:21 +00:00
|
|
|
ThemeItemDoc prop2;
|
2014-06-30 01:41:02 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.name = parser->get_attribute_value("name");
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("type"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
prop2.type = parser->get_attribute_value("type");
|
2021-08-06 15:07:21 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("data_type"), ERR_FILE_CORRUPT);
|
|
|
|
prop2.data_type = parser->get_attribute_value("data_type");
|
2019-09-24 11:34:03 +00:00
|
|
|
if (!parser->is_empty()) {
|
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2019-09-24 11:34:03 +00:00
|
|
|
prop2.description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-09-24 11:34:03 +00:00
|
|
|
}
|
2019-02-12 20:10:08 +00:00
|
|
|
c.theme_properties.push_back(prop2);
|
2014-06-30 01:41:02 +00:00
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "theme_items") {
|
2019-09-24 11:34:03 +00:00
|
|
|
break; // End of <theme_items>.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
} else if (name2 == "constants") {
|
2017-03-05 15:44:50 +00:00
|
|
|
while (parser->read() == OK) {
|
|
|
|
if (parser->get_node_type() == XMLParser::NODE_ELEMENT) {
|
2019-02-12 20:10:08 +00:00
|
|
|
String name3 = parser->get_node_name();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-02-12 20:10:08 +00:00
|
|
|
if (name3 == "constant") {
|
|
|
|
ConstantDoc constant2;
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("name"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
constant2.name = parser->get_attribute_value("name");
|
2017-03-05 15:44:50 +00:00
|
|
|
ERR_FAIL_COND_V(!parser->has_attribute("value"), ERR_FILE_CORRUPT);
|
2019-02-12 20:10:08 +00:00
|
|
|
constant2.value = parser->get_attribute_value("value");
|
2021-10-10 20:40:32 +00:00
|
|
|
constant2.is_value_valid = true;
|
2017-08-23 22:10:32 +00:00
|
|
|
if (parser->has_attribute("enum")) {
|
2019-02-12 20:10:08 +00:00
|
|
|
constant2.enumeration = parser->get_attribute_value("enum");
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
2019-09-24 11:34:03 +00:00
|
|
|
if (!parser->is_empty()) {
|
|
|
|
parser->read();
|
2021-05-05 10:44:11 +00:00
|
|
|
if (parser->get_node_type() == XMLParser::NODE_TEXT) {
|
2019-09-24 11:34:03 +00:00
|
|
|
constant2.description = parser->get_node_data();
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-09-24 11:34:03 +00:00
|
|
|
}
|
2019-02-12 20:10:08 +00:00
|
|
|
c.constants.push_back(constant2);
|
2014-02-10 01:10:30 +00:00
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name3 + ".");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "constants") {
|
2019-09-24 11:34:03 +00:00
|
|
|
break; // End of <constants>.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2019-08-15 02:57:49 +00:00
|
|
|
ERR_FAIL_V_MSG(ERR_FILE_CORRUPT, "Invalid tag in doc file: " + name2 + ".");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
} else if (parser->get_node_type() == XMLParser::NODE_ELEMENT_END && parser->get_node_name() == "class") {
|
2019-09-24 11:34:03 +00:00
|
|
|
break; // End of <class>.
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
static void _write_string(FileAccess *f, int p_tablevel, const String &p_string) {
|
2021-05-05 10:44:11 +00:00
|
|
|
if (p_string == "") {
|
2017-11-11 01:11:24 +00:00
|
|
|
return;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
String tab;
|
2021-05-05 10:44:11 +00:00
|
|
|
for (int i = 0; i < p_tablevel; i++) {
|
2017-03-05 15:44:50 +00:00
|
|
|
tab += "\t";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
f->store_string(tab + p_string + "\n");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-09-12 21:06:26 +00:00
|
|
|
Error DocData::save_classes(const String &p_default_path, const Map<String, String> &p_class_path) {
|
2017-09-12 20:42:36 +00:00
|
|
|
for (Map<String, ClassDoc>::Element *E = class_list.front(); E; E = E->next()) {
|
2017-03-05 15:44:50 +00:00
|
|
|
ClassDoc &c = E->get();
|
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
String save_path;
|
|
|
|
if (p_class_path.has(c.name)) {
|
2017-09-12 21:06:26 +00:00
|
|
|
save_path = p_class_path[c.name];
|
2017-09-12 20:42:36 +00:00
|
|
|
} else {
|
2017-09-12 21:06:26 +00:00
|
|
|
save_path = p_default_path;
|
2017-09-12 20:42:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Error err;
|
2017-09-12 21:06:26 +00:00
|
|
|
String save_file = save_path.plus_file(c.name + ".xml");
|
2017-09-12 20:42:36 +00:00
|
|
|
FileAccessRef f = FileAccess::open(save_file, FileAccess::WRITE, &err);
|
2019-08-15 02:57:49 +00:00
|
|
|
|
|
|
|
ERR_CONTINUE_MSG(err != OK, "Can't write doc file: " + save_file + ".");
|
2017-09-12 20:42:36 +00:00
|
|
|
|
|
|
|
_write_string(f, 0, "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
String header = "<class name=\"" + c.name + "\"";
|
2021-05-05 10:44:11 +00:00
|
|
|
if (c.inherits != "") {
|
2017-03-05 15:44:50 +00:00
|
|
|
header += " inherits=\"" + c.inherits + "\"";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2020-02-14 16:38:20 +00:00
|
|
|
header += String(" version=\"") + VERSION_BRANCH + "\"";
|
2022-03-16 22:01:02 +00:00
|
|
|
// Reference the XML schema so editors can provide error checking.
|
|
|
|
// Modules are nested deep, so change the path to reference the same schema everywhere.
|
|
|
|
const String schema_path = save_path.find("modules/") != -1 ? "../../../doc/class.xsd" : "../class.xsd";
|
|
|
|
header += vformat(
|
|
|
|
R"( xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="%s">)",
|
|
|
|
schema_path);
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 0, header);
|
2020-01-26 15:01:49 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<brief_description>");
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 2, _translate_doc_string(c.brief_description).strip_edges().xml_escape());
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</brief_description>");
|
2020-01-26 15:01:49 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<description>");
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 2, _translate_doc_string(c.description).strip_edges().xml_escape());
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</description>");
|
2020-01-26 15:01:49 +00:00
|
|
|
|
2017-09-12 20:42:36 +00:00
|
|
|
_write_string(f, 1, "<tutorials>");
|
2018-06-11 11:35:44 +00:00
|
|
|
for (int i = 0; i < c.tutorials.size(); i++) {
|
2020-06-07 01:26:35 +00:00
|
|
|
TutorialDoc tutorial = c.tutorials.get(i);
|
2022-02-17 03:11:23 +00:00
|
|
|
String title_attribute = (!tutorial.title.empty()) ? " title=\"" + _translate_doc_string(tutorial.title).xml_escape() + "\"" : "";
|
2020-06-07 01:26:35 +00:00
|
|
|
_write_string(f, 2, "<link" + title_attribute + ">" + tutorial.link.xml_escape() + "</link>");
|
2018-06-11 11:35:44 +00:00
|
|
|
}
|
2017-09-12 20:42:36 +00:00
|
|
|
_write_string(f, 1, "</tutorials>");
|
2020-01-26 15:01:49 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<methods>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-06-21 20:20:34 +00:00
|
|
|
c.methods.sort();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.methods.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
const MethodDoc &m = c.methods[i];
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
String qualifiers;
|
2021-05-05 10:44:11 +00:00
|
|
|
if (m.qualifiers != "") {
|
2017-03-05 15:44:50 +00:00
|
|
|
qualifiers += " qualifiers=\"" + m.qualifiers.xml_escape() + "\"";
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "<method name=\"" + m.name + "\"" + qualifiers + ">");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
if (m.return_type != "") {
|
2017-09-02 19:52:45 +00:00
|
|
|
String enum_text;
|
|
|
|
if (m.return_enum != String()) {
|
|
|
|
enum_text = " enum=\"" + m.return_enum + "\"";
|
|
|
|
}
|
2021-07-30 13:28:05 +00:00
|
|
|
_write_string(f, 3, "<return type=\"" + m.return_type + "\"" + enum_text + " />");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int j = 0; j < m.arguments.size(); j++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
const ArgumentDoc &a = m.arguments[j];
|
2017-08-23 22:10:32 +00:00
|
|
|
|
|
|
|
String enum_text;
|
|
|
|
if (a.enumeration != String()) {
|
2017-08-25 18:25:17 +00:00
|
|
|
enum_text = " enum=\"" + a.enumeration + "\"";
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
|
|
|
|
2021-05-05 10:44:11 +00:00
|
|
|
if (a.default_value != "") {
|
2021-07-30 13:28:05 +00:00
|
|
|
_write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " default=\"" + a.default_value.xml_escape(true) + "\" />");
|
2021-05-05 10:44:11 +00:00
|
|
|
} else {
|
2021-07-30 13:28:05 +00:00
|
|
|
_write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\"" + enum_text + " />");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 3, "<description>");
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 4, _translate_doc_string(m.description).strip_edges().xml_escape());
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 3, "</description>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "</method>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</methods>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
if (c.properties.size()) {
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<members>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2016-06-21 20:20:34 +00:00
|
|
|
c.properties.sort();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.properties.size(); i++) {
|
2019-06-01 13:42:22 +00:00
|
|
|
String additional_attributes;
|
2017-08-23 22:10:32 +00:00
|
|
|
if (c.properties[i].enumeration != String()) {
|
2019-06-01 13:42:22 +00:00
|
|
|
additional_attributes += " enum=\"" + c.properties[i].enumeration + "\"";
|
|
|
|
}
|
|
|
|
if (c.properties[i].default_value != String()) {
|
|
|
|
additional_attributes += " default=\"" + c.properties[i].default_value.xml_escape(true) + "\"";
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
2019-09-03 10:42:34 +00:00
|
|
|
|
2018-07-25 01:11:03 +00:00
|
|
|
const PropertyDoc &p = c.properties[i];
|
2019-09-03 10:42:34 +00:00
|
|
|
|
|
|
|
if (c.properties[i].overridden) {
|
2021-12-02 20:15:17 +00:00
|
|
|
_write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\" overrides=\"" + p.overrides + "\"" + additional_attributes + " />");
|
2019-09-03 10:42:34 +00:00
|
|
|
} else {
|
|
|
|
_write_string(f, 2, "<member name=\"" + p.name + "\" type=\"" + p.type + "\" setter=\"" + p.setter + "\" getter=\"" + p.getter + "\"" + additional_attributes + ">");
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 3, _translate_doc_string(p.description).strip_edges().xml_escape());
|
2019-09-03 10:42:34 +00:00
|
|
|
_write_string(f, 2, "</member>");
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</members>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (c.signals.size()) {
|
2016-06-21 20:20:34 +00:00
|
|
|
c.signals.sort();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<signals>");
|
|
|
|
for (int i = 0; i < c.signals.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
const MethodDoc &m = c.signals[i];
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "<signal name=\"" + m.name + "\">");
|
|
|
|
for (int j = 0; j < m.arguments.size(); j++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
const ArgumentDoc &a = m.arguments[j];
|
2021-07-30 13:28:05 +00:00
|
|
|
_write_string(f, 3, "<argument index=\"" + itos(j) + "\" name=\"" + a.name.xml_escape() + "\" type=\"" + a.type.xml_escape() + "\" />");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 3, "<description>");
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 4, _translate_doc_string(m.description).strip_edges().xml_escape());
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 3, "</description>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "</signal>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</signals>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<constants>");
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
for (int i = 0; i < c.constants.size(); i++) {
|
2018-07-25 01:11:03 +00:00
|
|
|
const ConstantDoc &k = c.constants[i];
|
2021-10-10 20:40:32 +00:00
|
|
|
if (k.is_value_valid) {
|
|
|
|
if (k.enumeration != String()) {
|
|
|
|
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\" enum=\"" + k.enumeration + "\">");
|
|
|
|
} else {
|
|
|
|
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"" + k.value + "\">");
|
|
|
|
}
|
2017-11-24 21:43:52 +00:00
|
|
|
} else {
|
2021-10-10 20:40:32 +00:00
|
|
|
if (k.enumeration != String()) {
|
|
|
|
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\" enum=\"" + k.enumeration + "\">");
|
|
|
|
} else {
|
|
|
|
_write_string(f, 2, "<constant name=\"" + k.name + "\" value=\"platform-dependent\">");
|
|
|
|
}
|
2017-08-23 22:10:32 +00:00
|
|
|
}
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 3, _translate_doc_string(k.description).strip_edges().xml_escape());
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "</constant>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</constants>");
|
2014-06-30 01:41:02 +00:00
|
|
|
|
|
|
|
if (c.theme_properties.size()) {
|
2016-06-21 20:20:34 +00:00
|
|
|
c.theme_properties.sort();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "<theme_items>");
|
|
|
|
for (int i = 0; i < c.theme_properties.size(); i++) {
|
2021-08-06 15:07:21 +00:00
|
|
|
const ThemeItemDoc &ti = c.theme_properties[i];
|
2019-06-01 13:42:22 +00:00
|
|
|
|
2021-08-06 15:07:21 +00:00
|
|
|
if (ti.default_value != "") {
|
|
|
|
_write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\" default=\"" + ti.default_value.xml_escape(true) + "\">");
|
2021-05-05 10:44:11 +00:00
|
|
|
} else {
|
2021-08-06 15:07:21 +00:00
|
|
|
_write_string(f, 2, "<theme_item name=\"" + ti.name + "\" data_type=\"" + ti.data_type + "\" type=\"" + ti.type + "\">");
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2019-06-01 13:42:22 +00:00
|
|
|
|
2021-12-16 10:22:44 +00:00
|
|
|
_write_string(f, 3, _translate_doc_string(ti.description).strip_edges().xml_escape());
|
2019-06-01 13:42:22 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 2, "</theme_item>");
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 1, "</theme_items>");
|
2014-06-30 01:41:02 +00:00
|
|
|
}
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
_write_string(f, 0, "</class>");
|
2014-02-10 01:10:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
Error DocData::load_compressed(const uint8_t *p_data, int p_compressed_size, int p_uncompressed_size) {
|
|
|
|
Vector<uint8_t> data;
|
|
|
|
data.resize(p_uncompressed_size);
|
2022-02-18 13:36:13 +00:00
|
|
|
int ret = Compression::decompress(data.ptrw(), p_uncompressed_size, p_data, p_compressed_size, Compression::MODE_DEFLATE);
|
|
|
|
ERR_FAIL_COND_V_MSG(ret == -1, ERR_FILE_CORRUPT, "Compressed file is corrupt.");
|
2014-02-10 01:10:30 +00:00
|
|
|
class_list.clear();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
Ref<XMLParser> parser = memnew(XMLParser);
|
2014-02-16 00:16:33 +00:00
|
|
|
Error err = parser->open_buffer(data);
|
2021-05-05 10:44:11 +00:00
|
|
|
if (err) {
|
2014-02-16 00:16:33 +00:00
|
|
|
return err;
|
2021-05-05 10:44:11 +00:00
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2014-02-16 00:16:33 +00:00
|
|
|
_load(parser);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|