michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsJohabToUnicode.h" michael@0: #include "nsUCvKODll.h" michael@0: #include "nsUCConstructors.h" michael@0: #include "mozilla/Telemetry.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: //---------------------------------------------------------------------- michael@0: // Global functions and data [declaration] michael@0: michael@0: static const uScanClassID g_JOHABScanClassIDs[] = { michael@0: u1ByteCharset, michael@0: uJohabHangulCharset, michael@0: u2BytesCharset, michael@0: uJohabSymbolCharset, michael@0: uJohabSymbolCharset michael@0: }; michael@0: michael@0: static const uRange g_JOHABRanges[] = { michael@0: { 0x00, 0x7E }, michael@0: { 0x84, 0xD3 }, michael@0: { 0x84, 0xD3 }, michael@0: { 0xD8, 0xDE }, michael@0: { 0xE0, 0xF9 } michael@0: }; michael@0: michael@0: static const uint16_t g_utJohabJamoMapping[] ={ michael@0: #include "johabjamo.ut" michael@0: }; michael@0: michael@0: static const uint16_t *g_JOHABMappingTableSet [] ={ michael@0: g_ASCIIMappingTable, michael@0: g_HangulNullMapping, michael@0: g_utJohabJamoMapping, michael@0: g_utKSC5601Mapping, michael@0: g_utKSC5601Mapping michael@0: }; michael@0: michael@0: michael@0: //---------------------------------------------------------------------- michael@0: // Class nsJohabToUnicode [implementation] michael@0: michael@0: nsresult michael@0: nsJohabToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, michael@0: void **aResult) michael@0: { michael@0: Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_JOHAB, true); michael@0: return CreateMultiTableDecoder(sizeof(g_JOHABRanges) / sizeof(g_JOHABRanges[0]), michael@0: (const uRange*) &g_JOHABRanges, michael@0: (uScanClassID*) &g_JOHABScanClassIDs, michael@0: (uMappingTable**) &g_JOHABMappingTableSet, 1, michael@0: aOuter, aIID, aResult); michael@0: } michael@0: