nsUnicodeToCP949.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -*- Mode: C; tab-width: 4; 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. #include "nsUnicodeToCP949.h"
  6. #include "nsUCvKODll.h"
  7. #include "nsUCConstructors.h"
  8. //----------------------------------------------------------------------
  9. // Global functions and data [declaration]
  10. // Unicode Hangul syllables (not enumerated in KS X 1001) to CP949 : 8822 of them
  11. static const uint16_t g_ufCP949NoKSCHangulMapping[] = {
  12. #include "u20cp949hangul.uf"
  13. };
  14. static const uint16_t *g_CP949MappingTable[3] = {
  15. g_ASCIIMappingTable,
  16. g_ufKSC5601Mapping,
  17. g_ufCP949NoKSCHangulMapping
  18. };
  19. static const uScanClassID g_CP949ScanClassTable[3] = {
  20. u1ByteCharset,
  21. u2BytesGRCharset,
  22. u2BytesCharset
  23. };
  24. nsresult
  25. nsUnicodeToCP949Constructor(nsISupports *aOuter, REFNSIID aIID,
  26. void **aResult)
  27. {
  28. return CreateMultiTableEncoder(3,
  29. (uScanClassID*) g_CP949ScanClassTable,
  30. (uMappingTable**) g_CP949MappingTable,
  31. 2 /* max len = src * 2 */,
  32. aOuter, aIID, aResult);
  33. }