14#include "arccore/base/CoreArray.h"
15#include "arccore/base/BasicTranscoder.h"
17#ifdef ARCCORE_HAS_GLIB
34#ifdef ARCCORE_HAS_GLIB
37 return std::iswspace(
wc);
42#ifdef ARCCORE_HAS_GLIB
45 return std::towupper(
wc);
50#ifdef ARCCORE_HAS_GLIB
53 return std::towlower(
wc);
59 std::cout <<
"WARNING: Invalid sequence '" <<
wc <<
"' in conversion input (position=" <<
pos <<
")\n";
66 std::cout <<
"WARNING: Invalid sequence '" <<
wc <<
"' in conversion input (unexpected eof)\n";
92 else if (
wc < 0x10000)
94 else if (
wc < 0x200000)
96 else if (
wc < 0x4000000)
102 r[5] = 0x80 | (
wc & 0x3f);
107 r[4] = 0x80 | (
wc & 0x3f);
112 r[3] = 0x80 | (
wc & 0x3f);
117 r[2] = 0x80 | (
wc & 0x3f);
122 r[1] = 0x80 | (
wc & 0x3f);
129 for (
int i = 0; i < count; ++i)
130 utf8.add((
Byte)
r[i]);
149 unsigned char c = s[0];
162 if (!((s[1] ^ 0x80) < 0x40))
171 if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (
c >= 0xe1 || s[1] >= 0xa0)))
180 if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (
c >= 0xf1 || s[1] >= 0x90)))
182 wc = ((
Int32)(
c & 0x07) << 18) | ((
Int32)(s[1] ^ 0x80) << 12) | ((
Int32)(s[2] ^ 0x80) << 6) | (
Int32)(s[3] ^ 0x80);
193 if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 && (
c >= 0xf9 || s[1] >= 0x88)))
195 wc = ((
Int32)(
c & 0x03) << 24) | ((
Int32)(s[1] ^ 0x80) << 18) | ((
Int32)(s[2] ^ 0x80) << 12) | ((
Int32)(s[3] ^ 0x80) << 6) | (
Int32)(s[4] ^ 0x80);
201 if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 && (s[5] ^ 0x80) < 0x40 && (
c >= 0xfd || s[1] >= 0x84)))
203 wc = ((
Int32)(
c & 0x01) << 30) | ((
Int32)(s[1] ^ 0x80) << 24) | ((
Int32)(s[2] ^ 0x80) << 18) | ((
Int32)(s[3] ^ 0x80) << 12) | ((
Int32)(s[4] ^ 0x80) << 6) | (
Int32)(s[5] ^ 0x80);
226 if (
wc >= 0xd800 &&
wc < 0xdc00) {
227 if ((index + 1) ==
uchar.size()) {
228 std::cout <<
"WARNING: utf16_to_ucs4(): Invalid sequence in conversion input (unexpected eof)\n";
233 if (!(
wc2 >= 0xdc00 &&
wc2 < 0xe000)) {
234 std::cout <<
"WARNING: utf16_to_ucs4(): Invalid sequence (1) '" <<
wc2 <<
"' in conversion input\n";
238 wc = (0x10000 + ((
wc - 0xd800) << 10) + (
wc2 - 0xdc00));
241 else if (
wc >= 0xdc00 &&
wc < 0xe0000) {
242 std::cout <<
"WARNING: utf16_to_ucs4(): Invalid sequence (2) '" <<
wc <<
"' in conversion input\n";
275 std::cout <<
"WARNING: ucs4_to_utf16(): Invalid sequence in conversion input\n";
288 std::cerr <<
"WARNING: ucs4_to_utf16(): Invalid sequence in conversion input\n";
298Int64 BasicTranscoder::
316 for(
Int64 i=0,
n=utf16.size(); i<
n; ){
326void BasicTranscoder::
329 for(
Int64 i=0,
n=utf8.size(); i<
n; ){
332 ucs4_to_utf16(
wc,utf16);
339void BasicTranscoder::
345 for (
Int64 i = 0,
n = utf8.size(); i <
n;) {
358void BasicTranscoder::
403void BasicTranscoder::
409 for (
Int64 i = 0,
n = utf8.size(); i <
n;) {
420void BasicTranscoder::
426 for (
Int64 i = 0,
n = utf8.size(); i <
n;) {
437void BasicTranscoder::
442 for(
Int64 i=0,
n=utf8.size(); i<
n; ){
static void transcodeFromUtf16ToUtf8(Span< const UChar > utf16, CoreArray< Byte > &utf8)
Traduit depuis UTF16 vers UTF8.
Référence à une instance.
Espace de nom de Arccore.
constexpr __host__ __device__ Int64 arccoreCheckLargeArraySize(size_t size)
Vérifie que size peut être converti dans un 'Int64' pour servir de taille à un tableau.
std::int64_t Int64
Type entier signé sur 64 bits.
std::int32_t Int32
Type entier signé sur 32 bits.