intl/uconv/ucvtw2/nsEUCTWToUnicode.cpp

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:8b8e5c856f52
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 #include "nsEUCTWToUnicode.h"
7 #include "nsUCvTW2Dll.h"
8 #include "nsUCConstructors.h"
9
10 //----------------------------------------------------------------------
11 // Global functions and data [declaration]
12
13 //----------------------------------------------------------------------
14 // Class nsEUCTWToUnicode [implementation]
15
16 nsresult
17 nsEUCTWToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID,
18 void **aResult)
19 {
20 static const uScanClassID g_EUCTWScanClassIDs [] = {
21 u1ByteCharset,
22 u2BytesGRCharset,
23 u2BytesGRPrefix8EA2Charset,
24 u2BytesGRPrefix8EA3Charset,
25 u2BytesGRPrefix8EA4Charset,
26 u2BytesGRPrefix8EA5Charset,
27 u2BytesGRPrefix8EA6Charset,
28 u2BytesGRPrefix8EA7Charset
29 };
30
31 static const uint16_t *g_EUCTWMappingTableSet [] ={
32 g_ASCIIMappingTable,
33 g_utCNS1MappingTable,
34 g_utCNS2MappingTable,
35 g_utCNS3MappingTable,
36 g_utCNS4MappingTable,
37 g_utCNS5MappingTable,
38 g_utCNS6MappingTable,
39 g_utCNS7MappingTable
40 };
41
42 static const uRange g_EUCTWRanges[] = {
43 { 0x00, 0x7E },
44 { 0xA1, 0xFE },
45 { 0x8E, 0x8E },
46 { 0x8E, 0x8E },
47 { 0x8E, 0x8E },
48 { 0x8E, 0x8E },
49 { 0x8E, 0x8E },
50 { 0x8E, 0x8E }
51 };
52
53 return CreateMultiTableDecoder(8,
54 (const uRange*) &g_EUCTWRanges,
55 (uScanClassID*) &g_EUCTWScanClassIDs,
56 (uMappingTable**) &g_EUCTWMappingTableSet,
57 1, aOuter, aIID, aResult);
58 }

mercurial