Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sal / textenc / tables.cxx
blob163ffe131de45a4451297b4254fb9c113e7a7e39
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <config_locales.h>
22 #include <sal/config.h>
24 #include <cassert>
25 #include <cstddef>
26 #include <iterator>
28 #include <rtl/textenc.h>
29 #include <sal/types.h>
31 #define NOTABUNI_START 0xFF
32 #define NOTABUNI_END 0x00
34 #define NOTABCHAR_START 0xFFFF
35 #define NOTABCHAR_END 0x0000
37 #define SAME8090UNI_START 0x80
38 #define SAME8090UNI_END 0x9F
39 sal_uInt16 const aImpl8090SameToUniTab[SAME8090UNI_END
40 - SAME8090UNI_START
41 + 1]
42 = { 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, /* 0x80 */
43 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F,
44 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, /* 0x90 */
45 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F };
47 #define SAME8090CHAR_START 0x0080
48 #define SAME8090CHAR_END 0x009F
49 unsigned char const aImpl8090SameToCharTab[SAME8090CHAR_END
50 - SAME8090CHAR_START
51 + 1]
52 = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, /* 0x0080 */
53 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F,
54 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, /* 0x0090 */
55 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F };
57 sal_uInt16 const aImplDoubleByteIdentifierTab[1] = { 0 };
59 #include "tcvtarb1.tab"
60 #include "tcvteas1.tab"
61 #include "tcvtest1.tab"
62 #include "tcvtjp1.tab"
63 #include "tcvtjp2.tab"
64 #include "tcvtjp3.tab"
65 #include "tcvtjp4.tab"
66 #include "tcvtjp5.tab"
67 #include "tcvtjp6.tab"
68 #include "tcvtkr1.tab"
69 #include "tcvtkr2.tab"
70 #include "tcvtkr4.tab"
71 #include "tcvtkr5.tab"
72 #include "tcvtkr6.tab"
73 #include "tcvtlat1.tab"
74 #include "tcvtscn1.tab"
75 #include "tcvtscn2.tab"
76 #include "tcvtscn3.tab"
77 #include "tcvtscn4.tab"
78 #include "tcvtscn5.tab"
79 #include "tcvtscn6.tab"
80 #include "tcvtsym1.tab"
81 #include "tcvttcn1.tab"
82 #include "tcvttcn2.tab"
83 #include "tcvttcn6.tab"
84 #include "tcvtuni1.tab"
86 #include "convertadobe.tab"
87 #include "convertbig5hkscs.tab"
88 #include "converteuctw.tab"
89 #include "convertgb18030.tab"
90 #include "convertisciidevangari.tab"
91 #include "convertiso2022cn.tab"
92 #include "convertiso2022jp.tab"
93 #include "convertiso2022kr.tab"
95 extern "C" SAL_DLLPUBLIC_EXPORT ImplTextEncodingData const *
96 sal_getFullTextEncodingData( rtl_TextEncoding nEncoding )
98 assert(
99 nEncoding != RTL_TEXTENCODING_ASCII_US &&
100 nEncoding != RTL_TEXTENCODING_ISO_8859_1 &&
101 nEncoding != RTL_TEXTENCODING_JAVA_UTF8 &&
102 nEncoding != RTL_TEXTENCODING_MS_1252 &&
103 nEncoding != RTL_TEXTENCODING_UTF8);
104 // handled by Impl_getTextEncodingData
105 static ImplTextEncodingData const * const aData[]
106 = { nullptr, /* DONTKNOW */
107 nullptr, /* MS_1252, see above */
108 &aImplAPPLEROMANTextEncodingData, /* APPLE_ROMAN */
109 &aImplIBM437TextEncodingData, /* IBM_437 */
110 &aImplIBM850TextEncodingData, /* IBM_850 */
111 &aImplIBM860TextEncodingData, /* IBM_860 */
112 &aImplIBM861TextEncodingData, /* IBM_861 */
113 &aImplIBM863TextEncodingData, /* IBM_863 */
114 &aImplIBM865TextEncodingData, /* IBM_865 */
115 nullptr, /* reserved (SYSTEM) */
116 &aImplSYMBOLTextEncodingData, /* SYMBOL */
117 nullptr, /* ASCII_US, see above */
118 nullptr, /* ISO_8859_1, see above */
119 &aImplISO88592TextEncodingData, /* ISO_8859_2 */
120 &aImplISO88593TextEncodingData, /* ISO_8859_3 */
121 &aImplISO88594TextEncodingData, /* ISO_8859_4 */
122 &aImplISO88595TextEncodingData, /* ISO_8859_5 */
123 &aImplISO88596TextEncodingData, /* ISO_8859_6 */
124 &aImplISO88597TextEncodingData, /* ISO_8859_7 */
125 &aImplISO88598TextEncodingData, /* ISO_8859_8 */
126 &aImplISO88599TextEncodingData, /* ISO_8859_9 */
127 &aImplISO885914TextEncodingData, /* ISO_8859_14 */
128 &aImplISO885915TextEncodingData, /* ISO_8859_15 */
129 &aImplIBM737TextEncodingData, /* IBM_737 */
130 &aImplIBM775TextEncodingData, /* IBM_775 */
131 &aImplIBM852TextEncodingData, /* IBM_852 */
132 &aImplIBM855TextEncodingData, /* IBM_855 */
133 &aImplIBM857TextEncodingData, /* IBM_857 */
134 &aImplIBM862TextEncodingData, /* IBM_862 */
135 &aImplIBM864TextEncodingData, /* IBM_864 */
136 &aImplIBM866TextEncodingData, /* IBM_866 */
137 &aImplIBM869TextEncodingData, /* IBM_869 */
138 &aImplMS874TextEncodingData, /* MS_874 */
139 &aImplMS1250TextEncodingData, /* MS_1250 */
140 &aImplMS1251TextEncodingData, /* MS_1251 */
141 &aImplMS1253TextEncodingData, /* MS_1253 */
142 &aImplMS1254TextEncodingData, /* MS_1254 */
143 &aImplMS1255TextEncodingData, /* MS_1255 */
144 &aImplMS1256TextEncodingData, /* MS_1256 */
145 &aImplMS1257TextEncodingData, /* MS_1257 */
146 &aImplMS1258TextEncodingData, /* MS_1258 */
147 nullptr, /* TODO! APPLE_ARABIC */
148 &aImplAPPLECENTEUROTextEncodingData, /* APPLE_CENTEURO */
149 &aImplAPPLECROATIANTextEncodingData, /* APPLE_CROATIAN */
150 &aImplAPPLECYRILLICTextEncodingData, /* APPLE_CYRILLIC */
151 nullptr, /* TODO! APPLE_DEVANAGARI */
152 nullptr, /* TODO! APPLE_FARSI */
153 &aImplAPPLEGREEKTextEncodingData, /* APPLE_GREEK */
154 nullptr, /* TODO! APPLE_GUJARATI */
155 nullptr, /* TODO! APPLE_GURMUKHI */
156 nullptr, /* TODO! APPLE_HEBREW */
157 &aImplAPPLEICELANDTextEncodingData, /* APPLE_ICELAND */
158 &aImplAPPLEROMANIANTextEncodingData, /* APPLE_ROMANIAN */
159 nullptr, /* TODO! APPLE_THAI */
160 &aImplAPPLETURKISHTextEncodingData, /* APPLE_TURKISH */
161 &aImplAPPLEUKRAINIANTextEncodingData, /* APPLE_UKRAINIAN */
162 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
163 &aImplAPPLECHINSIMPTextEncodingData, /* APPLE_CHINSIMP */
164 &aImplAPPLECHINTRADTextEncodingData, /* APPLE_CHINTRAD */
165 #else
166 NULL,
167 NULL,
168 #endif
169 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
170 &aImplAPPLEJAPANESETextEncodingData, /* APPLE_JAPANESE */
171 #else
172 NULL,
173 #endif
174 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
175 &aImplAPPLEKOREANTextEncodingData, /* APPLE_KOREAN */
176 #else
177 NULL,
178 #endif
179 &aImplMS932TextEncodingData, /* MS_932 */
180 &aImplMS936TextEncodingData, /* MS_936 */
181 &aImplMS949TextEncodingData, /* MS_949 */
182 &aImplMS950TextEncodingData, /* MS_950 */
183 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
184 &aImplSJISTextEncodingData, /* SHIFT_JIS */
185 #else
186 NULL,
187 #endif
188 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
189 &aImplGB2312TextEncodingData, /* GB_2312 */
190 &aImplGBT12345TextEncodingData, /* GBT_12345 */
191 &aImplGBKTextEncodingData, /* GBK */
192 &aImplBIG5TextEncodingData, /* BIG5 */
193 #else
194 NULL,
195 NULL,
196 NULL,
197 NULL,
198 #endif
199 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
200 &aImplEUCJPTextEncodingData, /* EUC_JP */
201 #else
202 NULL,
203 #endif
204 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
205 &aImplEUCCNTextEncodingData, /* EUC_CN */
206 &aImplEucTwTextEncodingData, /* EUC_TW */
207 #else
208 NULL,
209 NULL,
210 #endif
211 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
212 &aImplIso2022JpTextEncodingData, /* ISO_2022_JP */
213 #else
214 NULL,
215 #endif
216 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
217 &aImplIso2022CnTextEncodingData, /* ISO_2022_CN */
218 #else
219 NULL,
220 #endif
221 &aImplKOI8RTextEncodingData, /* KOI8_R */
222 &aImplUTF7TextEncodingData, /* UTF7 */
223 nullptr, /* UTF8, see above */
224 &aImplISO885910TextEncodingData, /* ISO_8859_10 */
225 &aImplISO885913TextEncodingData, /* ISO_8859_13 */
226 #if WITH_LOCALE_ALL || WITH_LOCALE_ko
227 &aImplEUCKRTextEncodingData, /* EUC_KR */
228 &aImplIso2022KrTextEncodingData, /* ISO_2022_KR */
229 #else
230 NULL,
231 NULL,
232 #endif
233 #if WITH_LOCALE_ALL || WITH_LOCALE_ja
234 &aImplJISX0201TextEncodingData, /* JIS_X_0201 */
235 &aImplJISX0208TextEncodingData, /* JIS_X_0208 */
236 &aImplJISX0212TextEncodingData, /* JIS_X_0212 */
237 #else
238 NULL,
239 NULL,
240 NULL,
241 #endif
242 &aImplMS1361TextEncodingData, /* MS_1361 */
243 #if WITH_LOCALE_ALL || WITH_LOCALE_zh
244 &aImplGb18030TextEncodingData, /* GB_18030 */
245 &aImplBig5HkscsTextEncodingData, /* BIG5_HKSCS */
246 #else
247 NULL,
248 NULL,
249 #endif
250 &aImplTis620TextEncodingData, /* TIS_620 */
251 &aImplKoi8UTextEncodingData, /* KOI8_U */
252 #if WITH_LOCALE_ALL || WITH_LOCALE_FOR_SCRIPT_Deva
253 &aImplIsciiDevanagariTextEncodingData, /* ISCII_DEVANAGARI */
254 #else
255 NULL,
256 #endif
257 nullptr, /* JAVA_UTF8, see above */
258 &adobeStandardEncodingData, /* ADOBE_STANDARD */
259 &adobeSymbolEncodingData, /* ADOBE_SYMBOL */
260 &aImplPT154TextEncodingData, /* PT154 */
261 &adobeDingbatsEncodingData, /* ADOBE_DINGBATS */
262 &kamenickyEncodingData, /* KAMENICKY */
263 &mazoviaEncodingData }; /* MAZOVIA */
265 static_assert(
266 SAL_N_ELEMENTS(aData) == RTL_TEXTENCODING_MAZOVIA + 1,
267 "update table above if a new encoding is added");
269 return
270 nEncoding < SAL_N_ELEMENTS(aData) ? aData[nEncoding] : nullptr;
273 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */