blob: 6c096d2984ffcd839fefb865da83d6c535d885b4 (
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
#pragma once
#if ENABLE_SCRIPTING
#include "Runtime/Scripting/Backend/ScriptingTypes.h"
#include <string>
#if ENABLE_MONO
struct ICallString
{
MonoString* str;
EXPORT_COREMODULE std::string AsUTF8() const;
operator std::string () const { return AsUTF8(); }
int Length();
bool IsNull () {return !str;}
MonoString* GetNativeString() {return str;}
};
#endif
#if UNITY_FLASH
struct ICallString
{
const char* utf8stream;
std::string AsUTF8() const { return utf8stream; }
operator std::string () const { return AsUTF8(); }
int Length() { return strlen(utf8stream); }
bool IsNull () {return !utf8stream;}
const char* GetNativeString() {return utf8stream;}
};
#endif
#if UNITY_WINRT
struct ICallString
{
private:
const wchar_t* str;
//Platform::Object^ str;
ICallString(const ICallString& other){}
ICallString& operator = (const ICallString& rhs)
{
return *this;
}
public:
ICallString(){}
ICallString(const wchar_t* _str)
: str(_str)
{
}
std::string AsUTF8() const;
operator std::string () const { return AsUTF8(); }
int Length();
bool IsNull () {return (str == SCRIPTING_NULL);}
ScriptingStringPtr GetNativeString() {return ref new Platform::String(str);}
};
#endif
/*
//For the next step
struct structwithsomename
{
char buf[256];
char* fallback;
structwithsomename(ICallString& ics)
{
}
~structwithsomename()
{
delete fallback;
}
const char* Get()
{
fastutf8into(buf);
}
const char* operator () { return Get(); }
};*/
#endif
|