summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authordanielytics <danielytics@users.noreply.github.com>2018-03-07 12:21:33 +0000
committerdanielytics <danielytics@users.noreply.github.com>2018-03-07 12:21:33 +0000
commite74b8f593ecd412ee410f538ac88aa8b91d24b33 (patch)
treef3f742e19f7a9f9878383d85f7b16ac661de92e9 /include
parent779568c67c18ab190ba1950c517c279b7d12bf7a (diff)
downloadredot-cpp-e74b8f593ecd412ee410f538ac88aa8b91d24b33.tar.gz
adds variadic printing function, makes String.format custom placeholder work
Diffstat (limited to 'include')
-rw-r--r--include/core/GodotGlobal.hpp6
-rw-r--r--include/core/String.hpp2
2 files changed, 8 insertions, 0 deletions
diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp
index 7d28dba..a913359 100644
--- a/include/core/GodotGlobal.hpp
+++ b/include/core/GodotGlobal.hpp
@@ -3,6 +3,7 @@
#include <gdnative_api_struct.gen.h>
#include "String.hpp"
+#include "Array.hpp"
namespace godot {
@@ -20,6 +21,11 @@ public:
static void gdnative_init(godot_gdnative_init_options *o);
static void gdnative_terminate(godot_gdnative_terminate_options *o);
static void nativescript_init(void *handle);
+
+ template <class... Args>
+ static void print(const String& fmt, Args... values) {
+ print(fmt.format(Array::make(values...)));
+ }
};
diff --git a/include/core/String.hpp b/include/core/String.hpp
index de65f3c..7826fcb 100644
--- a/include/core/String.hpp
+++ b/include/core/String.hpp
@@ -81,6 +81,7 @@ public:
int find(String what, int from = 0) const;
int find_last(String what) const;
int findn(String what, int from = 0) const;
+ String format(Variant values) const;
String format(Variant values, String placeholder) const;
String get_base_dir() const;
String get_basename() const;
@@ -128,6 +129,7 @@ public:
String to_upper() const;
String xml_escape() const;
String xml_unescape() const;
+
};
String operator+(const char *a, const String &b);