1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/uconv/ucvtw/nsBIG5HKSCSToUnicode.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsBIG5HKSCSToUnicode.h" 1.10 +#include "nsUCvTWDll.h" 1.11 +#include "nsUCConstructors.h" 1.12 + 1.13 +//---------------------------------------------------------------------- 1.14 +// Global functions and data [declaration] 1.15 + 1.16 +static const uScanClassID g_BIG5HKSCSScanClassIDs[] = { 1.17 + u1ByteCharset, 1.18 + u2BytesCharset, 1.19 + u2BytesCharset, 1.20 + u2BytesCharset, 1.21 + u2BytesCharset, 1.22 + u2BytesCharset 1.23 +}; 1.24 + 1.25 +static const uint16_t *g_BIG5HKSCSMappingTableSet [] ={ 1.26 + g_ASCIIMappingTable, 1.27 + g_utBig5HKSCSMapping, 1.28 + g_utBIG5Mapping, 1.29 + g_utBig5HKSCSMapping, 1.30 + g_utBIG5Mapping, 1.31 + g_utBig5HKSCSMapping, 1.32 +}; 1.33 + 1.34 +static const uRange g_BIG5HKSCSRanges[] = { 1.35 + { 0x00, 0x7F }, 1.36 + { 0x81, 0xA0 }, 1.37 + { 0xA1, 0xC6 }, 1.38 + { 0xC6, 0xC8 }, 1.39 + { 0xC9, 0xF9 }, 1.40 + { 0xF9, 0xFE } 1.41 +}; 1.42 + 1.43 +//---------------------------------------------------------------------- 1.44 +// Class nsBIG5HKSCSToUnicode [implementation] 1.45 + 1.46 +nsresult 1.47 +nsBIG5HKSCSToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, 1.48 + void **aResult) 1.49 +{ 1.50 + return CreateMultiTableDecoder(6, 1.51 + (const uRange* ) &g_BIG5HKSCSRanges, 1.52 + (uScanClassID*) &g_BIG5HKSCSScanClassIDs, 1.53 + (uMappingTable**) &g_BIG5HKSCSMappingTableSet, 1.54 + 1, 1.55 + aOuter, aIID, aResult); 1.56 +} 1.57 + 1.58 +