summaryrefslogtreecommitdiff
path: root/Runtime/Scripting/ICallString.cpp
blob: ad1ccebee07088b5e11f59332f0d9a48f2e6eb48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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