-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_type_mapping.txt
36 lines (25 loc) · 1.17 KB
/
data_type_mapping.txt
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
From c++ to Actionscript
bool Boolean ByteArray.readBoolean
uint8_t uint ByteArray.readUnsignedByte
uint16_t uint ByteArray.readUnsignedShort
uint32_t uint ByteArray.readUnsignedInt
uint64_t Number ByteArray.readDouble pending
int8_t int ByteArray.readByte
int16_t int ByteArray.readShort
int32_t int ByteArray.readInt
int64_t Number ByteArray.readDouble pending
float Number ByteArray.readFloat
double Number ByteArray.readDouble
std::string String ByteArray.readUTFBytes
std::vector Vector
std::list Vector
std::set Vector
std::map Object
How transfer the string between C++ server and Actionscript client correctly?
On server side, we set the locale of the C++ server and it's host operating system
to zh_CN.UTF-8, then all multi-byte string are encoded in UTF-8. We don't use
wchar_t in Linux, because it occupies four bytes, it's wasteful. In this way, a C++
string is marshaled as a UTF-8 byte array, then the byte array was sent to client.
On client side, the String was written as an UTF-8 bytes to a byte stream.
So, the server and client side both receive and send UTF-8 byte stream when
transforming string. It's very consistent and works fine indeed.