aboutsummaryrefslogtreecommitdiff
path: root/extension/src/Utilities.hpp
diff options
context:
space:
mode:
author Hop311 <hop3114@gmail.com>2023-05-22 14:57:00 +0200
committer Hop311 <hop3114@gmail.com>2023-05-22 14:57:00 +0200
commitbd9b0206bcfc8848c865055a933d1e207521ac8e (patch)
tree3636f015f1fa3fe397778c240293d6c27ca41562 /extension/src/Utilities.hpp
parent30fa7d74ddcfd4e64a5526995a392f7b51feb869 (diff)
GD/std string cleanup + separate data loading cpp
Diffstat (limited to 'extension/src/Utilities.hpp')
-rw-r--r--extension/src/Utilities.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/extension/src/Utilities.hpp b/extension/src/Utilities.hpp
new file mode 100644
index 0000000..16193e8
--- /dev/null
+++ b/extension/src/Utilities.hpp
@@ -0,0 +1,22 @@
+#pragma once
+
+#include <godot_cpp/variant/string.hpp>
+
+#include "openvic/Types.hpp"
+
+#define ERR(x) ((x) == SUCCESS ? OK : FAILED)
+
+namespace OpenVic {
+
+ inline char const* godot_to_c_string(godot::String const& str) {
+ return str.ascii().get_data();
+ }
+
+ inline std::string godot_to_std_string(godot::String const& str) {
+ return godot_to_c_string(str);
+ }
+
+ inline godot::String std_to_godot_string(std::string const& str) {
+ return str.c_str();
+ }
+}