LibreOffice Module i18npool (master)  1
numberchar.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H
21 #define INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H
22 
23 namespace i18npool {
24 
25 const sal_Int16 NumberChar_HalfWidth = 0;
26 const sal_Int16 NumberChar_FullWidth = 1;
27 const sal_Int16 NumberChar_Lower_zh = 2;
28 const sal_Int16 NumberChar_Upper_zh = 3;
29 const sal_Int16 NumberChar_Upper_zh_TW = 4;
30 const sal_Int16 NumberChar_Modern_ja = 5;
31 const sal_Int16 NumberChar_Traditional_ja= 6;
32 const sal_Int16 NumberChar_Lower_ko = 7;
33 const sal_Int16 NumberChar_Upper_ko = 8;
34 const sal_Int16 NumberChar_Hangul_ko = 9;
35 const sal_Int16 NumberChar_Indic_ar = 10;
36 const sal_Int16 NumberChar_EastIndic_ar = 11;
37 const sal_Int16 NumberChar_hi = 12;
38 const sal_Int16 NumberChar_th = 13;
39 const sal_Int16 NumberChar_or = 14;
40 const sal_Int16 NumberChar_mr = 15;
41 const sal_Int16 NumberChar_bn = 16;
42 const sal_Int16 NumberChar_pa = 17;
43 const sal_Int16 NumberChar_gu = 18;
44 const sal_Int16 NumberChar_ta = 19;
45 const sal_Int16 NumberChar_te = 20;
46 const sal_Int16 NumberChar_kn = 21;
47 const sal_Int16 NumberChar_ml = 22;
48 const sal_Int16 NumberChar_lo = 23;
49 const sal_Int16 NumberChar_bo = 24;
50 const sal_Int16 NumberChar_my = 25;
51 const sal_Int16 NumberChar_km = 26;
52 const sal_Int16 NumberChar_mn = 27;
53 const sal_Int16 NumberChar_he = 28;
54 const sal_Int16 NumberChar_ne = 29;
55 const sal_Int16 NumberChar_dz = 30;
56 const sal_Int16 NumberChar_cu = 31;
57 const sal_Int16 NumberChar_Count = 32;
58 
59 const sal_Unicode NumberChar[][10] = {
60 // 0 1 2 3 4 5 6 7 8 9
61  { 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039 }, // Half Width (Ascii)
62  { 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 0xFF18, 0xFF19 }, // Full Width
63  { 0x3007, 0x4E00, 0x4E8c, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Chinese Lower
64  { 0x96F6, 0x58F9, 0x8D30, 0x53C1, 0x8086, 0x4F0D, 0x9646, 0x67D2, 0x634C, 0x7396 }, // S. Chinese Upper
65  { 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x8086, 0x4F0D, 0x9678, 0x67D2, 0x634C, 0x7396 }, // T. Chinese Upper
66  { 0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Modern
67  { 0x96F6, 0x58F1, 0x5F10, 0x53C2, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Trad.
68  { 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Lower
69  { 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Upper
70  { 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC, 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C }, // Korean Hangul
71  { 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 }, // Arabic Indic
72  { 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 }, // Est. Arabic Indic
73  { 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F }, // Indic (Devanagari)
74  { 0x0E50, 0x0E51, 0x0E52, 0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59 }, // Thai
75  { 0x0866, 0x0867, 0x0868, 0x0869, 0x086A, 0x086B, 0x086C, 0x086D, 0x086E, 0x086F }, // Odia
76  { 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F }, // Marathi
77  { 0x09E6, 0x09E7, 0x09E8, 0x09E9, 0x09EA, 0x09EB, 0x09EC, 0x09ED, 0x09EE, 0x09EF }, // Bengali
78  { 0x0A66, 0x0A67, 0x0A68, 0x0A69, 0x0A6A, 0x0A6B, 0x0A6C, 0x0A6D, 0x0A6E, 0x0A6F }, // Punjabi (Gurmukhi)
79  { 0x0AE6, 0x0AE7, 0x0AE8, 0x0AE9, 0x0AEA, 0x0AEB, 0x0AEC, 0x0AED, 0x0AEE, 0x0AEF }, // Gujarati
80  { 0x0030, 0x0BE7, 0x0BE8, 0x0BE9, 0x0BEA, 0x0BEB, 0x0BEC, 0x0BED, 0x0BEE, 0x0BEF }, // Tamil
81  { 0x0C66, 0x0C67, 0x0C68, 0x0C69, 0x0C6A, 0x0C6B, 0x0C6C, 0x0C6D, 0x0C6E, 0x0C6F }, // Telugu
82  { 0x0CE6, 0x0CE7, 0x0CE8, 0x0CE9, 0x0CEA, 0x0CEB, 0x0CEC, 0x0CED, 0x0CEE, 0x0CEF }, // Kannada
83  { 0x0DE6, 0x0DE7, 0x0DE8, 0x0DE9, 0x0DEA, 0x0DEB, 0x0DEC, 0x0DED, 0x0DEE, 0x0DEF }, // Malayalam
84  { 0x0ED0, 0x0ED1, 0x0ED2, 0x0ED3, 0x0ED4, 0x0ED5, 0x0ED6, 0x0ED7, 0x0ED8, 0x0ED9 }, // Lao
85  { 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29 }, // Tibetan
86  { 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049 }, // Myanmar
87  { 0x17E0, 0x17E1, 0x17E2, 0x17E3, 0x17E4, 0x17E5, 0x17E6, 0x17E7, 0x17E8, 0x17E9 }, // Cambodian (Khmer)
88  { 0x1810, 0x1811, 0x1812, 0x1813, 0x1814, 0x1815, 0x1816, 0x1817, 0x1818, 0x1819 }, // Mongolian
89  { 0x0020, 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8 }, // Hebrew
90  { 0x0966, 0x0967, 0x0968, 0x0969, 0x096A, 0x096B, 0x096C, 0x096D, 0x096E, 0x096F }, // Nepali
91  { 0x0F20, 0x0F21, 0x0F22, 0x0F23, 0x0F24, 0x0F25, 0x0F26, 0x0F27, 0x0F28, 0x0F29 }, // Dzongkha
92  { 0x0030, 0x0430, 0x0432, 0x0433, 0x0434, 0x0454, 0x0455, 0x0437, 0x0438, 0x0473 }, // Church Slavic
93 };
94 
96  0x002E, // Half Width (Ascii)
97  0xFF0E, // Full Width
98  0xFF0E, // Chinese Lower
99  0x70B9, // S. Chinese Upper
100  0x9EDE, // T. Chinese Upper
101  0x30FB, // Japanese Modern
102  0x30FB, // Japanese Trad.
103  0xFF0E, // Korean Lower
104  0x9EDE, // Korean Upper
105  0xC810, // Korean Hangul
106  0x066B, // Arabic Indic
107  0x066B, // Est. Arabic Indic
108  0x0000, // Indic (Devanagari)
109  0x0000, // Thai
110  0x0000, // Odia
111  0x0000, // Marathi
112  0x0000, // Bengali
113  0x0000, // Punjabi (Gurmukhi)
114  0x0000, // Gujarati
115  0x0000, // Tamil
116  0x0000, // Telugu
117  0x0000, // Kannada
118  0x0000, // Malayalam
119  0x0000, // Lao
120  0x0000, // Tibetan
121  0x0000, // Myanmar
122  0x0000, // Cambodian (Khmer)
123  0x0000, // Mongolian
124  0x0000, // Hebrew
125  0x0000, // Nepali
126  0x0000, // Dzongkha
127  0x0000, // Church Slavic
128 };
129 
131  0x002D, // Half Width (Ascii)
132  0xFF0D, // Full Width
133  0xFF0D, // Chinese Lower
134  0x8D1F, // S. Chinese Upper
135  0x5069, // T. Chinese Upper
136  0x2212, // Japanese Modern
137  0x2212, // Japanese Trad.
138  0xFF0D, // Korean Lower
139  0xFF0D, // Korean Upper
140  0xFF0D, // Korean Hangul
141  0x0000, // Arabic Indic
142  0x2212, // Est. Arabic Indic
143  0x0000, // Indic
144  0x0000, // Thai
145  0x0000, // Odia
146  0x0000, // Marathi
147  0x0000, // Bengali
148  0x0000, // Punjabi
149  0x0000, // Gujarati
150  0x0000, // Tamil
151  0x0000, // Telugu
152  0x0000, // Kannada
153  0x0000, // Malayalam
154  0x0000, // Lao
155  0x0000, // Tibetan
156  0x0000, // Myanmar
157  0x0000, // Cambodian (Khmer)
158  0x0000, // Mongolian
159  0x0000, // Hebrew
160  0x0000, // Nepali
161  0x0000, // Dzongkha
162  0x0000, // Church Slavic
163 };
164 
165 static sal_uInt16 SeparatorChar[] = {
166  0x002C, // Half Width (Ascii)
167  0xFF0C, // Full Width
168  0x3001, // Chinese Lower
169  0x3001, // S. Chinese Upper
170  0x3001, // T. Chinese Upper
171  0x3001, // Japanese Modern
172  0x3001, // Japanese Trad.
173  0x002C, // Korean Lower
174  0x002C, // Korean Upper
175  0x002C, // Korean Hangul
176  0x0000, // Arabic Indic
177  0x066C, // Est. Arabic Indic
178  0x0000, // Indic
179  0x0000, // Thai
180  0x0000, // Odia
181  0x0000, // Marathi
182  0x0000, // Bengali
183  0x0000, // Punjabi
184  0x0000, // Gujarati
185  0x0000, // Tamil
186  0x0000, // Telugu
187  0x0000, // Kannada
188  0x0000, // Malayalam
189  0x0000, // Lao
190  0x0000, // Tibetan
191  0x0000, // Myanmar
192  0x0000, // Cambodian (Khmer)
193  0x0000, // Mongolian
194  0x0000, // Hebrew
195  0x0000, // Nepali
196  0x0000, // Dzongkha
197  0x0000, // Church Slavic
198 };
199 
200 #define NUMBER_ZERO NumberChar[NumberChar_HalfWidth][0] // 0x0030
201 #define NUMBER_ONE NumberChar[NumberChar_HalfWidth][1] // 0x0031
202 #define NUMBER_NINE NumberChar[NumberChar_HalfWidth][9] // 0x0039
203 #define isNumber(n) ( NUMBER_ZERO <= n && n <= NUMBER_NINE )
204 #define isDecimal(n) ( n == DecimalChar[NumberChar_HalfWidth] )
205 #define isMinus(n) ( n == MinusChar[NumberChar_HalfWidth] )
206 #define isSeparator(n) ( n == SeparatorChar[NumberChar_HalfWidth] )
207 
208 const sal_Int16 Multiplier_Lower_zh = 0;
209 const sal_Int16 Multiplier_Upper_zh = 1;
210 const sal_Int16 Multiplier_Lower_zh_TW = 2;
211 const sal_Int16 Multiplier_Upper_zh_TW = 3;
212 const sal_Int16 Multiplier_Lower_ko = 4;
213 const sal_Int16 Multiplier_Upper_ko = 5;
214 const sal_Int16 Multiplier_Hangul_ko = 6;
215 const sal_Int16 Multiplier_Modern_ja = 7;
216 const sal_Int16 Multiplier_Traditional_ja = 8;
217 const sal_Int16 Multiplier_Count = 9;
218 
219 const sal_Int16 ExponentCount_6_CJK = 6;
220 
222  12, 8, 4, 3, 2, 1
223 };
225  {0x5146, 0x4EBF, 0x4E07, 0x5343, 0x767E, 0x5341}, // S. Chinese Lower
226  {0x5146, 0x4EBF, 0x4E07, 0x4EDF, 0x4F70, 0x62FE}, // S. Chinese Upper
227  {0x5146, 0x5104, 0x842C, 0x5343, 0x767E, 0x5341}, // T. Chinese Lower
228  {0x5146, 0x5104, 0x842C, 0x4EDF, 0x4F70, 0x62FE}, // T. Chinese Upper
229  {0x5146, 0x5104, 0x4E07, 0x5343, 0x767E, 0x5341}, // Korean Lower
230  {0x5146, 0x5104, 0x842C, 0x9621, 0x4F70, 0x62FE}, // Korean Upper
231  {0xC870, 0xC5B5, 0xB9CC, 0xCC9C, 0xBC31, 0xC2ED}, // Korean Hangul
232  {0x5146, 0x5104, 0x4E07, 0x5343, 0x767E, 0x5341}, // Japanese Modern
233  {0x5146, 0x5104, 0x842C, 0x9621, 0x767E, 0x62FE} // Japanese Traditional
234 };
235 
236 const sal_Int16 ExponentCount_2_CJK = 2;
237 
239  8, 4,
240 };
241 
243  {0x4EBF, 0x4E07}, // S. Chinese Lower
244  {0x4EBF, 0x4E07}, // S. Chinese Upper
245  {0x5104, 0x842C}, // T. Chinese Lower
246  {0x5104, 0x842C}, // T. Chinese Upper
247  {0x5104, 0x4E07}, // Korean Lower
248  {0x5104, 0x842C}, // Korean Upper
249  {0xC5B5, 0xB9CC}, // Korean Hangul
250  {0x5104, 0x4E07}, // Japanese Modern
251  {0x5104, 0x842C} // Japanese Traditional
252 };
253 
254 const sal_Int16 ExponentCount_7_CJK = 7;
255 
257  16, 12, 8, 4, 3, 2, 1
258 };
260  {0x4EAC, 0x5146, 0x4EBF, 0x4E07, 0x5343, 0x767E, 0x5341}, // S. Chinese Lower
261  {0x4EAC, 0x5146, 0x4EBF, 0x4E07, 0x4EDF, 0x4F70, 0x62FE}, // S. Chinese Upper
262  {0x4EAC, 0x5146, 0x5104, 0x842C, 0x5343, 0x767E, 0x5341}, // T. Chinese Lower
263  {0x4EAC, 0x5146, 0x5104, 0x842C, 0x4EDF, 0x4F70, 0x62FE}, // T. Chinese Upper
264  {0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767E, 0x5341}, // Korean Lower
265  {0x4EAC, 0x5146, 0x5104, 0x842C, 0x9621, 0x4F70, 0x62FE}, // Korean Upper
266  {0x4EAC, 0xC870, 0xC5B5, 0xB9CC, 0xCC9C, 0xBC31, 0xC2ED}, // Korean Hangul
267  {0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767E, 0x5341}, // Japanese Modern
268  {0x4EAC, 0x5146, 0x5104, 0x842C, 0x9621, 0x767E, 0x62FE} // Japanese Traditional
269 };
270 
271 }
272 
273 #endif // INCLUDED_I18NPOOL_SOURCE_NATIVENUMBER_DATA_NUMBERCHAR_H
274 
275 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const sal_Int16 NumberChar_pa
Definition: numberchar.h:42
const sal_Int16 NumberChar_EastIndic_ar
Definition: numberchar.h:36
const sal_Int16 NumberChar_FullWidth
Definition: numberchar.h:26
const sal_Int16 Multiplier_Count
Definition: numberchar.h:217
const sal_Int16 NumberChar_Hangul_ko
Definition: numberchar.h:34
const sal_Int16 NumberChar_Traditional_ja
Definition: numberchar.h:31
const sal_Int16 ExponentCount_6_CJK
Definition: numberchar.h:219
const sal_Int16 NumberChar_Modern_ja
Definition: numberchar.h:30
const sal_Int16 NumberChar_Count
Definition: numberchar.h:57
const sal_Int16 NumberChar_he
Definition: numberchar.h:53
const sal_Int16 ExponentCount_2_CJK
Definition: numberchar.h:236
const sal_Int16 NumberChar_Lower_ko
Definition: numberchar.h:32
const sal_Int16 ExponentCount_7_CJK
Definition: numberchar.h:254
const sal_Int16 NumberChar_mr
Definition: numberchar.h:40
const sal_Int16 Multiplier_Traditional_ja
Definition: numberchar.h:216
const sal_Int16 Multiplier_Lower_zh_TW
Definition: numberchar.h:210
const sal_Int16 NumberChar_hi
Definition: numberchar.h:37
const sal_Int16 NumberChar_ta
Definition: numberchar.h:44
const sal_Int16 MultiplierExponent_6_CJK[ExponentCount_6_CJK]
Definition: numberchar.h:221
const sal_Int16 NumberChar_HalfWidth
Definition: numberchar.h:25
const sal_Unicode MultiplierChar_7_CJK[][ExponentCount_7_CJK]
Definition: numberchar.h:259
sal_uInt16 sal_Unicode
const sal_Int16 NumberChar_Upper_ko
Definition: numberchar.h:33
const sal_Int16 NumberChar_bn
Definition: numberchar.h:41
const sal_Unicode MultiplierChar_2_CJK[][ExponentCount_2_CJK]
Definition: numberchar.h:242
const sal_Int16 NumberChar_bo
Definition: numberchar.h:49
const sal_Int16 NumberChar_dz
Definition: numberchar.h:55
const sal_Int16 NumberChar_my
Definition: numberchar.h:50
const sal_Int16 NumberChar_Upper_zh
Definition: numberchar.h:28
const sal_Int16 NumberChar_cu
Definition: numberchar.h:56
const sal_Unicode MultiplierChar_6_CJK[][ExponentCount_6_CJK]
Definition: numberchar.h:224
const sal_Int16 Multiplier_Hangul_ko
Definition: numberchar.h:214
const sal_Int16 NumberChar_te
Definition: numberchar.h:45
const sal_Int16 NumberChar_th
Definition: numberchar.h:38
const sal_Int16 Multiplier_Modern_ja
Definition: numberchar.h:215
const sal_Int16 NumberChar_Upper_zh_TW
Definition: numberchar.h:29
const sal_Int16 NumberChar_Indic_ar
Definition: numberchar.h:35
const sal_Int16 NumberChar_ne
Definition: numberchar.h:54
static sal_Unicode DecimalChar[]
Definition: numberchar.h:95
Constant values shared between i18npool and, for example, the number formatter.
const sal_Int16 NumberChar_or
Definition: numberchar.h:39
const sal_Int16 MultiplierExponent_2_CJK[ExponentCount_2_CJK]
Definition: numberchar.h:238
const sal_Unicode NumberChar[][10]
Definition: numberchar.h:59
const sal_Int16 NumberChar_gu
Definition: numberchar.h:43
const sal_Int16 NumberChar_km
Definition: numberchar.h:51
const sal_Int16 Multiplier_Upper_zh
Definition: numberchar.h:209
const sal_Unicode MinusChar[]
Definition: numberchar.h:130
const sal_Int16 MultiplierExponent_7_CJK[ExponentCount_7_CJK]
Definition: numberchar.h:256
static sal_uInt16 SeparatorChar[]
Definition: numberchar.h:165
const sal_Int16 Multiplier_Upper_zh_TW
Definition: numberchar.h:211
const sal_Int16 NumberChar_Lower_zh
Definition: numberchar.h:27
const sal_Int16 Multiplier_Upper_ko
Definition: numberchar.h:213
const sal_Int16 NumberChar_lo
Definition: numberchar.h:48
const sal_Int16 Multiplier_Lower_ko
Definition: numberchar.h:212
const sal_Int16 NumberChar_mn
Definition: numberchar.h:52
const sal_Int16 NumberChar_kn
Definition: numberchar.h:46
const sal_Int16 NumberChar_ml
Definition: numberchar.h:47
const sal_Int16 Multiplier_Lower_zh
Definition: numberchar.h:208