1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/uconv/ucvko/nsJohabToUnicode.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 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 "nsJohabToUnicode.h" 1.10 +#include "nsUCvKODll.h" 1.11 +#include "nsUCConstructors.h" 1.12 +#include "mozilla/Telemetry.h" 1.13 + 1.14 +using namespace mozilla; 1.15 + 1.16 +//---------------------------------------------------------------------- 1.17 +// Global functions and data [declaration] 1.18 + 1.19 +static const uScanClassID g_JOHABScanClassIDs[] = { 1.20 + u1ByteCharset, 1.21 + uJohabHangulCharset, 1.22 + u2BytesCharset, 1.23 + uJohabSymbolCharset, 1.24 + uJohabSymbolCharset 1.25 +}; 1.26 + 1.27 +static const uRange g_JOHABRanges[] = { 1.28 + { 0x00, 0x7E }, 1.29 + { 0x84, 0xD3 }, 1.30 + { 0x84, 0xD3 }, 1.31 + { 0xD8, 0xDE }, 1.32 + { 0xE0, 0xF9 } 1.33 +}; 1.34 + 1.35 +static const uint16_t g_utJohabJamoMapping[] ={ 1.36 +#include "johabjamo.ut" 1.37 +}; 1.38 + 1.39 +static const uint16_t *g_JOHABMappingTableSet [] ={ 1.40 + g_ASCIIMappingTable, 1.41 + g_HangulNullMapping, 1.42 + g_utJohabJamoMapping, 1.43 + g_utKSC5601Mapping, 1.44 + g_utKSC5601Mapping 1.45 +}; 1.46 + 1.47 + 1.48 +//---------------------------------------------------------------------- 1.49 +// Class nsJohabToUnicode [implementation] 1.50 + 1.51 +nsresult 1.52 +nsJohabToUnicodeConstructor(nsISupports *aOuter, REFNSIID aIID, 1.53 + void **aResult) 1.54 +{ 1.55 + Telemetry::Accumulate(Telemetry::DECODER_INSTANTIATED_JOHAB, true); 1.56 + return CreateMultiTableDecoder(sizeof(g_JOHABRanges) / sizeof(g_JOHABRanges[0]), 1.57 + (const uRange*) &g_JOHABRanges, 1.58 + (uScanClassID*) &g_JOHABScanClassIDs, 1.59 + (uMappingTable**) &g_JOHABMappingTableSet, 1, 1.60 + aOuter, aIID, aResult); 1.61 +} 1.62 +