summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/ICallString.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Scripting/ICallString.cpp')
-rw-r--r--Runtime/Scripting/ICallString.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/Runtime/Scripting/ICallString.cpp b/Runtime/Scripting/ICallString.cpp
new file mode 100644
index 0000000..ad1cceb
--- /dev/null
+++ b/Runtime/Scripting/ICallString.cpp
@@ -0,0 +1,40 @@
+#include "UnityPrefix.h"
+
+#if ENABLE_SCRIPTING
+
+#if !UNITY_FLASH
+#include "ICallString.h"
+#include "Runtime/Scripting/Backend/ScriptingBackendApi.h"
+
+
+#if ENABLE_MONO
+std::string ICallString::AsUTF8() const
+{
+ return scripting_cpp_string_for(str).c_str();
+}
+#elif UNITY_WINRT
+#include "PlatformDependent/MetroPlayer/MetroUtils.h"
+std::string ICallString::AsUTF8() const
+{
+ return ConvertStringToUtf8(str);
+}
+#endif
+
+#if ENABLE_MONO
+// todo: remove this useless include once we figure out where to take mono_string_length from.
+#include "Runtime/Scripting/ScriptingUtility.h"
+#endif
+
+int ICallString::Length()
+{
+#if ENABLE_MONO
+ return mono_string_length(str);
+#elif UNITY_WINRT
+ return wcslen(str);
+ //return safe_cast<Platform::String^>(str)->Length();
+#endif
+}
+#endif
+
+#endif
+