Arcane
v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
ISO88591Transcoder.cc
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
//-----------------------------------------------------------------------------
3
// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4
// See the top-level COPYRIGHT file for details.
5
// SPDX-License-Identifier: Apache-2.0
6
//-----------------------------------------------------------------------------
7
/*---------------------------------------------------------------------------*/
8
/* ISO88591Transcoder.cc (C) 2000-2007 */
9
/* */
10
/* Convertisseur ISO-8859-1 depuis/vers UTF-16. */
11
/*---------------------------------------------------------------------------*/
12
/*---------------------------------------------------------------------------*/
13
14
#include "arcane/utils/ArcanePrecomp.h"
15
16
#include "arcane/utils/ISO88591Transcoder.h"
17
#include "arcane/utils/Iostream.h"
18
19
/*---------------------------------------------------------------------------*/
20
/*---------------------------------------------------------------------------*/
21
22
/*---------------------------------------------------------------------------*/
23
/*---------------------------------------------------------------------------*/
24
25
ARCANE_BEGIN_NAMESPACE
26
27
/*---------------------------------------------------------------------------*/
28
/*---------------------------------------------------------------------------*/
29
30
ISO88591Transcoder::
31
~ISO88591Transcoder()
32
{
33
}
34
35
/*---------------------------------------------------------------------------*/
36
/*---------------------------------------------------------------------------*/
37
38
void
ISO88591Transcoder::
39
build()
40
{
41
}
42
43
/*---------------------------------------------------------------------------*/
44
/*---------------------------------------------------------------------------*/
45
46
void
ISO88591Transcoder::
47
transcodeToUtf16(
const
Byte
* src,Integer
src_len
,
UChar
* out)
48
{
49
const
Byte
*
src_current
= src;
50
const
Byte
*
src_end
= src +
src_len
;
51
while
(
src_current
<
src_end
)
52
*out++ = *
src_current
++;
53
}
54
55
/*---------------------------------------------------------------------------*/
56
/*---------------------------------------------------------------------------*/
57
58
void
ISO88591Transcoder::
59
transcodeFromUtf16(
const
UChar
* src,Integer
src_len
,
Byte
* out)
60
{
61
const
UChar
*
src_current
= src;
62
const
UChar
*
src_end
= src +
src_len
;
63
bool
has_error
=
false
;
64
while
(
src_current
<
src_end
){
65
if
(*
src_current
< 256){
66
*out++ =
Byte
(*
src_current
);
67
}
68
else
{
69
// Conversion impossible. Remplace par un caractère blanc
70
has_error
=
true
;
71
*out++ = 0x1A;
72
}
73
++
src_current
;
74
}
75
if
(
has_error
){
76
cerr <<
"ARCANE: Bad transcoding from UTF16 to ISO88591\n"
;
77
}
78
}
79
80
/*---------------------------------------------------------------------------*/
81
/*---------------------------------------------------------------------------*/
82
83
ARCANE_END_NAMESPACE
84
85
/*---------------------------------------------------------------------------*/
86
/*---------------------------------------------------------------------------*/
87
Arcane::LimaWrapper
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition
Lima.cc:120
arcane
utils
ISO88591Transcoder.cc
Généré le Lundi 18 Novembre 2024 03:02:07 pour Arcane par
1.9.8