summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-11-10 14:13:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2020-11-10 15:00:07 +0100
commit34cad0d020c58d87245befe10ad816fa73432437 (patch)
treeb32f9d2b3a85a3501586d43fc539462e2e3f746e /editor
parent0efe6dff5f1f973393fcd453d38336f83542786f (diff)
doc: Fixups to #43419 which added operators in the docs
- Escape the method names as e.g. `operator <` is invalid XML. - Add a hack to merge all String % operator definitions for each Variant type as a single one with `Variant` argument type. - Add support for the new qualifiers in makerst.py. - Drop unused `doc_merge.py`, seems to date back to when we had all the documentation in a single `classes.xml`.
Diffstat (limited to 'editor')
-rw-r--r--editor/doc_data.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/editor/doc_data.cpp b/editor/doc_data.cpp
index 6767159721..ae31f68587 100644
--- a/editor/doc_data.cpp
+++ b/editor/doc_data.cpp
@@ -569,12 +569,15 @@ void DocData::generate(bool p_basic_types) {
method_list.sort();
Variant::get_constructor_list(Variant::Type(i), &method_list);
- for (int j = 0; j < Variant::OP_AND; j++) { //showing above 'and' is pretty confusing and there are a lot of variations
-
+ for (int j = 0; j < Variant::OP_AND; j++) { // Showing above 'and' is pretty confusing and there are a lot of variations.
for (int k = 0; k < Variant::VARIANT_MAX; k++) {
Variant::Type rt = Variant::get_operator_return_type(Variant::Operator(j), Variant::Type(i), Variant::Type(k));
- if (rt != Variant::NIL) {
- //has operator
+ if (rt != Variant::NIL) { // Has operator.
+ // Skip String % operator as it's registered separately for each Variant arg type,
+ // we'll add it manually below.
+ if (i == Variant::STRING && Variant::Operator(j) == Variant::OP_MODULE) {
+ continue;
+ }
MethodInfo mi;
mi.name = "operator " + Variant::get_operator_name(Variant::Operator(j));
mi.return_val.type = rt;
@@ -589,6 +592,21 @@ void DocData::generate(bool p_basic_types) {
}
}
+ if (i == Variant::STRING) {
+ // We skipped % operator above, and we register it manually once for Variant arg type here.
+ MethodInfo mi;
+ mi.name = "operator %";
+ mi.return_val.type = Variant::STRING;
+
+ PropertyInfo arg;
+ arg.name = "right";
+ arg.type = Variant::NIL;
+ arg.usage = PROPERTY_USAGE_NIL_IS_VARIANT;
+ mi.arguments.push_back(arg);
+
+ method_list.push_back(mi);
+ }
+
if (Variant::is_keyed(Variant::Type(i))) {
MethodInfo mi;
mi.name = "operator []";
@@ -1147,7 +1165,7 @@ Error DocData::save_classes(const String &p_default_path, const Map<String, Stri
qualifiers += " qualifiers=\"" + m.qualifiers.xml_escape() + "\"";
}
- _write_string(f, 2, "<method name=\"" + m.name + "\"" + qualifiers + ">");
+ _write_string(f, 2, "<method name=\"" + m.name.xml_escape() + "\"" + qualifiers + ">");
if (m.return_type != "") {
String enum_text;