Date: Thu, 28 Mar 2024 22:13:46 +0000 (UTC) Message-ID: <1733660897.24677.1711664026363@ae5f4610bf64> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_24676_1846356532.1711664026363" ------=_Part_24676_1846356532.1711664026363 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
On this page:
The Slice built-in types are = mapped to C++ types as shown in this table:
Slice |
C++ |
---|---|
bool |
|
byte |
|
short |
|
int |
|
long |
|
float |
|
double |
|
string |
|
Slice bool
and string
map to C++ bool and
std::string
. The remaining built-in Slice types map t=
o C++ type definitions instead of C++ native types. This allows the Ice run=
time to provide a definition as appropriate for each target architecture. =
(For example, Ice::Int
might be defined as long
o=
n one architecture and as int
on another.)
Note that Ice::Byte
is a typedef for unsigned char. This guarantees that byte values are always in the range 0..255.
All the basic types are guaranteed to be distinct C++ types, that is, yo= u can safely overload functions that differ in only the types listed in the= table above.
You can use a metadata directive, ["cpp:type:wstring"]
, to =
map strings to C++ std::wstring
. This is useful for applicatio=
ns that use languages with alphabets that cannot be represented in 8?bit ch=
aracters. The metadata directive can be applied to any Slice construct. For=
containers (such as modules, interfaces, or structures), the metadata dire=
ctive applies to all strings within the container. A corresponding metadata=
directive, ["cpp:type:string"]
, can be used to selectively ov=
erride the mapping defined by the enclosing container. For example:
["cpp:type:wstring"] struct S1 { string x; // Maps to std::wstring ["cpp:type:wstring"] string y; // Maps to std::wstring ["cpp:type:string"] string z; // Maps to std::string }; struct S2 { string x; // Maps to std::string ["cpp:type:string"] string y; // Maps to std::string ["cpp:type:wstring"] string z; // Maps to std::wstring };
With these metadata directives, the strings are mapped as indicated by t= he comments. By default, narrow strings are encoded as UTF?8, and wide stri= ngs use Unicode in an encoding that is appropriate for the platform on whic= h the application executes. You can override the encoding for narrow and wi= de strings by registering a string converter with the Ice run time.