summaryrefslogtreecommitdiffstats
path: root/include/core/Array.hpp
diff options
context:
space:
mode:
authorDaniel Rakos <daniel.rakos@rastergrid.com>2019-05-15 12:07:46 +0200
committerDaniel Rakos <daniel.rakos@rastergrid.com>2019-05-15 14:45:09 +0200
commitbb4a837ad36fcd6917b1ca87d909738a2f4075fe (patch)
tree065a4f02e4b1f7b3ca8c98e1807514188b827199 /include/core/Array.hpp
parent04548011e38a74fda5640ba7ec02ff74caae43f8 (diff)
downloadredot-cpp-bb4a837ad36fcd6917b1ca87d909738a2f4075fe.tar.gz
Error message improvements
Changed error message macros to actually use Godot's error reporting facilities instead of outputting straight to stderr. This enables GDNative errors to actually show up inside the editor. Messages and set of available macros now also better matches that of the engine itself.
Diffstat (limited to 'include/core/Array.hpp')
-rw-r--r--include/core/Array.hpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/include/core/Array.hpp b/include/core/Array.hpp
index 988d4c7..1261f74 100644
--- a/include/core/Array.hpp
+++ b/include/core/Array.hpp
@@ -3,11 +3,46 @@
#include <gdnative/array.h>
-#include "Defs.hpp"
#include "String.hpp"
namespace godot {
+namespace helpers {
+template <typename T, typename ValueT>
+T append_all(T appendable, ValueT value) {
+ appendable.append(value);
+ return appendable;
+}
+
+template <typename T, typename ValueT, typename... Args>
+T append_all(T appendable, ValueT value, Args... args) {
+ appendable.append(value);
+ return append_all(appendable, args...);
+}
+
+template <typename T>
+T append_all(T appendable) {
+ return appendable;
+}
+
+template <typename KV, typename KeyT, typename ValueT>
+KV add_all(KV kv, KeyT key, ValueT value) {
+ kv[key] = value;
+ return kv;
+}
+
+template <typename KV, typename KeyT, typename ValueT, typename... Args>
+KV add_all(KV kv, KeyT key, ValueT value, Args... args) {
+ kv[key] = value;
+ return add_all(kv, args...);
+}
+
+template <typename KV>
+KV add_all(KV kv) {
+ return kv;
+}
+} // namespace helpers
+
class Variant;
class PoolByteArray;
class PoolIntArray;