aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/utility/Utilities.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-08-03 00:50:17 +0200
committer GitHub <noreply@github.com>2024-08-03 00:50:17 +0200
commitfde15e554dc9ed458a838683c69d10262764db12 (patch)
tree9e7af8634eafc8461bd02697dd48ae36ca924858 /extension/src/openvic-extension/utility/Utilities.hpp
parent8431914a6971cbacfb20bba13a4113d9ac4d5153 (diff)
parent06b76612b28183f0a047dac3a4127120d2af1b39 (diff)
Merge pull request #249 from OpenVicProject/utf8-fix
Use UTF8 encoding and simplify godot string conversion
Diffstat (limited to 'extension/src/openvic-extension/utility/Utilities.hpp')
-rw-r--r--extension/src/openvic-extension/utility/Utilities.hpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/extension/src/openvic-extension/utility/Utilities.hpp b/extension/src/openvic-extension/utility/Utilities.hpp
index 0cd9edc..49314ca 100644
--- a/extension/src/openvic-extension/utility/Utilities.hpp
+++ b/extension/src/openvic-extension/utility/Utilities.hpp
@@ -14,23 +14,11 @@
namespace OpenVic::Utilities {
_FORCE_INLINE_ std::string godot_to_std_string(godot::String const& str) {
- return str.ascii().get_data();
+ return str.utf8().get_data();
}
- _FORCE_INLINE_ godot::String std_to_godot_string(std::string const& str) {
- return str.c_str();
- }
-
- _FORCE_INLINE_ godot::String std_view_to_godot_string(std::string_view const& str) {
- return std_to_godot_string(static_cast<std::string>(str));
- }
-
- _FORCE_INLINE_ godot::StringName std_to_godot_string_name(std::string const& str) {
- return str.c_str();
- }
-
- _FORCE_INLINE_ godot::StringName std_view_to_godot_string_name(std::string_view const& str) {
- return std_to_godot_string_name(static_cast<std::string>(str));
+ _FORCE_INLINE_ godot::String std_to_godot_string(std::string_view const& str) {
+ return godot::String::utf8(str.data(), str.length());
}
godot::String int_to_string_suffixed(int64_t val);