summaryrefslogtreecommitdiff
path: root/core/string
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-28 15:47:52 +0200
committerGitHub <noreply@github.com>2021-10-28 15:47:52 +0200
commit6b090e325a49ab9a890700925873f33232d06b2b (patch)
treed728d3603b7a18c7f33885a48cf47da55fd7b3b0 /core/string
parent8508f9396d2a063885798593c0cef18265b4c87a (diff)
parent31012fd060117ff9ebdd3b2bf413f5904d2b9ebe (diff)
Merge pull request #53526 from KoBeWi/super_print
Diffstat (limited to 'core/string')
-rw-r--r--core/string/print_string.cpp6
-rw-r--r--core/string/print_string.h12
2 files changed, 15 insertions, 3 deletions
diff --git a/core/string/print_string.cpp b/core/string/print_string.cpp
index 345371d733..adc218f597 100644
--- a/core/string/print_string.cpp
+++ b/core/string/print_string.cpp
@@ -69,7 +69,7 @@ void remove_print_handler(PrintHandlerList *p_handler) {
ERR_FAIL_COND(l == nullptr);
}
-void print_line(String p_string) {
+void __print_line(String p_string) {
if (!_print_line_enabled) {
return;
}
@@ -108,3 +108,7 @@ void print_verbose(String p_string) {
print_line(p_string);
}
}
+
+String stringify_variants(Variant p_var) {
+ return p_var.operator String();
+}
diff --git a/core/string/print_string.h b/core/string/print_string.h
index 1a9ff1efd6..3cd170b68e 100644
--- a/core/string/print_string.h
+++ b/core/string/print_string.h
@@ -31,7 +31,7 @@
#ifndef PRINT_STRING_H
#define PRINT_STRING_H
-#include "core/string/ustring.h"
+#include "core/variant/variant.h"
extern void (*_print_func)(String);
@@ -46,13 +46,21 @@ struct 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 remove_print_handler(PrintHandlerList *p_handler);
extern bool _print_line_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_verbose(String p_string);
+#define print_line(...) __print_line(stringify_variants(__VA_ARGS__))
#endif // PRINT_STRING_H