You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Merge pull request #53526 from KoBeWi/super_print
This commit is contained in:
@@ -69,7 +69,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
|
|||||||
ERR_FAIL_COND(l == nullptr);
|
ERR_FAIL_COND(l == nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_line(String p_string) {
|
void __print_line(String p_string) {
|
||||||
if (!_print_line_enabled) {
|
if (!_print_line_enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,3 +108,7 @@ void print_verbose(String p_string) {
|
|||||||
print_line(p_string);
|
print_line(p_string);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String stringify_variants(Variant p_var) {
|
||||||
|
return p_var.operator String();
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
#ifndef PRINT_STRING_H
|
#ifndef PRINT_STRING_H
|
||||||
#define PRINT_STRING_H
|
#define PRINT_STRING_H
|
||||||
|
|
||||||
#include "core/string/ustring.h"
|
#include "core/variant/variant.h"
|
||||||
|
|
||||||
extern void (*_print_func)(String);
|
extern void (*_print_func)(String);
|
||||||
|
|
||||||
@@ -46,13 +46,21 @@ struct PrintHandlerList {
|
|||||||
PrintHandlerList() {}
|
PrintHandlerList() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
String stringify_variants(Variant p_var);
|
||||||
|
|
||||||
|
template <typename... Args>
|
||||||
|
String stringify_variants(Variant p_var, Args... p_args) {
|
||||||
|
return p_var.operator String() + " " + stringify_variants(p_args...);
|
||||||
|
}
|
||||||
|
|
||||||
void add_print_handler(PrintHandlerList *p_handler);
|
void add_print_handler(PrintHandlerList *p_handler);
|
||||||
void remove_print_handler(PrintHandlerList *p_handler);
|
void remove_print_handler(PrintHandlerList *p_handler);
|
||||||
|
|
||||||
extern bool _print_line_enabled;
|
extern bool _print_line_enabled;
|
||||||
extern bool _print_error_enabled;
|
extern bool _print_error_enabled;
|
||||||
extern void print_line(String p_string);
|
extern void __print_line(String p_string);
|
||||||
extern void print_error(String p_string);
|
extern void print_error(String p_string);
|
||||||
extern void print_verbose(String p_string);
|
extern void print_verbose(String p_string);
|
||||||
|
#define print_line(...) __print_line(stringify_variants(__VA_ARGS__))
|
||||||
|
|
||||||
#endif // PRINT_STRING_H
|
#endif // PRINT_STRING_H
|
||||||
|
|||||||
@@ -4533,7 +4533,7 @@ void GDScriptParser::TreePrinter::print_tree(const GDScriptParser &p_parser) {
|
|||||||
}
|
}
|
||||||
print_class(p_parser.get_tree());
|
print_class(p_parser.get_tree());
|
||||||
|
|
||||||
print_line(printed);
|
print_line(String(printed));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DEBUG_ENABLED
|
#endif // DEBUG_ENABLED
|
||||||
|
|||||||
Reference in New Issue
Block a user